(previously posted on reddit, no definitive answer found as of yet)
Hope you’re all doing well,
I’m working on a sort of Minecraft clone in OpenGL 3.3 (very original, I know) using an ECS design in C++ (SDL 2 for window, input, etc). Right now, I generate chunks on demand, store them in a cache, and evict those that are furthest away from the player when needed.
Running my code on Visual Studio 2019, I have noticed that as I move around in the world and my cache is filled up, the call to
SDL_GL_SwapWindow takes longer and longer, going from the v-sync default of ~16ms to a pretty terrible 50ms. However, and here’s the kicker, when I run my app on RenderDoc, I get none of this performance degradation, using either the debug or release builds! A full 60 FPS at any point (except when loading new chunks).
Does that ring a bell to anyone? I have tried looking online but can’t find anything conclusive. Disabling v-sync does no good; I have also tried sleeping for a bit before/after swapping the backbuffers, to no avail. My code is on GitHub, although I wouldn’t ask anyone to read through it at this point.