mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
The paint encoder bakes sRGB-encoded font palette values directly (quantizing 0..255 to 0..32767 without decoding), so the shader writes sRGB-ish values. With GL_FRAMEBUFFER_SRGB enabled the driver then applied linear->sRGB encoding on store, giving a double-encoded, washed-out result -- most visible on mid-tone gradients. The cleanest fix is to stop pretending we're doing linear-space compositing: drop the sRGB framebuffer mode entirely and always apply the classic 2.2 gamma exponent for coverage correction (flipped to 1/2.2 in dark mode to match the existing light/dark logic). Removed pieces: - demo_view_t::gamma_mode enum, demo_view_set_gamma_mode, demo_view_cycle_gamma, and the `g` keybinding + help line - demo_renderer_t::set_srgb virtual + every backend override - GLFW_SRGB_CAPABLE hint in gpu-output.hh - Metal swapchain MTLPixelFormatBGRA8Unorm_sRGB -> BGRA8Unorm Replaced with demo_view_update_gamma, called on setup() and after the dark-mode toggle. Shader side stays the same (only alpha gets the gamma curve, as before). Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>