Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To set the rasterizer state I have to ID3D11Device::CreateRasterizerState() and then ID3D11DeviceContext::RSSetState. And then I should ID3D11RasterizerState::Release() it, right?

  • How about when I want to change the state? Do I follow the above 3 steps again?
  • When I want to change just 1 setting (i.e. only CullMode) do I still have to fill and set whole structure?
  • Also, do I have to create and release the state object each time (assuming I don't want to set the exact same state again in the future)?
  • How about performance? If I set the exact same state again does it do anything? Is there a difference between changing only 1 setting or most/all of them?
share|improve this question
up vote 2 down vote accepted

You have to set entire state blocks at a time, even if you want to change only a single value.

You should create all the state blocks you need and hold on to them as long as you may need them. Don't create-set-release. That introduces unnecessary resource churn. The API will share redundant state block data under the hood so you shouldn't need to worry about that.

The underlying API will handle state changes for an entire state block efficiently. The debug layer will notify you of entirely redundant state block sets, however.

To improve performance, aim for minimal state change anywhere in a graphics API. That usually means batching operations on geometry that shares needed state. However, don't be afraid to change state when you need to.

share|improve this answer
But if I want to set a state that differs in some way from the RasterizerStates I've already created then I have to create another one? There's no way of changing the settings of an already created RasterizerState? – NPS Feb 24 '14 at 2:54
Correct; they are immutable objects. – Josh Petrie Feb 24 '14 at 3:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.