# [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.

## Recommended Posts

Hi, as you might know a DX10 technique in an effect file looks like this:
technique10 Technique1 {
pass P0 {

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 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.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
19
5. 5

• 14
• 26
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631771
• Total Posts
3002253
×

## Important Information

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!