Repository navigation
Runtime: SNORM/SINT render targets and clear conversion (D3D-45) - #525
Conversation
Add DXGI->Vulkan mappings and footprint sizes for SNORM and SINT render-target formats, and extend render_target_clear_color to convert SINT clears numerically (NaN to zero, clamp to the signed range, truncate toward zero) instead of copying float bits. Rename d3d12_uint_clear_test to d3d12_clear_test and widen it to compare UNORM/SNORM/FLOAT/UINT/SINT render-target and depth/stencil clears against Windows WARP, full and rectangle. SRGB clears are left out of the byte-exact comparison: the linear->sRGB encoding rounds differently at the .5 boundary on WARP vs Vulkan (a 1-ulp driver difference).
|
CI note: the red checks are pre-existing on main (main@91b36cf is also red on the same jobs), not caused by this PR. They are date-seeded translator fuzzer tests (seed 20261122) hitting pre-existing translator bugs, e.g.:
This PR only changes the D3D12 layer (SNORM/SINT format mappings + clear conversion) and d3d12_clear_test; the windows (MSVC) build passes, so nothing here touches the translator. AI-assisted. |
|
Tested e816f20 on RTX 5070 (Blackwell, subgroup 32..32), NVIDIA 616.56, Windows 11 Pro 26200: d3d12_clear_test fails, on the PR head and merged onto current main (91b36cf, clean merge).
That's DXGI_FORMAT_R8G8B8A8_UNORM cleared to {0, 0.25, 0.5, 1}: the 0.5 channel comes out 0x7f on the RTX 5070 and 0x80 on WARP. That's the .5 tie that #521 rounds explicitly; #521's d3d12_clear_formats_test passes 178/178 here.
Tools: MSVC 19.50, Vulkan SDK 1.4.363.0. |
…D-45) Rebased onto main after ItsNotRexed#525, which added SNORM/SINT render targets for four formats. This keeps ItsNotRexed#525's formats and adds what it leaves out: - Normalised clears round to nearest even like D3D, so 0.5 on an 8-bit channel is 128 (NVIDIA's clears write 127). The layer hands Vulkan the exact fraction; NaN is 0 and out-of-range values clamp. Covers UNORM, SNORM (scale 127 or 32767, -1.0 is -127), the alpha of the sRGB formats, R10G10B10A2_UNORM and D16_UNORM depth. - More formats: R8/R8G8/R16/R16G16/R16G16B16A16 SNORM, R8/R16 SINT, R8/R16 UINT, R16_UNORM and R16G16_UNORM, with their copy sizes; SINT and UINT of every width clamp to the component range and truncate toward zero. - d3d12_clear_formats_test: 178 cases against WARP over UNORM, SNORM, sRGB, FLOAT, UINT, SINT and the four depth formats. typeless_rtv_test now expects the rounded UNORM value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested e816f20 on an RTX 3060 (driver 610.88), Windows 11: Format 28 is Setup: Windows 11 Pro, NVIDIA GeForce RTX 3060 (Ampere), driver 610.88, Vulkan 1.4.341, MSVC (VS 18 Build Tools), Ninja, RelWithDebInfo. No validation layer installed, so not run with |
D3D-45: compare clears with the host runtime across format classes and depth/stencil.
Extends the clear differential test (renamed d3d12_uint_clear_test -> d3d12_clear_test) and adds the missing format support it needs:
ender_target_clear_color: convert SINT clears numerically (NaN -> 0, clamp to the signed range, truncate toward zero) instead of copying float bits.
The test now compares full/rectangle ClearRenderTargetView readbacks against Windows WARP across UNORM, SNORM, FLOAT, UINT and SINT render targets, and ClearDepthStencilView depth/stencil (D32_FLOAT, D16_UNORM, D32_FLOAT_S8X24_UINT).
SRGB clears are omitted from the byte-exact comparison: the linear->sRGB encoding rounds differently at the .5 boundary on WARP vs Vulkan (a 1-ulp driver difference the shim cannot control).
No game files. AI-assisted.
Tested: d3d12_clear_test (59 readbacks) on Intel(R) Graphics, all matched WARP; clear_color_test and d3d12_vulkan_device_test still pass.
Claim: #374 (comment)