[Scummvm-tracker] [ScummVM :: Bugs] #14530: BACKENDS: SDL2: Regression with software mode
ScummVM :: Bugs
trac at scummvm.org
Thu Jul 6 17:20:41 UTC 2023
#14530: BACKENDS: SDL2: Regression with software mode
-------------------------------------------------+-------------------------
Reporter: raziel- | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: GUI
Version: | Resolution:
Keywords: window/fullscreen switch, launcher, | Game:
SDL2 , regression |
-------------------------------------------------+-------------------------
Comment (by PushmePullyu):
I think the problem is that with software rendering SDL_CreateRenderer()
creates a surface for the window, but SDL_DestroyRenderer() will not
destroy this surface.
The check introduced in commit https://github.com/libsdl-
org/SDL/commit/36033e3832633506a01c9da3d08a0c0844761965 will then prevent
creating a new renderer for this window.
One could manually destroy the surface with the new
DestroyWindowSurface(), but since it was created by SDL itself, this
should probably be done by SDL_DestroyRenderer(). This would then be a SDL
bug.
Take all this with a grain of salt though, as I am not very familiar with
SDL.
Here is some code to test (it should fail to recreate the renderer with
SDL 2.28.0 and software rendering):
{{{
#include <stdio.h>
#define SDL_MAIN_HANDLED
#include "SDL.h"
// gcc -o sdl_repro sdl_repro.c $(sdl2-config --cflags) $(sdl2-config
--libs)
// = gcc -o sdl_repro sdl_repro.c -I/usr/include/SDL2 -D_REENTRANT -lSDL2
// SDL_RENDER_DRIVER="software" ./sdl_repro
void fail() {
printf("error: %s\n", SDL_GetError());
exit(1);
}
int main() {
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
// Create window
window = SDL_CreateWindow("myWindow", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 320, 240, 0);
if (!window)
fail();
// Create renderer
printf("Creating renderer\n");
renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer)
fail();
// Destroy renderer
printf("Destroying renderer\n");
SDL_DestroyRenderer(renderer);
if (SDL_GetRenderer(window))
fail();
// Recreate renderer
printf("Recreating renderer\n");
renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer)
fail();
printf("Quitting\n");
SDL_Quit();
return 0;
}
}}}
--
Ticket URL: <https://bugs.scummvm.org/ticket/14530#comment:4>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list