Sign in to follow this  

Stupid question or big performance gain?

Recommended Posts

cozzie    5029
Just thought of something.
Say my shader sets some renderstates or sampler states, say texture filtering technique or alphablend setting. At runtime, will these states be set again and again for each processed vertex/pixel?

If so, wouldn't it be a great performance gain to set it on the device in my code (setrenderstate) once? assuming all upcoming draw calls in the shader use them.

(i also use the d3dxdonotsavestate flag in beginning my effects/ shaders)

Share this post

Link to post
Share on other sites
Tom KQT    1704
You mean the effect framework, right? It simply sets the render or sampler state the same way you would (device->SetRenderState etc.), there's no magic behind it. It definitely doesn't set it per vertex/pixel ;)
You can do some optimizations if you do it manually (for example don't set a state to the same value it already has), but that's not directly related to your question, and the performance gain may be very small (if any). Edited by Tom KQT

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this