diff options
| author | MalexAson <360820579+MalexAson@users.noreply.github.com> | 2026-11-24 20:37:02 +0100 |
|---|---|---|
| committer | MalexAson <360820579+MalexAson@users.noreply.github.com> | 2026-11-24 20:37:02 +0100 |
| commit | e2c13db54a0320c7c9d8ed3302dcb40e58469c08 (patch) | |
| tree | 9d1c6eb43a0a2bc7985bf95892abe71d892d085c /runtime/test/code_hooks_test.cpp | |
| parent | 6293c1c4f88c7ea2088ec595fea51362f1759996 (diff) | |
vulkan_replay: sRGB render-target clears are encoded in the layer, as WARP encodes them (D3D-CLEAR-SRGB-ENCODE)
ClearRenderTargetView on R8G8B8A8_UNORM_SRGB and B8G8R8A8_UNORM_SRGB handed the linear float to
vkCmdClearColorImage or vkCmdClearAttachments and the GPU encoded it. D3D permits FLOAT -> SRGB 0.6 of a step of
tolerance and each implementation puts the steps between two codes somewhere else, so the byte depended on the GPU:
against WARP, d3d12_clear_formats differed in 10 clears and d3d12_srgb_uav in 2 on an Intel Iris Xe (0.5 is bb
there and bc on WARP), and an RTX 4060 passed because the five colours miss the values it encodes differently (3 648
of 60 000 random ones; the Iris Xe 6 649, never more than one code).
render_target_clear_color now encodes the colour channels itself (srgb8_from_linear) the way WARP was measured to:
the value to 12 bits with x * 4095 in single precision rounded half up, then the nearest code of the sRGB curve. All
255 floats at which WARP's byte changes are the ones this gives, and 84 582 further values agree. Vulkan gets the
linear value of that code (srgb8_linear), which both GPUs store as that code for all 256. Alpha is unchanged.
A GPU's own D3D12 driver encodes as its Vulkan driver does, so the layer now differs from that driver where it
differs from WARP, as it does for UNORM ties and D24. d3d12_state_sweep_test compares with that driver and cleared
its sRGB targets to 0.2, 0.4 and 0.6 (0.2 is 124 on WARP, 123 on the Iris Xe); it now starts them from the values of
codes 124, 170 and 203.
clear_color_test pins 38 values to WARP's bytes, the round trip of every code and the result under each rounding
mode. d3d12_clear_formats_test clears the sRGB formats to the value of every code and of every place halfway
between two codes as well: 178 of 352 cases differed from WARP on the Iris Xe and 170 on the RTX 4060 before, none
after.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/code_hooks_test.cpp')
0 files changed, 0 insertions, 0 deletions