From ec7fc466520a2d2ef403d5baf94c7907680fdf08 Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Thu, 12 Oct 2023 17:22:14 +1100 Subject: [PATCH] Use Direct 3D 11 if `vid_scaleapi` CVAR is `direct3d` (While reverting previous changes to `vid_scaleapi` CVAR.) This change gives a significant jump in FPS. --- src/c_autocomplete.c | 12 ------------ src/c_cmds.c | 3 +-- src/i_video.c | 14 ++++++-------- src/m_config.h | 2 -- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/c_autocomplete.c b/src/c_autocomplete.c index 58aa94e0ac..0dabcc7546 100644 --- a/src/c_autocomplete.c +++ b/src/c_autocomplete.c @@ -6078,20 +6078,12 @@ autocomplete_t autocompletelist[] = #if defined(_WIN32) { "if vid_scaleapi \"direct3d\" ", DOOM1AND2 }, { "if vid_scaleapi \"direct3d\" then ", DOOM1AND2 }, - { "if vid_scaleapi \"direct3d11\" ", DOOM1AND2 }, - { "if vid_scaleapi \"direct3d11\" then ", DOOM1AND2 }, - { "if vid_scaleapi \"direct3d12\" ", DOOM1AND2 }, - { "if vid_scaleapi \"direct3d12\" then ", DOOM1AND2 }, { "if vid_scaleapi \"opengl\" ", DOOM1AND2 }, { "if vid_scaleapi \"opengl\" then ", DOOM1AND2 }, { "if vid_scaleapi \"software\" ", DOOM1AND2 }, { "if vid_scaleapi \"software\" then ", DOOM1AND2 }, { "if vid_scaleapi direct3d ", DOOM1AND2 }, { "if vid_scaleapi direct3d then ", DOOM1AND2 }, - { "if vid_scaleapi direct3d11 ", DOOM1AND2 }, - { "if vid_scaleapi direct3d11 then ", DOOM1AND2 }, - { "if vid_scaleapi direct3d12 ", DOOM1AND2 }, - { "if vid_scaleapi direct3d12 then ", DOOM1AND2 }, { "if vid_scaleapi opengl ", DOOM1AND2 }, { "if vid_scaleapi opengl then ", DOOM1AND2 }, { "if vid_scaleapi software ", DOOM1AND2 }, @@ -7969,13 +7961,9 @@ autocomplete_t autocompletelist[] = { "vid_scaleapi ", DOOM1AND2 }, #if defined(_WIN32) { "vid_scaleapi \"direct3d\"", DOOM1AND2 }, - { "vid_scaleapi \"direct3d11\"", DOOM1AND2 }, - { "vid_scaleapi \"direct3d12\"", DOOM1AND2 }, { "vid_scaleapi \"opengl\"", DOOM1AND2 }, { "vid_scaleapi \"software\"", DOOM1AND2 }, { "vid_scaleapi direct3d", DOOM1AND2 }, - { "vid_scaleapi direct3d11", DOOM1AND2 }, - { "vid_scaleapi direct3d12", DOOM1AND2 }, { "vid_scaleapi opengl", DOOM1AND2 }, { "vid_scaleapi software", DOOM1AND2 }, #else diff --git a/src/c_cmds.c b/src/c_cmds.c index 89490d71ea..5ed6327a01 100644 --- a/src/c_cmds.c +++ b/src/c_cmds.c @@ -982,8 +982,7 @@ consolecmd_t consolecmds[] = "Toggles using the pillarboxes either side of the screen for certain effects when not in widescreen mode."), #if defined(_WIN32) CVAR_STR(vid_scaleapi, "", "", vid_scaleapi_cvar_func1, vid_scaleapi_cvar_func2, CF_NONE, - "The API used to scale each frame (" BOLD("\"direct3d\"") ", " BOLD("\"direct3d11\"") ", " - BOLD("\"direct3d12\"") ", " BOLD("\"opengl\"") " or " BOLD("\"software\"") ")."), + "The API used to scale each frame (" BOLD("\"direct3d\"") ", " BOLD("\"opengl\"") " or " BOLD("\"software\"") ")."), #else CVAR_STR(vid_scaleapi, "", "", vid_scaleapi_cvar_func1, vid_scaleapi_cvar_func2, CF_NONE, "The API used to scale each frame (" BOLD("\"opengl\"") ", " BOLD("\"opengles\"") ", " BOLD("\"opengles2\"") " or " diff --git a/src/i_video.c b/src/i_video.c index 97ac4d6628..73615e5e44 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1280,7 +1280,9 @@ static void SetVideoMode(const bool createwindow, const bool output) SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, vid_scalefilter, SDL_HINT_OVERRIDE); } - SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, vid_scaleapi, SDL_HINT_OVERRIDE); + SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, + (M_StringCompare(vid_scaleapi, vid_scaleapi_direct3d) ? "direct3d11" : vid_scaleapi), + SDL_HINT_OVERRIDE); software = M_StringCompare(vid_scaleapi, vid_scaleapi_software); @@ -1466,7 +1468,7 @@ static void SetVideoMode(const bool createwindow, const bool output) vid_scaleapi = vid_scaleapi_direct3d; M_SaveCVARs(); - SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, vid_scaleapi, SDL_HINT_OVERRIDE); + SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, "direct3d11", SDL_HINT_OVERRIDE); if (output) C_Output("This scaling is now done using hardware acceleration with " @@ -1488,16 +1490,12 @@ static void SetVideoMode(const bool createwindow, const bool output) } } #if defined(_WIN32) - else if (M_StringCompare(rendererinfo.name, vid_scaleapi_direct3d) - || M_StringCompare(rendererinfo.name, vid_scaleapi_direct3d11) - || M_StringCompare(rendererinfo.name, vid_scaleapi_direct3d12)) + else if (M_StringCompare(rendererinfo.name, vid_scaleapi_direct3d)) { if (output) C_Output("This scaling is done using hardware acceleration with " ITALICS("Direct3D.")); - if (!M_StringCompare(vid_scaleapi, vid_scaleapi_direct3d) - && !M_StringCompare(vid_scaleapi, vid_scaleapi_direct3d11) - && !M_StringCompare(vid_scaleapi, vid_scaleapi_direct3d12)) + if (!M_StringCompare(vid_scaleapi, vid_scaleapi_direct3d)) { vid_scaleapi = vid_scaleapi_direct3d; M_SaveCVARs(); diff --git a/src/m_config.h b/src/m_config.h index d98482552b..0d0ef76587 100644 --- a/src/m_config.h +++ b/src/m_config.h @@ -770,8 +770,6 @@ enum #if defined(_WIN32) #define vid_scaleapi_direct3d "direct3d" -#define vid_scaleapi_direct3d11 "direct3d11" -#define vid_scaleapi_direct3d12 "direct3d12" #endif #define vid_scaleapi_opengl "opengl" #if !defined(_WIN32)