Detecting if VSYCN on or off?

Blitz3D Forums/Blitz3D Programming/Detecting if VSYCN on or off?

Imperium(Posted 2013) [#1]
I'm trying to write a function to detect whether or not Vsync is on or off. My project uses a frame limiter and Vwait if Vync is off to limit the framerate. I've tried passing a global to the function and so far it just doesn't work right.

Does anyone know how I can do this with Blitz code or by use of a external dll? To make it worth someones time I will offer a free low poly model of whatever you request.


Who was John Galt?(Posted 2013) [#2]
You could try looping a flip command- if no vsync is off you should get a miniscule frame time with no drawing being done.


Imperium(Posted 2013) [#3]
When Vsync if off I get 62 FPS, when it's on it stays locked at 60 and drops to 58 at the most. I guess I could do a simple check regarding FPS but its really not detecting the hardware.


SLotman(Posted 2013) [#4]
Also, on Windows 8 fullscreen you'll be limited to ~30fps, no matter if you use vsync or not. (It's a win8 bug, with all dx7 games)


Imperium(Posted 2013) [#5]
Thanks for the heads up but I'm already familiar with this Microsoft issue. I've posted in quite a few threads about this. Solutions like Softpixel and Xors3d offer DX9 support so at least we have a work around.

My project has some bad image tearing without Vsync on. It's not very noticeable on a CRT but very obvious on LCD monitors.


Rroff(Posted 2013) [#6]
I'm not sure if there is a way to detect if VSync is forced via the GPU drivers reliably - it wouldn't be enough to check for 60Hz as some people will be using 75, 120, 144, etc. Hz displays.

Best thing to do with a situation like that anyhow is to have an option the user can change as forcing a set framerate can potentially be very annoying if people have setups that don't fall exactly inline with your ideal target setup.


jfk EO-11110(Posted 2013) [#7]
couldn't you simply:
t=Millisecs()
for i=0 to 1000
vwait
next
if (millisecs()-t)<2 then print "is off"