ignoring redundant renderstate->

Started by
11 comments, last by IFooBar 21 years, 4 months ago
Calls to Get* are quite expensive and cause a stall in the render pipeline, so avoid them if at all possible.

A good opetion here is keep track of your renderstates, the overhead with a few if/else _should_ be alot less than the redundant renderstate. You should try your own wrapper function here, works really well

if (currentstate == requiredstate) break;
else
SetRenderState(...)

there is a great topic over on Opengl.org forums on this topic, a major contributor to the discussion is one of the driver programmers at nvidia. I know its OpenGL but the principles still apply.

How expensive are redundant state changes





Advertisement
GetRenderstate is not working on a pure device, and the renderstates are not filtered on pure devices too.

You can find out this when you switch to SW Vertexprocessing or else, When your performence is higher than on a pure device you are doing something wong.
A pure device is the fastest way to render, when you are doing it right.
A manager is not the way to handle this, the right way is Batch,batch,batch so you habe no, or only a few renderstate changes.
When you are batching you have to sort by renderstate,shader,texture and Vertex and Pixelshaderconstants.
The Vertex and Pixelshaderconstants are expansive too !!!!!!!
I have do this and i have a performace plus of 400 %

Look at the nvidia tech doc, they are great !! But not easy to do, since there are many changes in the engine.
A wrapper function, though, would kind of ruin the use of state blocks, wouldn''t it?

This topic is closed to new replies.

Advertisement