godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.81k stars 21.13k forks source link

Godot editor and game windows stutter and flicker black randomly #82768

Open valkyrienyanko opened 1 year ago

valkyrienyanko commented 1 year ago

Godot version

v4.1.1.stable.mono.official [bd6af8e0e]

System information

Windows 11 GPU - RX 6600 CPU - 10400f - 16 GB RAM, Forward+ Renderer

Issue description

The game will very annoyingly stutter and flicker black... This is happening in Godot v4.1.1-stable and Godot 4.2 dev 5.

I have been using Godot extensively for the past 2 years. This just started happening about 1 week ago at the time of writing this (2023 October 4th).

This issue does not happen in any of my Steam games. Only happens in Godot.

This happens at random. Although I have recently come to see a pattern. Running into this issue is very unlikely if I start up my PC and use Godot for the first 1 - 2 hours. However I start to see this issue appear much more frequently after 2 hours, it just keeps getting worse and worse as the time goes on and I find that I need to restart my PC to temporarily solve this.

Note that only the game window flickers and stutters. In other words the flickering and stuttering are contained within the game window and not the Godot editor.

Restarting Godot does not help. Restarting PC seems to help. Although this could just be the placebo effect.

Nothing suspicious appears in verbose logs or Godot monitors when the flickering happens.

I am using a 60 Hz monitor. No G-Sync or anything fancy like that. I am using a HDMI cable.

https://github.com/godotengine/godot/assets/6277739/9e60cb2a-f559-413c-9527-f5ba615f1f4d

https://github.com/godotengine/godot/assets/6277739/c747e948-5431-42af-8748-1d890c8f8f6c

I have tried searching for all 400+ issues with the keyword "flicker" but no issue looked related to mine.

Update: I'm consistently getting this issue on v4.2.1.stable.mono.official [b09f793f5]

Steps to reproduce

  1. Create new blank Godot project with Forward+ renderer selected
  2. Set root node to a Node2D
  3. Set the main scene to this Node2D
  4. Run the scene and if you're lucky you will see the black flickers and stuttering (I saw them on first time running the scene but then after that I couldn't reproduce the issue as the issue randomly comes and goes...)

Sometimes I get the flickering on the first try. Sometimes restarting the game 30+ times will give no flickers.

Minimal reproduction project

FlickerTest.zip (this is a blank project with steps to reproduce described above applied in here)

I tried recording the minimal reproduction project flickers with OBS but they did not show up in the video. At least they show up on the video currently attached to this issue.

Calinou commented 1 year ago

