Skip to content

Commit

Permalink
Try a software rendering fallback in SDL2
Browse files Browse the repository at this point in the history
On platforms that don't support hardware accelerated rendering, such as
SerenityOS, try out the software renderer before giving up.
  • Loading branch information
vkoskiv committed Nov 1, 2023
1 parent ba62952 commit ad77d63
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ struct sdl_window *win_try_init(struct sdl_prefs *prefs, int width, int height)
}
//Init renderer
w->renderer = w->sym->SDL_CreateRenderer(w->window, -1, SDL_RENDERER_ACCELERATED);
if (w->renderer == NULL) {
if (!w->renderer) w->renderer = w->sym->SDL_CreateRenderer(w->window, -1, SDL_RENDERER_SOFTWARE);
if (!w->renderer) {
logr(warning, "Renderer couldn't be created, error: \"%s\"\n", w->sym->SDL_GetError());
win_destroy(w);
return NULL;
Expand Down

0 comments on commit ad77d63

Please sign in to comment.