mirror of https://github.com/bjornbytes/lovr.git
Force set vsync in lovrGraphicsCreateWindow;
Headset drivers are allowed to override the vsync setting if vsync messes up their frame timing. The vsync property is effectively a global piece of state in core/os and doesn't change across restarts because the window is persistent. This can mean that if you switch from a headset driver that wants vsync off (anything except desktop) to a headset driver that doesn't care what the vsync is (desktop), you could end up with a vsync setting that doesn't match t.window.vsync. I think this is a symptom of poor design somewhere and the best solution to this probem is "to just not have it". Similar issues exist for, e.g. the window size (but that one is less weird because at least you were the one who changed it). For now we are just going to ensure that lovr.graphics.createWindow always modifies the vsync property. Untested, may need to adjust this fix later.
This commit is contained in:
parent
a68320c66a
commit
5c381ead34
|
@ -226,6 +226,7 @@ void lovrGraphicsCreateWindow(WindowFlags* flags) {
|
|||
flags->debug = state.debug;
|
||||
lovrAssert(!state.initialized, "Window is already created");
|
||||
lovrAssert(lovrPlatformCreateWindow(flags), "Could not create window");
|
||||
lovrPlatformSetSwapInterval(flags->vsync); // Force vsync in case lovr.headset changed it in a previous restart
|
||||
lovrPlatformOnQuitRequest(onQuitRequest);
|
||||
lovrPlatformOnWindowResize(onResizeWindow);
|
||||
lovrPlatformGetFramebufferSize(&state.width, &state.height);
|
||||
|
|
Loading…
Reference in New Issue