RENDERER: Remove hardware gamma control. - #1143
Open
dsvensson wants to merge 4 commits into
Open
Conversation
Preparation for removing vid_hwgammacontrol (it relies on SDL_SetWindowGammaRamp, which SDL3 removes). With hardware gamma on its way out, vid_hwgamma_enabled is effectively always false, so collapse every consumer to its software path: - Delete V_UpdatePalette() (it only ever built and applied the hardware gamma ramp) and the ramps[] buffer, and drop its call site. - Delete applyHWGamma() and its screenshot call sites. Gamma now lives in the framebuffer via the post-process shader, so screenshots capture it without a manual ramp pass. - Apply the view blend through the post-process palette shader when vid_software_palette is enabled (GLM frameConstants.v_blend / GLC blend_values) and gate R_PolyBlend on vid_software_palette so the blend is applied exactly once instead of being double-applied. - Drop the now-constant vid_hwgamma_enabled branches in the brighten and screen-clear paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deletes the now-unreachable hardware gamma implementation. It relied on SDL_SetWindowGammaRamp (removed in SDL3) and an X11/XF86VidMode fallback that was never even compiled (X11_GAMMA_WORKAROUND is undefined). Software gamma via the post-process shader (vid_software_palette) is the path that remains. Removed from vid_sdl2.c: - VID_SetDeviceGammaRamp[Real], VID_RestoreSystemGamma, VID_X11_GetGammaRampSize and all #ifdef X11_GAMMA_WORKAROUND blocks (focus-lost/gained, shutdown, reload, sysramps, xf86vmode include). - The vid_hwgammacontrol and vid_gamma_workaround cvars and the vid_hwgamma_enabled flag. Removed elsewhere: - gl_hwblend and vid_hwgamma_fps cvars (only fed the hardware ramp). - glConfig.gammacrap (tr_types.h) and the VID_SetDeviceGammaRamp / vid_hwgamma_enabled declarations (vid.h). - The -nohwgamma command-line parameter and Ruleset_AllowNoHardwareGamma, plus the smackdown lock that forced vid_hwgammacontrol to "2". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drops the vid_hwgammacontrol, vid_hwgamma_fps and gl_hwblend variable entries and the -nohwgamma command-line parameter, and updates the remaining gamma docs (-oldgamma, vid_software_palette and its vid_framebuffer_palette alias) so they no longer reference the removed hardware gamma path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
macOS defaulted vid_software_palette to 0 because it relied on hardware gamma (vid_hwgammacontrol "2") for gamma correction. With the hardware gamma path removed, the post-process shader is the only gamma mechanism, so enable it by default everywhere instead of leaving macOS without gamma. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ciscon
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardware gamma (
vid_hwgammacontrol) sets the display gamma ramp viaSDL_SetWindowGammaRamp, which SDL 3.x deprecates/removes. The concept is also being phased out at the OS level — notably Wayland has no equivalent, so it was already a no-op for many Linux users. This removes the feature and everything that only existed to serve it, leaving software gamma (applied in the post-process shader) as the single path.Removed
vid_hwgammacontroland the gamma-ramp engine (VID_SetDeviceGammaRamp), including the never-compiled X11/XF86VidMode fallback.gl_hwblend,vid_hwgamma_fps,vid_gamma_workaround.-nohwgammacommand-line flag,Ruleset_AllowNoHardwareGamma, and the related help documentation.Notes
gl_hwblendgone, the view blend (damage/powerup/water flashes) is now gated onvid_software_palette: the post-process shader applies it when software palette is on,R_PolyBlenddraws the quad when off. No visible change at default gamma/contrast.vid_software_palettenow defaults to1on all platforms (macOS previously relied on hardware gamma), so gamma correction works everywhere by default.