Regression: "Window framebuffer support not available" error if software renderer is explicitly enforced in the SDL_HINT_RENDER_DRIVER
How to reproduce:
Method 1:
testdrawchessboard.c:
int main() {
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
(...)
or just running via
SDL_RENDER_DRIVER=software ./test/testdrawchessboard
(Parameter 'window' is invalid)
What platform are you seeing this on? Are you testing with the latest code? I tested on Windows both with and without forcing the rendering path, and in each case the software renderer wasn't used and the window surface was successfully created.
It's Linux, tested again with the latest commit (https://github.com/libsdl-org/SDL/commit/9d47daef0a674b06f97be383f67b6e7bf406f41b):
SDL_RENDER_DRIVER=software ./test/testdrawchessboard
ERROR: Render creation for surface fail : Parameter 'window' is invalid
SDL_RENDER_DRIVER=opengl and others work just fine.
I just tested and that same setup works fine here.
That error message means that SDL_CreateSoftwareRenderer() failed, which doesn't make any sense because the hint shouldn't affect that, and there is never any window in that code path. Can you debug that function to see what's happening?
Differences between the environment flag and without it:
In testdrawchessboard.c:133, SDL_GetWindowSurface(window) returns null instead of SDL_Surface
In SDL_video.c:3371, SDL_CreateWindowFramebuffer returns null instead of SDL_Surface
In SDL_video.c:3311, ShouldAttemptTextureFramebuffer is false, thus created_framebuffer is never set, returning null
Removing this piece of code (which was introduced in https://github.com/libsdl-org/SDL/commit/5c8d92e4d08cb47feb0e5a911c43263d69325bdb ) mitigates this issue.
SDL_CreateSoftwareRenderer fails here:
SDL_render.c, SDL_CreateRendererWithProperties:
if ((!window && !surface) || (window && surface)) {
SDL_InvalidParamError("window");
goto error;
}
Parameter window is null here, because SDL_GetProperty(props, SDL_PROP_RENDERER_CREATE_WINDOW_POINTER, NULL) returns a null pointer here.
surface is null here because SDL_GetWindowSurface() returns null before calling this function, and SDL_SetProperty is set with a null surface.
Okay, I'm able to reproduce this on Wayland, thanks!
Fixed, thanks!