From b946e31ec8358df21c11edbb57c5f6a2f3a5efdb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 23 Feb 2022 09:10:46 -0500 Subject: [PATCH] video: Allow unaccelerated SDL_HINT_FRAMEBUFFER_ACCELERATION renderers. If the app requested a specific renderer, even if it's not the optimal path, let them have it, because they might want to render with a specific GPU API on top of the framebuffer pixels. This fixes DosBox-X crashing on startup, which forces the hint to "opengl". --- src/video/SDL_video.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index b38c78920..9236a06f2 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -199,15 +199,11 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo break; } } - if (!renderer) { + if (!renderer || (SDL_GetRendererInfo(renderer, &info) == -1)) { + if (renderer) { SDL_DestroyRenderer(renderer); } return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available"); - } else if (SDL_GetRendererInfo(renderer, &info) == -1) { - SDL_DestroyRenderer(renderer); - return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available"); - } else if ((info.flags & SDL_RENDERER_ACCELERATED) == 0) { - SDL_DestroyRenderer(renderer); - return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not accelerated"); } + /* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */ } else { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { SDL_GetRenderDriverInfo(i, &info); @@ -227,9 +223,7 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo } } - /* Both of these checks should be handled above. */ - SDL_assert(renderer != NULL); - SDL_assert(info.flags & SDL_RENDERER_ACCELERATED); + SDL_assert(renderer != NULL); /* should have explicitly checked this above. */ /* Create the data after we successfully create the renderer (bug #1116) */ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));