Jump to content
  • Advertisement
Sign in to follow this  
shirsoft

GPU as a processor

This topic is 4834 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 tried drawing textured quads until my fps dropped to nearly 0 and observed that my cpu usage is nearly 100%. But how can this happend when all gpu calls are async and return immediately. Also is it possible that the gpu can skip some operations in case its too busy?

Share this post


Link to post
Share on other sites
Advertisement
You are reading too much into a number, dont worry about it, if it concerns you call Sleep(0) or some other value everyframe.

Share this post


Link to post
Share on other sites
How are you drawing your quads? If you're using glBegin/glVertex/glEnd, that's not at all surprising. If you're only drawing one quad per call to DrawArrays/DrawElements or DrawPrimitive/DrawIndexedPrimitive, that's not surprising.

Share this post


Link to post
Share on other sites
Try trianges - GPU's are optimized for them, where as quads will probably require some extra processing by the CPU to turn them into triangles.

Secondly, instead of using display lists, fill up a big buffer with all your quad data and use glDrawElements to draw it each frame.

Share this post


Link to post
Share on other sites
Still, I am not able to figure out the cpu-gpu interaction. I mean what is the expected behavior when the gpu is given much more data than it can process? Does it skip some of it or does it request the cpu to wait for completion.
My guess is that it would skip stuff coz originally gpu were designed for gaming and frame skip wasnot not critical. However it might become necessary now as they are also being used as gpgpu's.

Share this post


Link to post
Share on other sites
the gpu will render everything you tell it to, and your cpu usage will max out if your game loops is a variation of

bool done = false;
while (!done) {
//get input
//do physics
//redraw
}


that is unless you put some sleep command in there somewhere which will at the very least give other processces on your machine some cpu time, and might reduce your cpu usage [a cpu usage of 100% isn't a big deal... unless things aren't getting done that should be]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Rendering commands get buffered. If this buffer fills, the CPU will stall (wait) on the next rendering command until the GPU finishes what it is processing and takes something out of the buffer.

Share this post


Link to post
Share on other sites
Quote:
Original post by shirsoft
I tried drawing textured quads until my fps dropped to nearly 0 and observed that my cpu usage is nearly 100%. But how can this happend when all gpu calls are async and return immediately.
Also is it possible that the gpu can skip some operations in case its too busy?


Have you tried to profile your code to determine what one function or combination of functions that hog the application time the most?

Share this post


Link to post
Share on other sites
if you are running a Geforce5 upwards, there is a tool called nvperfhud (developer.nvidia.com) that displays the CPU and GPU on-top of your app, so you ca n see whether your app is CPU or GPU bound.

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!