Sign in to follow this  

[DX10] Simple State Questions

This topic is 3380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, as you might know a DX10 technique in an effect file looks like this:
technique10 Technique1 {
    pass P0 {
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
        
         SetDepthStencilState(DSStateFoo, 0 );
         //SetRasterizerState(RSFoo);
         SetBlendState(BSFoo, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
    }
}

The three state objects (structures) DSStateFoo, RSFoo and BSFoo are defined at top of the HLSL file. My questions: 1) What happens if I dont set a state in the technique10 declaration? In this example I commented out the rasterizer state. Does this mean all rasterizer states used from previous render passes will be used? 2) What happens if I set a state in the effect file (for example BSFoo), which does not define all attribues. For example:
BlendState BSFoo {
	BlendEnable[0] = FALSE;
};

BSFoo only defines BlendEnable[0] but all other blendstate variables are not set. What values will these variables have? Will the system take the previous values or will it set all undefined values to default values? 3) How should I manage my states? Should every technique ALWAYS set ALL state objects? Or should I only set a state if the technique requires a different attribute (isnt this really complicated because to do so I have to how the states look like if I start the technique?) 4) Should I set my states directly in the effect file (like in this example) or in the host application? Thanks!

Share this post


Link to post
Share on other sites
1. Yes, if you don’t set something in a technique the current state will be unchanged.
2. As state objects need to be defined complete for creation the effect framework will fill missing elements with the default values.
3. I recommend setting all states inside a technique. If you don’t do so you need to write your own additional state management.
4. Again. If you don’t fell like doing your own additional state management you should use the state management of the effect framework.

Share this post


Link to post
Share on other sites

This topic is 3380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this