Problem with SDL2: SDL_RenderClear (Windows) |
fejoa
|
Thought I'd move this post here from the games since more people post here and it is a technical question.
After the full screen is toggled in the configuration menu, the graphics are blitted to the screen and the following functions are invoked:
When it gets to SDL_RenderClear the application crashes. Could it be related to this: https://forums.libsdl.org/viewtopic.php?t=11885? Original post from "Game Development":
|
|||||||||||||||||
|
ChliHug
|
|
|||||||||||
|
fejoa
|
Thanks for posting this lead ChliHug :) Further ways to produce crashes: Not only was there a crash when full screen was toggled, but the crash also happened if the system went to sleep, or if the task manager was called up via ctrl-alt-delete during normal program operation. I changed the SDL_RENDER_DRIVER environment variable to "opengl", on both a Windows 7 system and a Windows 8.1 system. The bug went away, so it seems like there is a problem with the render driver and loss of context in SDL2 with Direct3D... My next question is, where can I find a bleeding-edge release of SDL2 that fixes this bug, that I can deploy with the game so that eager fans no longer have to put up with this? I can't find any trace of the proposed patch https://bugzilla.libsdl.org/attachment.cgi?id=2364&action=diff in the SDL2 mercurial... What's the current status? Or is there another way around this that I should be aware of? |
|||||||||||||
|
fejoa
|
I remember reading Ant's post using SDL_PIXELFORMAT_RGB888 and it seemed like a similar problem: https://forums.libsdl.org/viewtopic.php?t=11885&highlight=SDL_PIXELFORMAT_RGB888 We're using SDL_PIXELFORMAT_RGB565 to create our texture. It might just be one of these unsupported pixel formats. I'd rather not change this because of the way the application's material subsystem links to change the material colours of items in the game. How can I tell if a pixel format is supported or not? |
|||||||||||||
|
rtrussell
|
As I said, one way is to call SDL_GetRendererInfo and iterate through the returned texture_formats comparing them with your preferred option(s). A more drastic solution might be to switch to using the OpenGL renderer, but of course that won't help if you are targeting WinRT/UWP:
|
|||||||||||||||
|
fejoa
|
That is indeed quite drastic, but a solution I'm willing to try for the time being. The game is a graphical roguelike, played on PC with a keyboard preferrably sporting a keypad, and it's not coming to a Windows phone any time soon. I'm picking that OpenGL is widespread enough for this fix to work. Does anyone know if SDL dev knows about this problem and will it be fixed in the next release? Is it best to post on bugzilla? |
|||||||||||||||||
|
rtrussell
|
OpenGL is universally available on 'desktop' Windows AFAIK, but whether it will work in a trouble-free fashion for you depends on your app playing by all the rules. I developed my first SDL app on Windows/D3D and that was a mistake as it turned out because porting it to other platforms (which use OpenGL for rendering) showed up incompatibilities with the way I was doing things. Now I use OpenGL even on Windows (like you I'm not interested in WinRT/UWP). |
|||||||||||||
|
fejoa
|
Cool, thanks for answering my questions and helping me understand rt. |
|||||||||||||||
|