From 592b865ca5c98d1df2153ea5b77f67aa8a76db60 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 14:11:40 +0100 Subject: Add HDR tonemap brightness slider The engine applies mat_monitorgamma (SDL receives changing ramp midpoints), but Wayland/XWayland compositors discard the window gamma ramp, so the gamma slider has no visible effect there. Add an in-engine brightness control that does not depend on the window system: mat_force_tonemap_scale, exposed as "HDR brightness" (x10, 0 = automatic). Drop the temporary SDL gamma ramp diagnostic. --- src/gui.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/gui.cpp') diff --git a/src/gui.cpp b/src/gui.cpp index e8bcac7..83dc0a5 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -420,8 +420,12 @@ static void build_cards() { &g_fov_viewmodel); add_slider(view, "Gamma x10", "mat_monitorgamma x10: 16 = 1.6, 26 = 2.6 (engine max), stock " - "is 22.", + "is 22. Uses the OS gamma ramp; some compositors ignore it.", 16, 26, &g_gamma); + add_slider(view, "HDR brightness", + "mat_force_tonemap_scale x10 (0 = automatic). In-engine " + "brightness for HDR maps; 10 = 1.0.", + 0, 30, &g_tonemap); add_card(2, &g_fullbright, "Fullbright", "Ignore world lighting so dark areas are visible.", true); @@ -2254,12 +2258,6 @@ SDL_SetWindowGammaRamp(void *window, const unsigned short *r, const unsigned short *, const unsigned short *))dlsym( RTLD_NEXT, "SDL_SetWindowGammaRamp"); - static int logs = 0; - if (logs < 12) { - logs++; - logf("gamma: SDL_SetWindowGammaRamp mid=%u/%u/%u", r ? r[128] : 0, - g ? g[128] : 0, b ? b[128] : 0); - } return real_set_gamma_ramp ? real_set_gamma_ramp(window, r, g, b) : -1; } -- cgit v1.2.3