Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

johnnyBravo

Calling things like SetRenderState etc to many times a waste of frame rate?

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

I''m wondering if calling things like SetRenderState, SetMaterial or SetTexture too many times, like say I call one of each for each item drawn would that slow my frame rate down alot, so should i just group the objects to be drawn in such a way so i only call the set whatever once. Thanks,

Share this post


Link to post
Share on other sites
Advertisement
Yes, any kind of stage change will adversely effect your application performance. Render queue sorting is indeed a good idea.

Share this post


Link to post
Share on other sites
How about calling GetRenderState etc, and seeing if the values are the same, if they are do nothing, if not SetRenderState.

Would this be good enough to keep up the speed?

Share this post


Link to post
Share on other sites
Not as such. It will likely stall the device, not to mention that pure devices do not support Get* calls.

"... This method will not return device state for a device that is created using D3DCREATE_PUREDEVICE. If you want to use this method, you must create your device with any of the other values in D3DCREATE."

The best way is to keep track of your current renderstate yourself by recording changes, ignoring redundant changes, and sorting your rendering queue based on the most expensive state changes (textures, etc). Care must be given to where sorting would actually cause the application to run slower than if you were to change the state -- however, changing states affects different hardware in different ways. Driver execs from the companies may be able to clear up which are the worst in their cases.

Share this post


Link to post
Share on other sites
I see,

I guess ill have to put all those things into the d3d class, and leave the mesh, primitive classes without them.

thanks guys for clearing up everything

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!