lint the test targets, make the fps setting real, and stop tonemapping sdr captures

This commit is contained in:
2026-09-21 06:45:23 +03:00
parent 4b850096a1
commit aef64fa4e3
8 changed files with 221 additions and 40 deletions
+20 -2
View File
@@ -49,14 +49,32 @@ float bt709_oetf(float lin) {
return 1.099 * pow(lin, 0.45) - 0.099;
}
// Compiled twice from this one source: TONEMAP=1 for an HDR output, TONEMAP=0
// for SDR. The capture surface is linear scRGB either way, but only HDR content
// reaches above 1.0 in it, so the same curve cannot be right for both.
#ifndef TONEMAP
#define TONEMAP 1
#endif
float4 tonemap_ps(VsOut i) : SV_TARGET {
// captured.rgb is linear scRGB (1.0 = SDR white; HDR highlights >1.0).
// captured.rgb is linear scRGB, where 1.0 is 80 nits.
float4 c = captured.Sample(point_clamp, i.uv);
#if TONEMAP
float3 mapped = hable(c.rgb);
// Normalize by hable at the white point so 1.0 SDR white maps to ~1.0
// output rather than the raw hable value (which is >1).
// output rather than the raw hable value (which is >1). On an HDR desktop
// SDR white sits near 2.5 in these units (203 nits), so normalizing at 4.0
// is what leaves the highlights somewhere to roll off to.
float3 white = hable(float3(4.0, 4.0, 4.0));
float3 sdr = mapped / white;
#else
// SDR: 1.0 is already display white and there is nothing above it to
// compress. Running this through Hable regardless would map white to about
// 0.65 and darken the whole frame by a third.
float3 sdr = saturate(c.rgb);
#endif
// Apply bt709 OETF so the BGRA8 bytes leave the GPU already gamma-encoded,
// matching the SDR capture pipeline's contract.
float3 gamma = float3(