Advertisement Jump to content
Sign in to follow this  

Graphics Hardware simultaneous or asychronous??

This topic is 4206 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 guess this is a question about how the operating system of a (WinXP) computer interacts with the graphics accelerator card. I don't completely understand the issues regarding wether the GPU and graphics card are actually operating "concurrently" with the rest of the computer, or wether the GPU must complete all its processing before returning control of the code back to the executable/Operating System. What difference this makes to a programmer will become clear after I show an example. Let me be a little more explicit about what I am trying to ask here. We have two possibilities: [Possibility A] The GPU sits idle and waits for commands from an executable in memory. Upon receiving a command from the executable, it then stops the processing of any further code, performs the action, and then returns control of the computer back to the executable. Possibility A means that the CPU in a computer runs asynchronously with the GPU. The "acceleration" gained from a graphics accelerator here means that the GPU is merely compressing the time that it takes to perform 3D graphics, rather than actually loading the work off the main CPU while the CPU does "other things". [Possibility B] The GPU is never idle, and is constantly processing graphics operations regardless of what the rest of the computer is doing, and regardless of the speed at which the rest of the computer is doing it. In this scenario, the GPU runs *simultaneously*, or "concurrently", with the CPU and the operating system, and the executable itself. An executable that is issuing openGL functions is actually "dispatching" commands to the GPU; but after dispatching such commands, it does not sit there and wait for a result, but goes on to the rest of the code in the main executable. I have a few large books on programming 3D games using graphics hardware, and none of them address this issue with any clarity. I don't know whether I am programming a machine that is engaging in Possibility A, or one that is engaging in Possibility B!! If you think that this issue doesn't matter or whatever, consider the following code from a callback function for a WinXP executable: // Data initialized elsewhere before OnIdle() Vector4f* avInput = <array of vectors> Vector4f* avOutput = <array of transformed vectors> float * afPIn = (float *)avInput; float * afPOut = (float *)avOutput; // BOOL CGameApp::OnIdle(LONG lCount) { // Let the base class perform its overhead tasks. CWinApp::OnIdle(lCount); if( firstidlecall ) { firstidlecall = false; // Never do this again // Perform initialization. glMatrixMode(GL_MODELVIEW); } else { // Otherwise get the results of commands // issued the last time. glGetFloatv(GL_MODEL_VIEW_MATRIX, afPOut ); glPopMatrix(); } AppDefined_UpdateMatrix(avInput); glPushMatrix(); glMultMatrix3f(afPIn); return TRUE; // call ::OnIdle() again. } If Possibility A is going on, then placing the glMultMatrix3f() right before the return call will not gain any speed over just performing all the gl operations in a row and waiting for the result. However, if the GPU is running "concurrently" with the CPU then the glMultMatrix3f() may be performed while the rest of the system is performing other tasks, such as dispatching messages and executing other active threads elsewhere in memory. This issue is very important if you are considering writing code that is going to use the GPU as a "second processor" in the computer meant to perform computations other than 3D graphics. If they do not run cuncurrently, then you are really not loading anything off onto the graphics card, but merely comparing the relative speed of the GPU against the same operations performed in software.

Share this post

Link to post
Share on other sites

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

This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!