v4.2.2.stable.official [15073afe3] CPU i5-7200U, GPU 930MX, 8GB ram
Question
I’ve been investigating a significant performance drop related to the window size in my game and am looking for potential solutions or optimizations.
When the game window is maximized, there’s a large drop in performance, which seems excessive. This occurs even with the stretch mode set to black bars, where I would expect a much smaller performance hit. Specifically, the frame rate drops from around ~500 fps in a smaller window to ~200 fps in a maximized window. I understand that increasing the window size should naturally reduce performance, but this drop seems too large for a scenario with black bars, where much of the screen isn’t being rendered.
I’ve read the documentation on resolution and scaling multiple times, but haven’t found a clear solution for mitigating this. I am considering implementing AMD FSR 2.2, but I suspect there might be a simpler, more direct way to address this issue, as the performance drop feels disproportionate.
Any ideas or suggestions on what might be causing such a big performance drop, even with black bars, would be really helpful and thanks in advance.
Additionally, I know 200 fps is still high, but I’ll be adding more entities, systems, raycasts, etc., which will likely bring performance down even more. Ideally, I want the game to run smoothly even on mobile and on the potato PCs
This happens because you are being fill rate-limited, since both your integrated GPU and dedicated GPU are slow by today’s standards (particularly their memory bandwidth).
This performance scaling is only noticeable to such an extent in simple 2D projects, as fillrate is often their bottleneck.
Using the viewport stretch mode might perform a bit better, but not much can be done about this. Even the viewport stretch mode won’t perform as well as using a non-native fullscreen resolution in the OS:
Using FSR won’t help here for two reasons:
It only affects 3D rendering, not 2D.
On very slow GPUs, using FSR to upscale from a lower resolution can be slower than rendering at a higher resolution with bilinear scaling, negating the advantages of FSR.
Thank you for the insight and the documentation link! I’ve already set my project’s stretch mode to viewport, so I looked into some other factors.
I tested the Sponza demo project from the link you provided and noticed some interesting results. In the Sponza demo, there’s no FPS drop when resizing the window with black bars. However, in my own project, I still see a noticeable FPS decrease.
Sponza Screenshots
Godot: v3.5.3.stable.mono.official [6c814135b] Stretch Mode: 2d, Stretch Aspect: keep (This ensures black bars are rendered instead of changing the camera’s width/height)
I suspect some of this is relative. A 500 - 350 drop in FPS feels consequential, however that’s only an increase of ~0.85ms per frame.
If you apply the same increase in frame time at a base of 50 FPS (going from 20ms to 20.85ms per frame), your losing ~2fps.
It’s still not zero, but the higher your current frame rate, the higher impact on FPS any performance hit is going to have on it. It curves off as your FPS decreases. So like a ~40%+ performance hit at 500 FPS is going to be more like a ~1.5% performance hit at 60FPS.
I ran a more thorough test using the project mentioned in the documentation shared by @Calinou, since it had a very stable FPS compared to mine. Also to make the difference more noticeable, I set the resolution lower and disabled any fps limiting.
Interestingly, on the demo project, I saw almost the same FPS when the window was stretched (I actually gained ~2 FPS when stretching the window).
With these results, I’m not sure what steps to take from here. Any suggestions on what I should try next?
EDIT:
I ran a more extreme test by disabling assets to increase the fps to see if a similar performance drop would occur. The drop did happen, but it wasn’t as drastic as in my own project.
My project had a drop of 500 to 350FPS (~2ms to ~2.86ms frametime, ~43% increase) when compared to Sponza had a drop of 300 to 250 FPS (~3.33ms to ~4ms frametime, ~20% increase).
There is a ~0.86ms frametime increase in my project compared to ~0.67ms frametime increase in Sponza. Which is ~28% more.
This makes me think that, either godot version 4 is causing this or I’m missing an important factor to make larger window size more performant. Any advices are welcome.
(The fps is visible in the top right corner of the game window.)