Can you reproduce this without the desktop overlay in the bottom-right corner (I assume it's a third-party program and not added during editing)?

valkyrienyanko commented 1 year ago

All of that is from OBS (Open Broadcast Software), what I use to record. Yes, this happens without OBS running.

valkyrienyanko commented 1 year ago

Update: Sometimes happens in the actual editor too now. The whole editor will sometimes flicker black and the jittery movements can be seen when dragging the view around a scene in a circular fashion. I wasn't able to record the flickers or jitters because I was in game capture mode capturing the Godot editor window, however I'm sure the flickers and jitters would have appeared if I was recording my entire desktop display. I was going to do that next but then the flickers / jitters went away.

valkyrienyanko commented 1 year ago

I have managed to capture the jitters and one black flicker inside the Godot editor window. I have added the video to the issue description above. The black flicker can be noticed around 0:26 to 0:28.

limbunny commented 1 year ago

Got the same problem in 4.2-beta1 (had to film the flickering with the phone, since on screen capture it only barely was captured.

If i export the game and run the executable, the issue is not present. Porting back the project to 4.1.2 also seems to fix the issue (just did a quick test and it seemed fine)

https://github.com/godotengine/godot/assets/44810197/d4e57a15-ac43-4db0-8318-253cfee23b5c

I am also running a AMD Graphicscard (RX 6700XT)

Calinou commented 1 year ago

Can you test whether https://github.com/godotengine/godot/pull/80566 resolves this?

valkyrienyanko commented 1 year ago

@Calinou I built Godot from source from the PR #80566 you linked and built my game and tested it and I still get stuttering.

I had some issues initially getting the project to build and had to change <Project Sdk="Godot.NET.Sdk/4.2.0-dev"> to <Project Sdk="Godot.NET.Sdk/4.2.0-dev.1"> in my .csproj because I was getting a Godot.NET.Sdk cannot be found error.

Just fyi the editor version says v4.2.dev.mono.custom_build [e4a4a40c8] which should match up with the PR version although I have no idea how to check this.

Most of the time there is stuttering (most noticeable when all the credits text is on the screen) and very rarely there is no stuttering. I was able to capture the stuttering on first launch attempt.

https://github.com/godotengine/godot/assets/6277739/cffb6fef-482c-46ce-bacf-8cc18dafc5fb

Update: Whenever I restart the Godot editor, the .csproj first line reverts back to <Project Sdk="Godot.NET.Sdk/4.2.0-dev"> and I get the Godot.NET.Sdk cannot be found error. So I just change it back to <Project Sdk="Godot.NET.Sdk/4.2.0-dev.1"> every time...

Update: Sometimes I get this warning in console. No idea if it is related to this issue.

W 0:00:00:0191   RenderingDeviceVulkan::_load_pipeline_cache: Invalid pipelines cache header.
  <C++ Source>   drivers\vulkan\rendering_device_vulkan.cpp:9229 @ RenderingDeviceVulkan::_load_pipeline_cache()

Update: Issue seems to have gone away completely if buffer count is 2 and swapchain count is 2 and running in exclusive fullscreen mode. Edit: Seems to be working also for borderless and windowed mode too. Edit: Issue came back in non-exclusive fullscreen modes. Have not come across an issue in exclusive fullscreen mode. Tested with buffer and swapchain count both set to 1.

Update: Issue seems to happen more often when I resize the window a lot.

Saltlight-Studio commented 11 months ago

Wanted to join this discussion to say that since upgrading to 4.2 I have started experiencing this when using Godot on one of my monitors

The flickering since the upgrade is happening on my Acer XF270HU Monitor

It however does not happen on my Acer Nitro XV275U Monitor

The flicker seems to occur mostly randomly immediately after an input that selects a scene, window, folder or similar (Randomly cause it does not always happen)

Edit: To clarify it is only the Godot window itself that flickers, nothing else on the screen does.

JynoX commented 10 months ago

I'm having a similar issue:
I've been trying different version of Godot, 4.1.2 - 4.2.1 - 4.0 but I'm facing the same flickering problem on all of them, defining it flickering problem wouldn't be correct, the window goes unresponsive for some microseconds and then comes back to life, causing is to flicker. Some times this would be random, but on every mouse click this is bound to happend.

Sorry for the poor registration.

https://github.com/godotengine/godot/assets/40642679/4a3a73d1-ce00-4875-a4eb-893cc81d13f5

Does anyone know how to fix this? I'm really enjoying Godot but it's really unusable like this..

Calinou commented 9 months ago

@JynoX This appears to be a different issue: focus is continuously being released and given to the Godot editor window, which causes Windows' "unfocused" title bar color to appear for a split second. In fact, you can even notice the "(Not Responding)" text if you step through the video on a frame-by-frame basis.[^1]

[^1]: It may be worth enabling Update Continuously in the editor settings to see if this goes away.

You may have a third-party program installed that interferes with window focus, such as Stardock Fences or Kakaotalk. I'd recommend going through the list of installed programs on your system and remove anything that looks suspicious.

As a mitigation, you can change your Windows' theme settings so that the unfocused window title color is as close as possible to the focused window title color. You can switch to dark mode, or keep light mode and change the theme settings so that window titles aren't influenced by your chosen accent color (this will make the title always white).

You can also run the editor in fullscreen by pressing Shift + F11, which will hide the window title.

frostbytedata commented 9 months ago

Seeing this as well with Godot 4.2.1. I am also using multi monitor. Two of my monitors run at 75hz and one at 144hz. I notice this also only happens to me on my 144hz monitor. Update Continuously does seem to fix it although that comes with it's own weird visual glitches it seems. Happy to provide additional info. I have disabled Geforce replay recording as well as the Xbox game bar.

I know this probably doesn't help narrow down much, but I just tried Godot v3.6 and don't have this issue even with the same hardware/setup.

HybridEidolon commented 9 months ago

@frostbytedata, if you can build #87340 from source, that branch may fix this issues by virtue of cleaning up swapchain usage.

frostbytedata commented 9 months ago

@frostbytedata, if you can build #87340 from source, that branch may fix this issues by virtue of cleaning up swapchain usage.

Ok I will give that a shot and report back.

Dharhix commented 8 months ago

Had a similar issue.

Unplugging the second monitor seemed to have fixed the issue.

RichardMarks commented 2 months ago

I am experiencing the flickering in v4.3.stable.official [77dcf97d8] in the "Running Scene" window, not the editor itself.

Forward+ renderer

Tested with empty project, tested with 2D scene, tested with 3D scene, same results.

Windows 11 NVIDIA GeForce RTX 3070

Two connected monitors.

Acer G246HL Connected via DisplayPort ASUS VS247 Connected via HDMI

This should be a high-priority issue.

blakeage commented 1 month ago

I also experience this on my Macbook M2 Pro (2023). It happens more frequently sometimes, but then doesn't do it for a while. I have an older primary (6-7 years) ASUS Monitor (60Hz). The Mac is connected HDMI out to DVI into the monitor. I'm running the latest Dev release of Godot (4.4.dev2.mono). Mac OS: Sonoma 14.6.1

At times I can cause it to happen by expanding the editor to be as big as the monitor is capable, and then shifting the window slightly so that it's not perfectly at the top left of the screen. Then, by placing the mouse at the edge of the window (so that the resize handles show up) if I move the mouse back and forth between my desktop in the background and the window, I'll get black flickering. This is the only thing I've been able to reproduce reliably. I'm not 100%, but I don't think it happens on the Mac Retina display.

I was able to reproduce it, but I was trying to get a better video capture, and now I can't get it to happen. Also, possibly related, I've noticed that the preview images that display when you mouse over the scene tabs, often are solid black for some reason instead of rendering the corresponding scene preview image. I don't know if that's related, but now that I can't reproduce the black flashing, those images are rendering correctly.