Jump to content
  • Advertisement
Sign in to follow this  

[DX10] Simple State Questions

This topic is 3596 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 );
         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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!