SDL_SetWindowBordered causing renderer to freeze up?

When I toggle between ‘SDL_SetWindowBordered(screen,SDL_TRUE);’ and ‘SDL_SetWindowBordered(screen,SDL_FALSE);’ sometimes (but not always) the renderer seems to stop working. The rest of my program works fine, but the renderer seems to stop updating the screen. The screen is then forever frozen at the same place.

Also, SDL_RenderCopyEx, SDL_RenderFillRect, etc. all cause a huge performance hit once this happens. I’m updating the window’s titlebar with FPS and such so I can see its performance, and it drops from ~100 to ~3 when this happens. If I toggle off rendering the FPS shoots back up. I leave SDL_RenderClear on each frame so I can tell if the screen is updating when I turn off other rendering, but it is not.

What on earth is going on here?

I just tried disabling SDL_RenderPresent, and while this obviously prevents me from seeing the screen freeze (since nothing is ever rendered to begin with), it has shown that it is not involved in the performance hit when the renderer goes wonky. Everything performance related worked identically without ever calling SDL_RenderPresent. The program started out fine. I toggled the window border a few times. The FPS dropped to ~3. I disabled rendering (so no more SDL_RenderCopyEx calls etc.) and the FPS shot back up.

OK, instead of changing the window border this time I tried SDL_SetWindowSize(screen,1280,720);

Just running that line once seems to reliably cause the same problem. Note that the dimensions are the same as the starting window size, so nothing should actually be changing, should it?

OK, I’ve done a bunch more tests and it seems the border toggling IS actually reliable. On each program run, the problem occurs the second time the window is made borderless, ignoring whether the SDL_WINDOW_BORDERLESS flag is set when creating the window.

So if I create a window with SDL_WINDOW_BORDERLESS, it takes 4 calls to SDL_SetWindowBordered, toggling the value each time, to cause the problem. If I create a window without SDL_WINDOW_BORDERLESS, it takes 3 calls to SDL_SetWindowBordered, toggling the value each time, to cause the problem.

Just to be thorough I tried just calling ‘SDL_SetWindowBordered(screen,SDL_FALSE)’ without any ‘SDL_SetWindowBordered(screen,SDL_TRUE)’ in between, and nothing goes wrong there.

Someone in IRC suggested I give you my OS info. I’m currently doing all of this testing in Windows 7 Professional 64-bit. If you need any other info please let me know. My engine compiles for Linux and OS X as well, so I will try to get some tests run in those later.

I just thought to try ‘SDL_SetHint(SDL_HINT_RENDER_DRIVER,“opengl”)’ as SDL was defaulting to direct3d. That fixed the problem! So that narrows it down a bit more if someone wants to try to figure out what’s going on here.

Jonas Thiem wrote:

Hi,

Just to ask the obvious, did you file a bug report about this at
http://bugzilla.libsdl.org? If not, would be really helpful if you
could do that!

I just thought to try
’SDL_SetHint(SDL_HINT_RENDER_DRIVER,“opengl”)’ as SDL was
defaulting to direct3d. That fixed the problem! So that narrows it
down a bit more if someone wants to try to figure out what’s going
on here.

I had not, but I just made an account over there and reported both this and another (apparently related) issue I’ve been having. Both of them were solved by switching to the opengl render driver.
You can see them here:
https://bugzilla.libsdl.org/show_bug.cgi?id=2160
https://bugzilla.libsdl.org/show_bug.cgi?id=2162> On 10/18/2013 02:55 AM, Dark_Oppressor wrote: