Excuse my ignorance: How do you synchronise with the VBI? I see you are not using the D3DKMTWaitForVerticalBlankEvent function (see johnsa's Vertical Retrace Sync with GDI/Win32 post).
D3DKMTWaitForVerticalBlankEvent has some side effect as you can read in johnsa's Vertical Retrace Sync with GDI/Win32 thread.
Alfonso,
D3DKMTWaitForVerticalBlankEvent you can find in the gdi32.dll ( it's not available in the masm32 gdi32.lib )
I'm setting up a fake video device ( tricky but it works ) to get to the interface that gives me access to the Video/Monitor rasterizer.
First I get the monitor refresh rate from GetDeviceCaps then create a timer thread with the SystemClock interface and set up a one-shot advise request for the reference time at slightly less then the monitor refresh rate.
Then I continuously poll the signal till it enters the Vertical blank, and start the one-shot advise timer again.
From now on I'm sure I don't poll more then necessary and we don't drift away out of the vertical blank period. ( it's only +/- 0.5 milliseconds long )
On my machine it has +/- 10 microseconds accuracy and not too much cpu workload.
The only thing ( I think, not 100% sure) is not to wake up the GDI event queue when we dont want it to take over the drawing management from us.
And another thing, not every video card behaves the same as other cards......
I miss the old Amiga days, perfect 50 Hz on all machines, no stutter at all.
