I couldn’t find anything related to this and the closest post was this:
From the wiki: https://wiki.libsdl.org/SDL_GetWindowSurface
You may not combine this with 3D or the rendering API on this window.
But it seems to work with X11 and also with a software renderer on wayland,
kmsdrm and X11.
Tested on the git version. Using sway for wayland and X11 (XWayland), dwm for
X11 and linux 5.18.10 for kmsdrm. And if it matters I’m using intel integrated
graphics.
$ sdl2-config --version
2.23.1
Here’s a simple example that causes this problem.
#include <assert.h>
#include "SDL.h"
int
main(void)
{
int err = SDL_Init(SDL_INIT_VIDEO);
assert(err >= 0);
SDL_Window *w = SDL_CreateWindow("bug?", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
assert(w != NULL);
SDL_Renderer *r = SDL_CreateRenderer(w, -1, 0
/* | SDL_RENDERER_SOFTWARE */
);
assert(r != NULL);
SDL_Surface *s = SDL_GetWindowSurface(w);
if (s == NULL) {
SDL_Log("%s\n", SDL_GetError());
}
SDL_DestroyRenderer(r);
SDL_DestroyWindow(w);
SDL_Quit();
return 0;
}
On wayland and kmsdrm it outputs: INFO: No hardware accelerated renderers available
and on X11 it works without errors.
When SDL_RENDERER_SOFTWARE is uncommented it seems to work fine.