The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_SetWindowBordered causing renderer to freeze up?
Dark_Oppressor


Joined: 15 Aug 2013
Posts: 47
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?
Dark_Oppressor


Joined: 15 Aug 2013
Posts: 47
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.
Dark_Oppressor


Joined: 15 Aug 2013
Posts: 47
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?
Dark_Oppressor


Joined: 15 Aug 2013
Posts: 47
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.
Dark_Oppressor


Joined: 15 Aug 2013
Posts: 47
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.
SDL_SetWindowBordered causing renderer to freeze up?
Jonas Thiem
Guest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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!

On 10/18/2013 02:55 AM, Dark_Oppressor wrote:
Quote:
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.


_______________________________________________ SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iQIcBAEBAgAGBQJSYTKbAAoJECgTcNPC9Cd0CCYQAIvxA6kYcpl7XwhwzCpd/QbO
FynzzrD74FVoxwAdTzu4apTjEagtLzcTp1pBxSZp37sjo2Km/ctQb2e0nptGF2wY
7DrRAVfmM4dWzhu4j00kbR4RGZ8PEkNPAChSw0fWgwJDuv51jxFooyiI6wAdnz4a
gPCB0mV01Qb4FHRWnCrEKAe4X+a/68IRHO/9wTXYHFsMmroZ1Fm32Zuif2TXasA8
vaOyBjhLBomDG8iVuOvyBcLk6qrwQmgj2HkT6P2QRg7u7OGFOCk5faZ2xT72vP02
aOEH2YNheCbzpZp7HPtnmc1Le+O24Pa48qaevqaQVV2op8jVi64Slmr2NbgwS/bB
327nvtlC7o6mJDXrKnzshXqhrOSxnww4o+gQND0lp3OsUaRY/cbNn1oa6RlaO2R7
UlnODtNI74+KzxkEHfoqGFq2LsYKhr50W+eXw7orCsMy0pxr1LUmiYeDvALTySjy
BIvJNnEDXyT1vqw3z8VLx8TMQRwFOuhWUGWcqaUbShkTMpVTv8TxkT+UKGSerLVv
pfPgtHgyHbmInslxMA72sCvEa4BK0xwPX74AQL+dqOfcDnhRYau3AAL57G1/teWP
uYslMoSsQ+CbKsbn2vmSyaMUGkXdw2dW/j4DIV8Qg0TSd25ALzUU6ExYy+iqbnM6
Ilf6L1Yeh1+7MpGgUpuG
=kDkB
-----END PGP SIGNATURE-----
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: SDL_SetWindowBordered causing renderer to freeze up?
Dark_Oppressor


Joined: 15 Aug 2013
Posts: 47
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!

On 10/18/2013 02:55 AM, Dark_Oppressor wrote:
Quote:
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