[windows] Awful performance unless some background programs are running?

Some users have reported a lot of erratic lag in my game which I’ve able to reproduce with my own older laptop. Oddly enough it seems to be something other than just hardware capabilities because the game runs at max fps if something is running in the background (like for me loading a webpage in chrome the background gives my game a perfect 60fps but it drops way back down to around 30fps as soon as the page is done loading). Also full screen for me runs a lot smoother than windowed in the same situation for some reason.

I’ve noticed turning off vsync improves performance drastically but of course also gives some screen tearing. Seeing as how I know my laptop’s capable of doing 60fps with vsync (while chrome is loading a webpage in the background) I’d like to figure out how to achieve that at all times.

As a partial-fix backup plan in case this issue is way too embedded into how lime works or something, is there a way to toggle vsync on/off in-game? If a restart’s needed that’s fine, but I can’t figure out how I’d add this, seems my only access to the vsync property is in the project.xml.

On Intel HD Graphics vsync is broken, as it’s implemented with Windows’ Sleep(), which is affected by global timer resolution.

That’s unfortunate. :frowning: Is there any way to toggle vsync in-game with OpenFL?

In-game? Not that I know of, but you can compile with this:

<window vsync="false" />

The problem is, the “vsync” flag is passed when the window is created, and there’s no function to change it after the fact.

That should be possible on OpenGL but currently not exposed to haxe side yet.

My workaround is using DwmFlush when available. This wii not be affected by timer resolution even on Intel GPU.
This would require recompilation of lime.ndll though.