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".
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index b38c789..9236a06 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) {
- return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available");
- } else if (SDL_GetRendererInfo(renderer, &info) == -1) {
- SDL_DestroyRenderer(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 ((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));