Original Post
🔒 Locked
INTERVAL_ONE
Advertisement
It stalls the GPU. The CPU can continue to add more stuff to be rendered. If there are already 3 frames queued up for render the CPU will stall too. The CPU unstalls when something like half the buffer is empty. This can cause problems where you render a few frames quickly, wait, render a few frames quickly, wait, etc... Your animation is based on processing time, not the time things are displayed and you get jerky looking animation, even though you have good framerate.
A trick often used is to lock the back buffer, causing a stall until both GPU and CPU are in sync again. You should delay this as much as possible...ie:
ProcessAI
ProcessSound
ProcessInputs
UpdateObjects
Frustum/Occlusion cull (if software occ. cull like Zhang HOM)
Sort
Lock backbuffer
Unlock backbuffer
Clear
BeginScene
Render
Present
EndScene
By delaying the lock until just before we render we gain GPU parallelism while doing AI,Sound,Input,and render preparation. This means our game must now run slightly better than 60Hz to acheive 60Hz, but it''s better than the jerky animation alternative.
A trick often used is to lock the back buffer, causing a stall until both GPU and CPU are in sync again. You should delay this as much as possible...ie:
ProcessAI
ProcessSound
ProcessInputs
UpdateObjects
Frustum/Occlusion cull (if software occ. cull like Zhang HOM)
Sort
Lock backbuffer
Unlock backbuffer
Clear
BeginScene
Render
Present
EndScene
By delaying the lock until just before we render we gain GPU parallelism while doing AI,Sound,Input,and render preparation. This means our game must now run slightly better than 60Hz to acheive 60Hz, but it''s better than the jerky animation alternative.
Another (less expensive) way in Direct Draw to resync the devices is to use GetBlitStatus (or GetFlipStatus... I think both will work). Just loop in a while until these return true, the body being "Sleep(1)". The advantage of this is that it will cause your program not to take 100% CPU anymore as well
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement