From 2e060d00f24d68f627d6b3c2959bd8d3243549f2 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Thu, 16 Mar 2023 21:14:18 +0100 Subject: [PATCH 1/7] CFG: Default to r_dynamic 2 on modern. --- help_variables.json | 2 +- src/r_rmain.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/help_variables.json b/help_variables.json index 1abfb27f9..59c8e1553 100644 --- a/help_variables.json +++ b/help_variables.json @@ -15391,7 +15391,7 @@ ] }, "r_dynamic": { - "default": "1", + "default": "2", "desc": "Controls dynamic lighting (muzzle-flash, quad & rocket glow, etc) on world surfaces.", "group-id": "15", "type": "enum", diff --git a/src/r_rmain.c b/src/r_rmain.c index afbd0d64a..2ee173145 100644 --- a/src/r_rmain.c +++ b/src/r_rmain.c @@ -138,7 +138,11 @@ cvar_t r_speeds = {"r_speeds", "0"}; cvar_t r_fullbright = {"r_fullbright", "0"}; cvar_t r_shadows = {"r_shadows", "0"}; cvar_t r_wateralpha = {"gl_turbalpha", "1"}; +#if defined(EZ_MULTIPLE_RENDERERS) && defined(RENDERER_OPTION_MODERN_OPENGL) +cvar_t r_dynamic = {"r_dynamic", "2", 0, OnDynamicLightingChange }; +#else cvar_t r_dynamic = {"r_dynamic", "1", 0, OnDynamicLightingChange }; +#endif cvar_t r_novis = {"r_novis", "0"}; cvar_t r_netgraph = {"r_netgraph", "0"}; cvar_t r_netstats = {"r_netstats", "0"}; From 67dc7d33d0cd2876f0b678d114bd3002817650db Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Thu, 16 Mar 2023 21:16:20 +0100 Subject: [PATCH 2/7] CFG: Default gl_anisotropy 16. This avoids filtering out fence textures at steep angles. --- help_variables.json | 2 +- src/r_texture_cvars.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/help_variables.json b/help_variables.json index 59c8e1553..82fa0b4bb 100644 --- a/help_variables.json +++ b/help_variables.json @@ -4581,7 +4581,7 @@ ] }, "gl_anisotropy": { - "default": "1", + "default": "16", "desc": "Anisotropic filtering. Improves texture detail on angled surfaces.", "group-id": "50", "remarks": "Depends on your Graphics card capabilities and settings. Make sure you have set your graphic card's Anisotropic Filtering setting to \"Application controlled\".", diff --git a/src/r_texture_cvars.c b/src/r_texture_cvars.c index 81f4beda2..0367dd077 100644 --- a/src/r_texture_cvars.c +++ b/src/r_texture_cvars.c @@ -44,7 +44,7 @@ cvar_t gl_picmip = { "gl_picmip", "0", CVAR_RELOAD_GFX }; cvar_t gl_miptexLevel = { "gl_miptexLevel", "0", CVAR_RELOAD_GFX, OnChange_gl_miptexLevel }; cvar_t gl_texturemode = { "gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR", 0, OnChange_gl_texturemode }; cvar_t gl_texturemode_viewmodels = { "gl_texturemode_viewmodels", "GL_LINEAR", 0, OnChange_gl_texturemode }; -cvar_t gl_anisotropy = { "gl_anisotropy","1", 0, OnChange_gl_anisotropy }; +cvar_t gl_anisotropy = { "gl_anisotropy","16", 0, OnChange_gl_anisotropy }; cvar_t gl_scaleModelTextures = { "gl_scaleModelTextures", "0", CVAR_RELOAD_GFX }; cvar_t gl_scaleModelSimpleTextures = { "gl_scaleModelSimpleTextures", "0", CVAR_RELOAD_GFX }; cvar_t gl_scaleTurbTextures = { "gl_scaleTurbTextures", "1", CVAR_RELOAD_GFX }; From 44ddfce3a3eb629dafb0ce7939ab31efd075cc0b Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 17 Mar 2023 00:04:24 +0100 Subject: [PATCH 3/7] SETTINGS: Handle with latched cvars correctly. Latched enum support was missing, and getter didn't check if latched value was set before trying to use it, risking referring to NULL. --- src/settings_page.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/settings_page.c b/src/settings_page.c index 440c53625..fe8715f41 100644 --- a/src/settings_page.c +++ b/src/settings_page.c @@ -79,7 +79,12 @@ float VARFVAL(const cvar_t *v) else return v->value; } -#define VARSVAL(x) (((x).flags & CVAR_LATCH) ? ((x).latchedString) : ((x).string)) +char* VARSVAL(const cvar_t *v) +{ + if (v->flags & CVAR_LATCH && v->latchedString) + return v->latchedString; + else return v->string; +} static int STHeight(setting* s) { if (s->advanced && !menu_advanced.value) @@ -172,9 +177,10 @@ static void Setting_DrawNamed(int x, int y, int w, setting* set, qbool active) static int Enum_Find_ValueCode(setting* set) { int i; + for (i = 0; i <= set->max; i++) { - if (!strcmp(set->cvar->string, ENUM_VALUE(set, i))) + if (!strcmp(VARSVAL(set->cvar), ENUM_VALUE(set, i))) return i; } return ENUM_ITEM_NOT_FOUND; @@ -200,7 +206,7 @@ static void Setting_DrawString(int x, int y, int w, setting* setting, qbool acti editbox.width = (w - x + x0) / 8; CEditBox_Draw(&editbox, x, y, true); } else { - UI_Print(x, y, VARSVAL(*(setting->cvar)), false); + UI_Print(x, y, VARSVAL(setting->cvar), false); } } From e324cdef56e5f5e62b00fc0280ac65edbc130d2c Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 17 Mar 2023 00:47:02 +0100 Subject: [PATCH 4/7] SETTINGS: Add menu item for vid_renderer. --- src/menu_options.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/menu_options.c b/src/menu_options.c index ba7df8635..9a210f1a9 100644 --- a/src/menu_options.c +++ b/src/menu_options.c @@ -50,11 +50,16 @@ along with this program. If not, see . #include "keys.h" #include "hud.h" #include "hud_common.h" +#include "r_local.h" extern cvar_t r_farclip, gl_max_size, gl_miptexLevel; extern cvar_t r_bloom; extern cvar_t gl_flashblend, r_dynamic, gl_lightmode, gl_modulate; +#ifdef EZ_MULTIPLE_RENDERERS +extern cvar_t vid_renderer; +#endif + typedef enum { OPTPG_MISC, OPTPG_PLAYER, @@ -414,6 +419,13 @@ const char* gl_texturemode_enum[] = { "very high", "GL_NEAREST" }; +#ifdef EZ_MULTIPLE_RENDERERS +const char* vid_renderer_enum[] = { + "classic", "0", + "modern", "1" +}; +#endif + settings_page settfps; void CT_Opt_FPS_Draw (int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page) @@ -494,6 +506,14 @@ void VideoApplySettings (void) mss_askmode = true; } +#if defined(EZ_MULTIPLE_RENDERERS) || defined(RENDERER_OPTION_MODERN_OPENGL) +// performed when user hits the "apply" button +void RendererRestart (void) +{ + Cbuf_AddText("vid_restart\n"); +} +#endif + // two possible results of the "keep these video settings?" dialogue static void KeepNewVideoSettings (void) { mss_askmode = false; } static void CancelNewVideoSettings (void) { @@ -1257,6 +1277,12 @@ setting settsystem_arr[] = { ADDSET_CUSTOM("Fullscreen", FullScreenRead, FullScreenToggle, "Toggle between fullscreen and windowed mode."), ADDSET_ACTION("Apply Changes", VideoApplySettings, "Restarts the renderer and applies the selected resolution."), +#ifdef EZ_MULTIPLE_RENDERERS + ADDSET_SEPARATOR("Renderer"), + ADDSET_ENUM("Mode", vid_renderer, vid_renderer_enum), + ADDSET_ACTION("Apply Changes", RendererRestart, "Restarts the renderer."), +#endif + //Font ADDSET_ADVANCED_SECTION(), ADDSET_SEPARATOR("Font"), From 54b0f65a642ea03f5c2bfd4bba487c75e9c9261d Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 17 Mar 2023 00:47:57 +0100 Subject: [PATCH 5/7] SETTINGS: Add menu item for vid_software_palette. --- help_variables.json | 2 +- src/menu_options.c | 10 ++++++++++ src/r_rmain.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/help_variables.json b/help_variables.json index 82fa0b4bb..f8b34464a 100644 --- a/help_variables.json +++ b/help_variables.json @@ -21812,7 +21812,7 @@ "type": "boolean" }, "vid_software_palette": { - "default": "0", + "default": "1", "desc": "Controls whether to adjust gamma at the display level, or as a color correction rendering effect.", "group-id": "52", "type": "boolean", diff --git a/src/menu_options.c b/src/menu_options.c index 9a210f1a9..220ed78c3 100644 --- a/src/menu_options.c +++ b/src/menu_options.c @@ -56,6 +56,8 @@ extern cvar_t r_farclip, gl_max_size, gl_miptexLevel; extern cvar_t r_bloom; extern cvar_t gl_flashblend, r_dynamic, gl_lightmode, gl_modulate; +extern cvar_t vid_software_palette; + #ifdef EZ_MULTIPLE_RENDERERS extern cvar_t vid_renderer; #endif @@ -419,6 +421,11 @@ const char* gl_texturemode_enum[] = { "very high", "GL_NEAREST" }; +const char* vid_software_palette_enum[] = { + "hardware", "0", + "shader", "1" +}; + #ifdef EZ_MULTIPLE_RENDERERS const char* vid_renderer_enum[] = { "classic", "0", @@ -1258,6 +1265,9 @@ setting settsystem_arr[] = { //Video ADDSET_SEPARATOR("Video"), ADDSET_NUMBER ("Gamma", v_gamma, 0.3, 3.0, 0.1), + ADDSET_ADVANCED_SECTION(), + ADDSET_ENUM ("Gamma control", vid_software_palette, vid_software_palette_enum), + ADDSET_BASIC_SECTION(), ADDSET_NUMBER ("Contrast", v_contrast, 1, 5, 0.1), ADDSET_ADVANCED_SECTION(), ADDSET_NUMBER ("Lightmap Intensity", gl_modulate, 0.5, 3.0, 0.1), diff --git a/src/r_rmain.c b/src/r_rmain.c index 2ee173145..2d2cd846c 100644 --- a/src/r_rmain.c +++ b/src/r_rmain.c @@ -138,7 +138,7 @@ cvar_t r_speeds = {"r_speeds", "0"}; cvar_t r_fullbright = {"r_fullbright", "0"}; cvar_t r_shadows = {"r_shadows", "0"}; cvar_t r_wateralpha = {"gl_turbalpha", "1"}; -#if defined(EZ_MULTIPLE_RENDERERS) && defined(RENDERER_OPTION_MODERN_OPENGL) +#if defined(EZ_MULTIPLE_RENDERERS) || defined(RENDERER_OPTION_MODERN_OPENGL) cvar_t r_dynamic = {"r_dynamic", "2", 0, OnDynamicLightingChange }; #else cvar_t r_dynamic = {"r_dynamic", "1", 0, OnDynamicLightingChange }; From 40b1e741c107d988bb6d8cfa8f54ffe43f8b49bb Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 17 Mar 2023 00:49:25 +0100 Subject: [PATCH 6/7] SETTINGS: Menu items added for vid_framebuffer*. --- src/menu_options.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/menu_options.c b/src/menu_options.c index 220ed78c3..fde42f419 100644 --- a/src/menu_options.c +++ b/src/menu_options.c @@ -56,6 +56,10 @@ extern cvar_t r_farclip, gl_max_size, gl_miptexLevel; extern cvar_t r_bloom; extern cvar_t gl_flashblend, r_dynamic, gl_lightmode, gl_modulate; +#ifdef RENDERER_OPTION_MODERN_OPENGL +extern cvar_t vid_framebuffer, vid_framebuffer_hdr, vid_framebuffer_hdr_tonemap, vid_framebuffer_scale, vid_framebuffer_multisample; +#endif + extern cvar_t vid_software_palette; #ifdef EZ_MULTIPLE_RENDERERS @@ -433,6 +437,14 @@ const char* vid_renderer_enum[] = { }; #endif +#ifdef RENDERER_OPTION_MODERN_OPENGL +const char* vid_framebuffer_enum[] = { + "disabled", "0", + "enabled", "1", + "enabled (separate scene & hud)", "2" +}; +#endif + settings_page settfps; void CT_Opt_FPS_Draw (int x, int y, int w, int h, CTab_t *tab, CTabPage_t *page) @@ -1293,6 +1305,18 @@ setting settsystem_arr[] = { ADDSET_ACTION("Apply Changes", RendererRestart, "Restarts the renderer."), #endif +#ifdef RENDERER_OPTION_MODERN_OPENGL + ADDSET_ADVANCED_SECTION(), + ADDSET_SEPARATOR("Framebuffer"), + ADDSET_ENUM("Mode", vid_framebuffer, vid_framebuffer_enum), + ADDSET_BOOL("HDR", vid_framebuffer_hdr), + ADDSET_BOOL("HDR Tonemap", vid_framebuffer_hdr_tonemap), + ADDSET_NUMBER("Scale", vid_framebuffer_scale, 0.25, 2.0, 0.25), + ADDSET_NUMBER("Multisample", vid_framebuffer_multisample, 0, 16, 1), + ADDSET_ACTION("Apply Changes", RendererRestart, "Restarts the renderer."), + ADDSET_BASIC_SECTION(), +#endif + //Font ADDSET_ADVANCED_SECTION(), ADDSET_SEPARATOR("Font"), From b817b632a2aa17a064b577d2409f613848c87d38 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 17 Mar 2023 00:52:49 +0100 Subject: [PATCH 7/7] CFG: Default to vid_renderer 1. --- help_variables.json | 2 +- src/vid_sdl2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/help_variables.json b/help_variables.json index f8b34464a..c9846112e 100644 --- a/help_variables.json +++ b/help_variables.json @@ -21774,7 +21774,7 @@ "type": "float" }, "vid_renderer": { - "default": "0", + "default": "1", "desc": "Selects which rendering mode to use.", "group-id": "52", "remarks": "(variable only available if multiple renderers available)", diff --git a/src/vid_sdl2.c b/src/vid_sdl2.c index 738178262..20607d239 100644 --- a/src/vid_sdl2.c +++ b/src/vid_sdl2.c @@ -193,7 +193,7 @@ cvar_t in_raw = {"in_raw", "1", CV cvar_t in_grab_windowed_mouse = {"in_grab_windowed_mouse", "1", CVAR_ARCHIVE | CVAR_SILENT, in_grab_windowed_mouse_callback}; cvar_t vid_grab_keyboard = {"vid_grab_keyboard", CVAR_DEF2, CVAR_LATCH_GFX }; /* Needs vid_restart thus vid_.... */ #ifdef EZ_MULTIPLE_RENDERERS -cvar_t vid_renderer = {"vid_renderer", "0", CVAR_LATCH_GFX }; +cvar_t vid_renderer = {"vid_renderer", "1", CVAR_LATCH_GFX }; #endif cvar_t vid_gl_core_profile = {"vid_gl_core_profile", "0", CVAR_LATCH_GFX };