Sign in to follow this  

DX9 SetRenderState() question

This topic is 3310 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

Is there a performance penalty for calling SetRenderState() if the call is not actually changing a render state attribute? For example, if SetRenderState(D3DRS_SRCBLEND, D3DBLEND_INVSRCALPHA) is performed prior to every DrawPrimitive(), will there be a performance penalty? thanks

Share this post


Link to post
Share on other sites
If you change at least one render state, there is a penalty at the next draw call. It doesn't matter how many render states you change in between, only broad categories matter. (Vertex processing is separate from pixel processing.)

Share this post


Link to post
Share on other sites
if you create the device with D3DCREATE_PUREDEVICE, the device does not check redundant calls.
the sample "StateManager" in the SDK is a good example for that

Share this post


Link to post
Share on other sites
In my app every drawPrimitive() is immediately preceded by a source texture change (except for the rare case when the vertex buffer is full and a D3DLOCK_DISCARD lock is necessary.) So, if I understand the replies to my initial post, my app takes no additional performance hit if each drawPrimitive() is also preceded by a (possibly redundant) SetStreamSource(), SetFVF(), and/or multiple SetRenderState()'s. Is this true?

thanks

Share this post


Link to post
Share on other sites
In relation to this question, here is something I've never been clear on: does setting renderstates in the shader technique (using the FX interface) produce the same penalty?

On looking at my shader techniques, I find I'm setting a bunch of possibly redundant renderstates...Should I remove anything that may be redundant?

Share this post


Link to post
Share on other sites
Quote:
Original post by Matt Aufderheide
In relation to this question, here is something I've never been clear on: does setting renderstates in the shader technique (using the FX interface) produce the same penalty?

I think,they (i mean FX system creators) use render state blocks records,
it seems more logical.

Share this post


Link to post
Share on other sites
Sign in to follow this