Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to create a ID3D10RasterizerState with direct3D10, and then call

ID3D10Device::RSSetState() with the proper information. However, whenever the window get rescaled, or when the app goes fullscreen, the rasterizerstate seems to reset to the default state. I have tried to set the state with WM_SIZE messages, but awkwardly, nothing seems to happen...

It works properly when I call RSSetState() every frame, but that seems highly inefficient.

Does anyone know a solution to this? It seems to be poorly documented on msdn.


bool TestGameApp::InitGame()
    desc.AntialiasedLineEnable = TRUE;
    desc.CullMode = D3D10_CULL_NONE;
    desc.DepthBias = 0;
    desc.DepthBiasClamp = 0.0f;
    desc.FillMode = D3D10_FILL_SOLID;
    desc.FrontCounterClockwise = false;
    desc.MultisampleEnable = true;
    desc.ScissorEnable = FALSE;
    desc.SlopeScaledDepthBias = 0.0f;


    //...more code


switch( message )
    case WM_SIZE:
share|improve this question
add comment

1 Answer

Go ahead and call it every frame. It's not inefficient; that's the way you're supposed to do it. Game engines often call it (and other SetState methods) many times per frame in order to switch render states for different parts of the frame.

share|improve this answer
Since I don't need to change it every frame, it seems inefficient to me. If you need to change it every frame, I agree, but this is not the case. Is there no way around? –  xcrypt Nov 10 '11 at 12:05
@xcrypt, it's such an insignificant cost it's seriously not worth worrying about! –  Nathan Reed Nov 10 '11 at 17:39
It's more of an attitude :) Maybe the benefits are really small and not noticeable, but I still try to avoid writing abundant code. Your reply is great side-information, but unfortunately it's not an answer to my question. –  xcrypt Nov 14 '11 at 18:53
@xcrypt: I think that Nathan DID give you the solution- it's designed to be called every frame. You WILL find lots of places to optimize, but you're wasting your time here. (If it's an attitude it's a poor one. :P codinghorror.com/blog/2005/01/the-real-cost-of-performance.html ) –  KTF Dec 16 '11 at 16:25
@KTF your opinion is invalid. But more importantly, The question is not about design principles or standards. It's a pure technical question. I do not need lectures about why minimal performance gains may or may not be a good thing. This is how I like to code. And yes, I am aware of all the quotes / lectures in the world telling me not to do it, I know why people consider it a bad thing in an 'economically efficient environment'. That does not mean it's not a great exercise. –  xcrypt Dec 16 '11 at 21:37
show 2 more comments

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.