Jump to content
  • Advertisement
Sign in to follow this  
Ethangar

Will turning device features On and Off frequently cause slowdowns?

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

In my program, I would like certain parts of my rendering loop to have alpha blending and other parts to not have alpha blending. The same goes for anisotropic filtering. Will turning these things on and off throughout my rendering loop slow my program down?

Share this post


Link to post
Share on other sites
Advertisement
Any kind of state change has some kind of an overhead. From what I understand, though, impure devices (those created without the D3DCREATE_PUREDEVICE flag) will filter redundant state changes increasing speed somewhat, but pure devices will not. I'm not sure how good the state change filter is, though.

Share this post


Link to post
Share on other sites
It won't slow it down enough that you'll notice.

Two words of warning, though:

1) You'll typically want to render everything opaque before you render everything transparent (blended), and you want to turn off Z write when you render transparent.

2) If you render with alpha testing (in addition to, or instead of, alpha blending) then "early Z culling" will be less effective, or even disabled, for the rest of the scene, until you clear the Z buffer. If you have lots of overdraw, this might hurt on cards with poor fill rate.

Share this post


Link to post
Share on other sites
It's hard to say. However,
    blending on, draw A, blending off, draw B, blending on, draw C, blending off, draw D 
is slower than
    blending on, draw A, draw C, blending off, draw B, draw D 
which is slower than
    blending on, draw A and C, blending off, draw B and D 

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!