Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualbelfegor

Posted 12 April 2013 - 01:47 PM

1. Enable maximum debug level, and check all functions that returns HRESULT

2. You don't need SetTransform, you pass transformation matrices to shader

3. Forget about D3DMATERIAL9, D3DLIGHT9, SetTextureStageState...

4. If you are using id3dxeffect interface you can also forget about SetRenderState since you set them in technique block:

 

technique myTech
{
    pass myPass0
    {
        VerttexShader = ...;
        PixelShader = ...;
       
        // this will call SetRenderState under the hood by id3dxeffect
        CULLMODE = CW;
        STENCILENABLE = TRUE;
        ALPHABLENDENABLE = FALSE;
        ...// and what not
    }
};

 

5.

...can't I just enable specular lighting via SetRenderState?

No, you are doing it "manually" since you wish to use shaders.

 

6

What happens if I don't provide the right declaration?

It may draw and it may not. There should be some error/warning in debug output (if you are using VS) about that (provided that you enabled some debug flags).

 

7.

How do I know what I need to have in my vertex declaration?

 

It depends on your need. What vertex elements does your geometry have?


#1belfegor

Posted 12 April 2013 - 01:45 PM

1. Enable maximum debug level, and check all functions that returns HRESULT

2. You don't need SetTransform, you pass transformation matrices to shader

3. Forget about D3DMATERIAL9, D3DLIGHT9, SetTextureStageState...

4. If you are using id3dxeffect interface you can also forget about SetRenderState since you set them in technique block:

technique myTech
{
    pass myPass0
    {
        VerttexShader = ...;
        PixelShader = ...;
       
        // this will call SetRenderState under the hood by id3dxeffect
        CULLMODE = CW;
        STENCILENABLE = TRUE;
        ALPHABLENDENABLE = FALSE;
        ...// and what not
    }
};

 

5.

...can't I just enable specular lighting via SetRenderState?

No, you are doing it "manually" since you wish to use shaders.

 

6

What happens if I don't provide the right declaration?

It may draw and it may not. There should be some error/warning in debug output (if you are using VS) about that (provided that you enabled some debug flags).


PARTNERS