Good reads all around. Bizhawk actually has a timer throttle that uses a similar basic implementation; QueryPerformanceCounter() with Sleep() for long waits and Yield() for short waits. (I never looked at it until I read these articles, heh.) The CPU usage is quite high compared to D3D9 VSync throttle, and the particular implementation makes no attempt to synchronize anything to VBlank, but otherwise does well enough.koitsu wrote:...but QueryPerformanceCounter() will give you microsecond precision, despite slight bits of overhead (depends on what you're doing. So I'm still not convinced this is a problem. Here's some other information I found, which also contains code:
But perhaps I'm letting the original problem get away from me here... When does D3DPRESENT_INTERVAL_ONE not work right? And if the answer is "when crappy drivers!", then is there anything that can be guaranteed to work in such a situation? If all you have is GDI+, you can't guarantee any sort of timing because your paint commits have another dozen layers of sludge to go through before they get to hardware.