Hello SFML community!
My first post will be a good read for you, enjoy the madness
I am using SFML-2.4.2 64-bit (the static library, I'm not building it) with C++11 on Windows 10 64bit with Visual Studio 2017 with a Zotac 980Ti with the latest 384.76 drivers.
My problem is very simple:
When I close the application or it crashes the SFML allocated textures sometimes don't get removed from the GPUI didn't believe it in the beginning but this is what happened:
In the beginning I miscalculated how much GPU VRAM I used and ended up using more than my VRAM (6GB) so the GPU started using the RAM as swap and obviously I had low FPS.
Nothing strange here, but the weirdness started when suddenly I got 1 FPS without any reason, I started to check my code for errors but didn't found anything, then I decided to run an empty project with only a window and a glClear and I still got 1FPS.
I restarted my computer and the empty project got 60 FPS again;So I waited until this strange bug reappeared, it did, and the first thing I did was to restart manually the GPU driver on Windows (Disable and Enable on Device Manager), still 1 FPS, then I decided to reinstall the driver, still 1 FPS, the only solution to fix it is to completely reboot the system.
Another funny thing:
WebGL on my browser crashed after a while, probably because VRAM almost got depleted?
I'm truly shocked, this is probably an obscure deep OpenGL, Windows, NVIDIA or even Hardware bug.
The only possible reason this could be related to SFML is that it creates some textures shared between contexts and then Windows for whatever reason loses the second context handler.
I don't even know how to debug, an empty SFML window gets 1 FPS after some hours of starting & closing my project multiple times and allocating a lot of textures.
Technically it shouldn't be my fault, I am simply creating textures on only one thread, and Windows should delete all the OpenGL contexts by default.
EDIT: It happens about once a day after starting and closing the application about 10-20 times
EDIT 2: another hypothesis a person suggested is that it could be Visual Studio 2017's fault for not clearing the OpenGL context
EDIT 3: it happens if I don't surpass the 6GB VRAM limit too, even when my application uses about 2GB of VRAM and I start and close it multiple times in the long run the VRAM will get depleted.
EDIT 4: If I start a game after the bug appears the game will get 1 FPS too.
EDIT 5: After the bug appears any application that uses the GPU gets 1 FPS.
I can't even use a drawing application like Paint.NET
What do you think?
What I think is:
only my application generates this bug, but every other AAA game works flawlessly on my system, so the only possible reason is that it generates a unique combination and triggers an obscure bug somewhere deep in the stack (SFML->OpenGL->GPU Drivers->Windows NT Kernel->GPU Firmware) so difficult to debug it's basically impossible to find.
If I rewrite my application from scratch it will probably disappear because I will avoid the obscure combination that triggers it.