Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: "Window framebuffer support not available" error if software renderer is explicitly enforced in the SDL_HINT_RENDER_DRIVER #10155

Closed
olekolek1000 opened this issue Jul 1, 2024 · 7 comments
Milestone

Comments

@olekolek1000
Copy link
Contributor

olekolek1000 commented Jul 1, 2024

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)

@olekolek1000 olekolek1000 changed the title "Window framebuffer support not available" error if software renderer is explicitly enforced in the SDL_HINT_RENDER_DRIVER Regression: "Window framebuffer support not available" error if software renderer is explicitly enforced in the SDL_HINT_RENDER_DRIVER Jul 1, 2024
@slouken
Copy link
Collaborator

slouken commented Jul 3, 2024

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.

@slouken slouken added this to the 2.32.0 milestone Jul 3, 2024
@olekolek1000
Copy link
Contributor Author

It's Linux, tested again with the latest commit (9d47dae):

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.

@slouken
Copy link
Collaborator

slouken commented Jul 4, 2024

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?

@olekolek1000
Copy link
Contributor Author

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

image

Removing this piece of code (which was introduced in 5c8d92e ) mitigates this issue.

@olekolek1000
Copy link
Contributor Author

olekolek1000 commented Jul 5, 2024

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.

@slouken
Copy link
Collaborator

slouken commented Jul 5, 2024

Okay, I'm able to reproduce this on Wayland, thanks!

@slouken slouken closed this as completed in c7ed78a Jul 5, 2024
slouken added a commit that referenced this issue Jul 5, 2024
…SDL_HINT_RENDER_DRIVER is "software"

This case is properly handled inside SDL_CreateWindowTexture()

Fixes #10155

(cherry picked from commit c7ed78a)
(cherry picked from commit a4cbba1)
slouken added a commit that referenced this issue Jul 5, 2024
…SDL_HINT_RENDER_DRIVER is "software"

This case is properly handled inside SDL_CreateWindowTexture()

Fixes #10155

(cherry picked from commit c7ed78a)
@slouken
Copy link
Collaborator

slouken commented Jul 5, 2024

Fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants