diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 14:11:40 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 14:11:40 +0100 |
| commit | 592b865ca5c98d1df2153ea5b77f67aa8a76db60 (patch) | |
| tree | 4fb957603dba3bc57d316168f074410bdef3e70f /src/gui.cpp | |
| parent | Gamma: clamp slider to the engine's 2.6 cap, defer readback (diff) | |
| download | hl2h-592b865ca5c98d1df2153ea5b77f67aa8a76db60.tar.gz hl2h-592b865ca5c98d1df2153ea5b77f67aa8a76db60.zip | |
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.
Diffstat (limited to 'src/gui.cpp')
| -rw-r--r-- | src/gui.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
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() { | |||
| 420 | &g_fov_viewmodel); | 420 | &g_fov_viewmodel); |
| 421 | add_slider(view, "Gamma x10", | 421 | add_slider(view, "Gamma x10", |
| 422 | "mat_monitorgamma x10: 16 = 1.6, 26 = 2.6 (engine max), stock " | 422 | "mat_monitorgamma x10: 16 = 1.6, 26 = 2.6 (engine max), stock " |
| 423 | "is 22.", | 423 | "is 22. Uses the OS gamma ramp; some compositors ignore it.", |
| 424 | 16, 26, &g_gamma); | 424 | 16, 26, &g_gamma); |
| 425 | add_slider(view, "HDR brightness", | ||
| 426 | "mat_force_tonemap_scale x10 (0 = automatic). In-engine " | ||
| 427 | "brightness for HDR maps; 10 = 1.0.", | ||
| 428 | 0, 30, &g_tonemap); | ||
| 425 | 429 | ||
| 426 | add_card(2, &g_fullbright, "Fullbright", | 430 | add_card(2, &g_fullbright, "Fullbright", |
| 427 | "Ignore world lighting so dark areas are visible.", true); | 431 | "Ignore world lighting so dark areas are visible.", true); |
| @@ -2254,12 +2258,6 @@ SDL_SetWindowGammaRamp(void *window, const unsigned short *r, | |||
| 2254 | const unsigned short *, | 2258 | const unsigned short *, |
| 2255 | const unsigned short *))dlsym( | 2259 | const unsigned short *))dlsym( |
| 2256 | RTLD_NEXT, "SDL_SetWindowGammaRamp"); | 2260 | RTLD_NEXT, "SDL_SetWindowGammaRamp"); |
| 2257 | static int logs = 0; | ||
| 2258 | if (logs < 12) { | ||
| 2259 | logs++; | ||
| 2260 | logf("gamma: SDL_SetWindowGammaRamp mid=%u/%u/%u", r ? r[128] : 0, | ||
| 2261 | g ? g[128] : 0, b ? b[128] : 0); | ||
| 2262 | } | ||
| 2263 | return real_set_gamma_ramp ? real_set_gamma_ramp(window, r, g, b) : -1; | 2261 | return real_set_gamma_ramp ? real_set_gamma_ramp(window, r, g, b) : -1; |
| 2264 | } | 2262 | } |
| 2265 | 2263 | ||
