YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
15 stars 7 forks source link

Performance: G-Sync can cause flickering when using GameMaker #6515

Open RhyminGarfunkle opened 2 weeks ago

RhyminGarfunkle commented 2 weeks ago

Description

Upon launching the IDE, the entire screen (even parts of the screen that aren't part of the GameMaker IDE, like the Windows start bar) begin rapidly flickering any time any portion of the IDE window visually changes. I believe this is VRR, or Variable Refresh Rate, flicker, which can happen on G-Sync or Freesync monitors when the frame rate rapidly changes, because disabling G-Sync causes the issue to disappear entirely.

The flicker starts any time anything on the screen changes. This includes events like scrolling a code window, having new text appear on the GameMaker start screen, or even just moving the mouse around. The flicker takes the form of rapidly oscillating the screen brightness at what I believe is the monitor refresh rate, and lasts for half a second or so.

This flicker does not appear when using most other applications. The only other time it happens is during loading screens for some 3D games, or during particularly graphically intense scenes in those games. Other windowed applications, like web browsers or 3D CAD programs, do not cause this flicker to occur.

The flicker does not occur if GameMaker is not the focused window. For example, if I have GameMaker maximized and another non-maximized window in focus over the GameMaker window, I can move the mouse over the GameMaker window and scroll the workspace up and down using the middle mouse wheel with no screen flicker. If I click on the GameMaker window to bring it into focus and do the same thing, the flicker will happen as I scroll around.

I have a second monitor with a fixed 60hz refresh rate, and the flicker does not affect that monitor. Flicker does not appear on either monitor when using GM on the 60hz monitor. It DOES appear when the GM window is stretched across both monitors, but only on the g-sync compatible monitor - the 60hz monitor remains unaffected.

There are guides on the internet for reducing VRR flicker, but they do not make the issue go away, they only lower the intensity of the flicker. The only fix is to fully disable G-Sync from the Nvidia control panel.

According to the control panel, G-Sync should only be used on full-screen applications, but for some reason it appears to be used with GameMaker as well. Setting GameMaker to used a fixed refresh rate in the Nvidia control panel does not fix the issue, G-Sync must be disabled globally to fix the issue.

Steps To Reproduce

Run GameMaker on a system with an Nvidia graphics card capable of G-Sync and a G-Sync compatible monitor (my monitor uses AMD Freesync, which Nvidia considers compatible with G-Sync). My monitor is an AOC AG241QG, and my graphics card is an Nvidia GeForce RTX 4060 TI. Ensure that G-Sync is on in the Nvidia control panel.

You should immediately see the flicker as text like "use processing" appears on the start screen, and continue to see flicker as you do normal activities like move the mouse around the screen. It's more apparent in a dim room or at night, but can be observed in a brightly sunlit room.

Turning G-Sync off will cause the flicker to stop, but will also disable G-Sync for all applications.

Which version of GameMaker are you reporting this issue for?

IDE v2024.6.0.157 Runtime v2024.6.0.205

Which operating system(s) are you seeing the problem on?

Windows 10.0.19045.0

dc40863f-370c-4e92-b034-96330b74df1f

YYDan commented 1 week ago

2024.6.1 will turn Vsync back ON by default, but will also add a new Preference for turning Vsync back on inside GM, which should hopefully prevent you from seeing these issues.

2024.8 will get an update to various frameworks/tools that GM uses for rendering and hopefully will then give a better result if someone does turn Vsync off (manually, via Preferences) in future.

RhyminGarfunkle commented 1 week ago

In 2024.6.1, on first opening the IDE the flicker issue went away, but each time I would change focus from the GM IDE to something else, or put focus back on the IDE, my entire monitor went dark for a couple seconds like I was changing the display settings. Turning off vsync in the general settings stopped this, but brought back the flicker.

When I tried to re-enable vsync in the IDE, the screen didn't go dark, but the flicker didn't go away either. It appears that the check box works to turn vsync off, but not back on. I've tried cycling the box and restarting the IDE several times, and have reverted all by GPU settings to defaults.

stuckie commented 1 week ago

That's interesting as all it's doing is saving a boolean out as #6533 shows, and reading it in on startup. You'll be able to find this file at %programdata%\GameMakerStudio2\dpi_override.json Assuming you don't have a dpi override setting, deleting that file will set it back to a clean slate.

RhyminGarfunkle commented 1 week ago

The json file matches the IDE setting of vsync enabled:

[{"Key":"vsync_enabled","Value":true},{"Key":"is_enabled","Value":true},{"Key":"value","Value":96}]

but I still see the flickering no matter what Again, I didn't see it when I initially opened 2024.6.1 (just the issue with the screen going dark every time focus changed) but now it won't go away no matter what the vsync setting is.

e: deleting dpi_override.json doesn't help.

RhyminGarfunkle commented 1 week ago

Disabling freesync from the Nvidia control panel still makes the flicker issue go away, regardless of the GM vsync setting.

JimiThing85 commented 1 week ago

The screen flickering thing also happens to me, running in Windows 11. I also get "stuttering" when G-Sync is enabled, huge temporary FPS drops for a second or two before it recovers, only to happen again a few seconds later. Additionally, I can't seem to turn off V-sync at all in the IDE since the last patch: the minute I close the preferences window, V-sync toggles back to displaying as enabled.

stuckie commented 1 week ago

You should get a message to restart the IDE when you toggle it and click Apply, as we have to set it on startup.

RhyminGarfunkle commented 1 week ago

I do get the message, and restart the IDE as it says is needed. The box checks or unchecks, and as I mentioned the settings in dpi_override.json reflect what I've selected, but changing the setting doesn't appear to actually enable or disable vsync (or if it does, then vsync has nothing to do with the flickering issue, which wouldn't make sense for multiple reasons)

I've tried restarting both from the popup message, and from ignoring the message and manually restarting.

stuckie commented 6 days ago

Ah, that was mean as a reply directly above... but yes, that's weird, as the preference is literally just turning on and off the line we changed for June. Having it set on should make the IDE behave like 2024.04/April again, where as off should make it behave as 2024.06.0... it's not doing anything else but changing how we present frames to the graphics card.

I am wondering if we have tripped over a driver issue, which is why forcing it in your NVidia control panel is the only thing that's making a difference. Frustrating...

RhyminGarfunkle commented 6 days ago

If it helps pin down driver issues, my GPU is an RTX 4060 TI, driver version 555.85. I can try another specific driver if you've got any machines at the YYG offices that have that video card, but no video issues.

JimiThing85 commented 6 days ago

You should get a message to restart the IDE when you toggle it and click Apply, as we have to set it on startup.

Yeah, I don't get the popup at all when toggling v-sync in preferences. Clicking apply doesn't trigger any popup for me. Running latest version of Gamemaker 2 IDE, v2024.6.1.160. If it helps, I've got a 3080 GPU, running on driver version 556.12