Jump to content
  • Advertisement
Sign in to follow this  
HaywireGuy

100% CPU when D3D window is obstructed?

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

Greetings people, just a simple one: Why does CPU usage gone sky-rocketting when a non-fullscreen Direct3D window is in the background? Take any of the DirectX SDK tutorial samples, if the window is partially obstructed the CPU usage is only 2 percent, but when it is totally blocked by another window, it is using 100% CPU. What's the cause of it and how can this be addressed? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
When your program gets an unfocus message, call WaitMessage().

The CPU will still roar when a window is in the process of being moved around over the app, because it will probably use ON_PAINT to redraw the window.

Share this post


Link to post
Share on other sites
Quote:
Original post by HaywireGuy
What's the cause of it and how can this be addressed? Thanks in advance!

I forget the exact reasoning - but I did see an explanation of this "issue" from one of the DirectX developers a while back. Gonna bug me now [oh]

IIRC, it's something to do with the way that the runtime has to do extra clipping/copying operations so as to "play nice" with the other windows. Things are a bit easier for it when it's in focus [smile]

hth
Jack

Share this post


Link to post
Share on other sites
Jack, it happens when the D3D is TOTALLY obstructed by other window. Even if
there is 1% of the client area that is visible, the CPU usage remains at 2%.
What I think could be the possibility was that the rendering routine pass
without rendering anything (since the window is invisible to the user), so the
message pump goes looping with literally nothing in it, causing the CPU usage
to go all the way up.

Just like what Jiia said, I use GetMessage() when the window does not have the
focus, this problem goes away. Thanks anyway Jack for your help :)

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!