Jump to content
  • Advertisement

Archived

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

haro

Optimization with WM_ERASEBKGND??

This topic is 5661 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 windows message handler I decided to add a proc for WM_ERASEBKGND where I simply return a 0, so that any code for clearing the screen would be avoided (I''m rewriting the entire screen each frame), and I expected a modest FPS increase but, in fact, this caused a relatively negligable decrease in FPS.. but a decrease all the same. Any ideas why this would happen? My only idea was perhaps that DirectX already prevents WM_ERASEBKGND''s, so by manually preventing it I simply added a useless switch in my message handler. One further question about switch statements in particular: Are switch statements implemented in code with a binary search? I always assumed this was so and the reason you could not use any non-numeric values for a case statement.. If it is compiler specific I use studio.net.

Share this post


Link to post
Share on other sites
Advertisement
Dx8 & 9 do seem to handle everything like that for you (Dx7 didn''t).

It is a common optimization to use a jump-table for a switch statement (much faster than a BST).

Share this post


Link to post
Share on other sites
Ok, that clears up alot of the seemingly "magical" results I''ve been having. Thanks.

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.

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!