Sign in to follow this  

100% CPU when D3D window is obstructed?

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

This topic is 4600 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this