From 55e204d00a958581d1a5b62e67dfac9c6aa08f68 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Tue, 2 Jul 2024 19:33:26 +0300
Subject: [PATCH 17/17] sdl3: Stop using renderer selection flags

They have been removed from sdl3.

See RM #747

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-sdl3/graphics.c | 11 +----------
 client/gui-sdl3/gui_main.c |  4 ----
 client/gui-sdl3/gui_main.h |  1 -
 client/options.c           |  5 -----
 client/options.h           |  1 -
 5 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/client/gui-sdl3/graphics.c b/client/gui-sdl3/graphics.c
index 13bd2955a6..950c381036 100644
--- a/client/gui-sdl3/graphics.c
+++ b/client/gui-sdl3/graphics.c
@@ -544,8 +544,6 @@ static void free_surfaces(void)
 **************************************************************************/
 bool create_surfaces(int width, int height)
 {
-  unsigned flags;
-
   free_surfaces();
 
   main_surface = SDL_CreateSurface(width, height, SDL_PIXELFORMAT_RGBA8888);
@@ -556,14 +554,7 @@ bool create_surfaces(int width, int height)
     return FALSE;
   }
 
-  if (GUI_SDL_OPTION(swrenderer)
-      || (sdl3_client_flags & CF_SWRENDERER)) {
-    flags = SDL_RENDERER_SOFTWARE;
-  } else {
-    flags = SDL_RENDERER_ACCELERATED;
-  }
-
-  main_data.renderer = SDL_CreateRenderer(main_data.screen, NULL, flags);
+  main_data.renderer = SDL_CreateRenderer(main_data.screen, NULL, 0);
 
   if (main_data.renderer == NULL) {
     log_fatal(_("Failed to create renderer: %s"), SDL_GetError());
diff --git a/client/gui-sdl3/gui_main.c b/client/gui-sdl3/gui_main.c
index f21aa5b158..ac4d353d55 100644
--- a/client/gui-sdl3/gui_main.c
+++ b/client/gui-sdl3/gui_main.c
@@ -178,7 +178,6 @@ static void print_usage(void)
              _("  -f,  --fullscreen\tStart Client in Fullscreen mode\n"));
   fc_fprintf(stderr,
              _("  -F,  --Font SIZE\tUse SIZE as the base font size\n"));
-  fc_fprintf(stderr, _("  -s,  --swrenderer\tUse SW renderer\n"));
   fc_fprintf(stderr, _("  -t,  --theme THEME\tUse GUI theme THEME\n"));
 
   /* TRANS: No full stop after the URL, could cause confusion. */
@@ -200,8 +199,6 @@ static bool parse_options(int argc, char **argv)
       return FALSE;
     } else if (is_option("--fullscreen", argv[i])) {
       GUI_SDL_OPTION(fullscreen) = TRUE;
-    } else if (is_option("--swrenderer", argv[i])) {
-      sdl3_client_flags |= CF_SWRENDERER;
     } else if ((option = get_option_malloc("--Font", argv, &i, argc, FALSE))) {
       if (!str_to_uint(option, &font_size_parameter)) {
         fc_fprintf(stderr, _("Invalid font size %s"), option);
@@ -1019,7 +1016,6 @@ static void migrate_options_from_sdl2(void)
   /* Default theme name is never migrated */
   MIGRATE_OPTION(fullscreen);
   MIGRATE_OPTION(screen);
-  MIGRATE_OPTION(swrenderer);
   MIGRATE_OPTION(do_cursor_animation);
   MIGRATE_OPTION(use_color_cursors);
   MIGRATE_STR_OPTION(font_city_names);
diff --git a/client/gui-sdl3/gui_main.h b/client/gui-sdl3/gui_main.h
index 718edb7f52..0bbac682c7 100644
--- a/client/gui-sdl3/gui_main.h
+++ b/client/gui-sdl3/gui_main.h
@@ -57,7 +57,6 @@ struct theme;
 #define CF_DRAW_PLAYERS_PEACE_STATUS	(1<<21)
 #define CF_DRAW_PLAYERS_ALLIANCE_STATUS	(1<<22)
 #define CF_DRAW_PLAYERS_NEUTRAL_STATUS	(1<<23)
-#define CF_SWRENDERER                   (1<<24)
 
 /* Mouse button behavior */
 #define MB_MEDIUM_HOLD_DELAY  500         /* Medium hold:  500ms */
diff --git a/client/options.c b/client/options.c
index 3d0309a1ec..74a3bb6217 100644
--- a/client/options.c
+++ b/client/options.c
@@ -403,7 +403,6 @@ struct client_options gui_options = {
   .gui_sdl3_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
   .gui_sdl3_fullscreen = FALSE,
   .gui_sdl3_screen = VIDEO_MODE(640, 480),
-  .gui_sdl3_swrenderer = FALSE,
   .gui_sdl3_do_cursor_animation = TRUE,
   .gui_sdl3_use_color_cursors = TRUE,
   .gui_sdl3_font_city_names = "10",
@@ -3455,10 +3454,6 @@ static struct client_option client_options[] = {
                    N_("This option controls the resolution of the "
                       "selected screen."),
                    COC_INTERFACE, GUI_SDL3, 640, 480, NULL),
-  GEN_BOOL_OPTION(gui_sdl3_swrenderer, N_("Use software rendering"),
-                  N_("Usually hardware rendering is used when possible. "
-                     "With this option set, software rendering is always used."),
-                  COC_GRAPHICS, GUI_SDL3, FALSE, NULL),
   GEN_BOOL_OPTION(gui_sdl3_do_cursor_animation, N_("Do cursor animation"),
                   N_("If this option is disabled, the cursor will "
                      "always be displayed as static."),
diff --git a/client/options.h b/client/options.h
index 18c6db9bcc..ff591ab348 100644
--- a/client/options.h
+++ b/client/options.h
@@ -430,7 +430,6 @@ struct client_options
   char gui_sdl3_default_theme_name[512];
   bool gui_sdl3_fullscreen;
   struct video_mode gui_sdl3_screen;
-  bool gui_sdl3_swrenderer;
   bool gui_sdl3_do_cursor_animation;
   bool gui_sdl3_use_color_cursors;
   char gui_sdl3_font_city_names[64];
-- 
2.43.0

