[client] egl: make native HDR encoding-safe

Request true floating-point EGL configs for scRGB and expose the native
encodings supported by the selected surface. Fall back to software HDR
mapping when the surface cannot represent the incoming wire format.

Resample PQ in linear light, keep SDR-only effects out of native PQ
chains, and consume the cursor-specific white level without changing
binary monochrome cursor mask operations.
This commit is contained in:
Geoffrey McRae
2026-07-19 04:42:30 +10:00
parent cdc8ed96bf
commit 0e14e9c357
10 changed files with 160 additions and 42 deletions

View File

@@ -9,7 +9,7 @@ out vec4 color;
uniform sampler2D sampler1;
uniform float scale;
uniform bool mapSDRtoPQ;
uniform int wireTransfer; // 0: sRGB, 1: scRGB, 2: PQ
uniform float sdrWhiteLevel;
void main()
@@ -30,11 +30,13 @@ void main()
if (tmp.rgb == vec3(0.0, 0.0, 0.0))
discard;
if (mapSDRtoPQ)
if (wireTransfer == 2)
{
vec3 linear = bt709to2020(srgb2lin(tmp.rgb));
tmp.rgb = lin2pq(linear * (sdrWhiteLevel / 10000.0));
}
else if (wireTransfer == 1)
tmp.rgb = srgb2lin(tmp.rgb) * (sdrWhiteLevel / 80.0);
color = tmp;
}