Repository navigation
Runtime: clears of the D3D-60 integer formats match WARP, and R8_TYPELESS (follow-up to #600) - #589
Conversation
|
The two red CI jobs are #509 (the mini interpreter quiets signalling NaNs), not this change, which touches no Python:
#533 fixes both; I ran test_mem_diff on its head and it passes. |
|
On For linear texel The unmodified clear suite also matched WARP in all 251 cases, with zero skips. Khronos validation was enabled for both runs. I excluded third-party implicit overlay layers for the measured runs after a loader error from an installed overlay on the first descriptor-test launch. The sampling probe uses a Vulkan dispatch with the device-created descriptor set, as the existing test does. The resource and both SRVs are typed throughout. AI-assisted. Synthetic data only. |
3c6e72d to
a67497e
Compare
|
Rebased with #521 (now one commit, f53f7de, after #525 merged). This PR's own commit is now a67497e, and it merges cleanly with main. Re-tested on the RTX 3060 Ti: ctest 24/24, and 251 clear cases match WARP. The class-changing TYPELESS views that this PR's description lists as not covered are fixed in #621, which is stacked on this one. |
…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>
ItsNotRexed#600 mapped R8G8, R16G16 and R32G32 UINT/SINT, R16G16B16A16 UINT/SINT and R10G10B10A2_UINT, but render_target_clear_color still treats them as float formats: a ClearRenderTargetView writes the float's bits (255.0 becomes 0x437f0000). They now clamp to the component range and truncate toward zero like WARP, with per-channel limits for R10G10B10A2_UINT (10, 10, 10 and 2 bits). R8_TYPELESS, the last two-channel/one-channel TYPELESS form still refused, is mapped as R8_UNORM with the mutable-format flag. d3d12_clear_formats_test goes from 178 to 251 cases against WARP, all matching on an RTX 3060 Ti; without this change 54 differ and R8_TYPELESS is not exposed. clear_color_test checks the integer conversions on the CPU. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a67497e to
23827fe
Compare
|
Tested a67497e on NVIDIA GeForce RTX 3060, driver 617.14, Windows 11: pass Setup: Windows 11 Pro 24H2 (10.0.26100), RTX 3060 (Ampere), NVIDIA 617.14, MSVC 14.44.35207 + Windows SDK 10.0.26100, Ninja RelWithDebInfo, Khronos Vulkan-Headers 1.4.369, VK_LAYER_KHRONOS_validation 1.4.357. PR head built as-is (not rebased; it conflicts with main c432cdc now). Build: 0 errors, 0 warnings. ctest: 24/24, also with LEONIDA_VK_VALIDATION=1. AI-assisted: the build and test runs were done with an AI coding assistant (Claude Code) on my machine; the numbers above are its unedited output. |
|
Tested 23827fe merged onto main c432cdc on NVIDIA GeForce RTX 4060 Ti (Ada), driver 32.0.16.2124 (NVIDIA 621.24), Windows 11 Home 26300, MSVC 2022 / Ninja, Vulkan SDK 1.4.363: pass. Besides ctest, I ran each test program this PR changes directly (several aren't registered with ctest):
ctest: 100% tests passed, 0 tests failed out of 27. AI-assisted. |
|
Tested 23827fe on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
No game files used. AI-assisted run (Claude Code). |
|
Code review at |
|
Checked the packed-format edge case requested above on 23827fe. A 5×3 R10G10B10A2_UINT target was cleared once in full, then cleared in a 3×2 rectangle. I read every 32-bit texel through CopyTextureRegion and Map. Native D3D12 on RTX 5080 (616.92), Radeon(TM) Graphics (26.10.1) and WARP all gave these exact words. The PR’s Vulkan runtime matched all 15 texels on both hardware drivers with validation enabled.
With exactly the same inputs, parent a7b9ea1 missed all 15 texels on each Vulkan driver. The first sampled word inside and outside was 0xFFFFFFFF on RTX and 0x00000000 on Radeon. On the PR head, changing only rectangle alpha from 2.875 to 1.875 changed exactly six texels to 0x623FFC01, leaving all nine exterior texels intact. The unchanged d3d12_clear_formats_test also ran on both GPUs. RTX matched WARP in 251/251 cases. Radeon matched 247/251; all four mismatches were D24_UNORM_S8_UINT depth cases. |
- render_target_clear_color: main's integer conversion (every exposed UINT/SINT format, A2B10G10R10_UINT's 2-bit alpha) with this branch's normalised rounding (quantize_unorm, quantize_snorm) for the UNORM, SNORM and sRGB-alpha channels. - Depth clears: main's D24-as-float conversion, then D16_UNORM through quantize_unorm. - Format tables: main and this branch both mapped DXGI R16_UNORM and R8G8_SNORM and the R8G8_SNORM copy size; the duplicates are dropped. - clear_color_test: main's table-driven integer checks plus this branch's normalised and integer cases. The float pass-through loop now uses R32_SFLOAT and R16G16B16A16_SFLOAT, since R8G8B8A8_UNORM values are rounded.
…in ctest quantize_unorm/quantize_snorm used std::nearbyint, which follows the thread's rounding mode (matheuskshn's review): under FE_DOWNWARD 0.5 on 8 bits gave 127 and 0.5 on SNORM8 gave 63. round_half_even uses floor() plus an explicit tie check, which does not depend on the mode. clear_color_test converts the ties under FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO and checks them once the default mode is back; with nearbyint it fails as above. d3d12_clear was left out of ctest until this lands (3fc0b21); it is registered again, with SKIP_RETURN_CODE 77 as before.
…own adapter The placed plain clear (D3D-90/D3D-221) is compared byte for byte with the host D3D12 runtime when the host is the layer's own adapter. Its 0.5 * 255 = 127.5 is a tie: NVIDIA's D3D12 driver writes 0x7f, WARP and AMD 0x80, and the D3D11.3 spec (3.2.3.6) permits either within 0.6 ULP. With this branch the layer rounds normalised clear values itself, to nearest even, so on an NVIDIA adapter it writes 0x80 and the exact same-adapter comparison failed (RTX 5070, 621.24). On the same adapter a differing plain byte is now accepted only when it is exactly the nearest-even code and within 0.6 ULP; every other difference still fails, and the SRGB-cast comparison is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's render_target_clear_color already converts the D3D-60 integer formats and the 10:10:10:2 alpha, so this branch now carries only its tests. The R8_TYPELESS mapping is on main too; the duplicate case label the merge produced is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Updated to ffe9b18: the refreshed #521 branch is merged in, and through it main aa2988c. That clears the conflicts. Main's matheuskshn's packed-alpha case: Vonsek's 15-texel run covers it, and those rows are now in I couldn't build locally (no C++ toolchain on this machine), so CI will be the first build. AI-assisted (Claude Code). |
|
Tested ffe9b18 on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, MSVC 14.44, Vulkan SDK 1.4.363, RelWithDebInfo: fail.
|
|
Tested ffe9b18 merged with main 2d3369a on Windows 11 (Python 3.13.1 not used; MSVC 14.51 / Ninja, RelWithDebInfo): concern.
|
…product Two problems the clear fuzzer found after the rebase on main 561b65a: - AMD's Vulkan driver can store to R5G6B5, A1R5G5B5 and A4R4G4B4, so the layer reports typed UAV stores for B5G6R5, B5G5R5A1 and B4G4R4A4 there, but uav_clear.h had no layout for them: a ClearUnorderedAccessView* on one made ExecuteCommandLists refuse the whole list, its other work included (found by @Jadiac5 on an RX 9070 XT). The three layouts are added. - quantize_unorm/quantize_snorm (ItsNotRexed#589) multiplied in double. D3D multiplies in float: a D16 depth of 0.681063533 is 44633.5 in float, a tie that WARP writes as the even 44634, but 44633.4999... in double, which rounds to 44633 (on main, 70 of 2,000 fuzzer seeds, all D16 and 16-bit UNORM). The exact double product is now rounded to the nearest float first (nearest_float, ties to even, by nextafter so the thread's FP rounding mode doesn't matter), then to the code. uav_clear::encode does the same. The sRGB colour channels stay on the GPU's curve, as main decided (ItsNotRexed#589); this branch no longer quantises them. clear_color_test checks the packed layouts and the D16 tie under all four rounding modes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in #374 as: D3D-60. #600 (merged) added the format mappings. This is the part it left out.
Depends on #521: its commit (a7b9ea1) comes first here. Review the second, 23827fe.
What and why
#600 made
CreateCommittedResourceaccept R8G8, R16G16 and R32G32 UINT/SINT, R16G16B16A16 UINT/SINT and R10G10B10A2_UINT. Butrender_target_clear_colorstill treats them as float formats, soClearRenderTargetViewwrites the float's bits. A clear to 255 stores 0x437f0000 in an R8G8_UINT target.d3d12_clear_formats_test(from #521) gets the new formats and four TYPELESS cases.Tested
d3d12_clear_formats_test: 251 cases match WARP (178 on Runtime: clears match WARP on every format class: tie rounding, and the SNORM/SINT/R8/R16 formats (D3D-45) #521), with and withoutLEONIDA_VK_VALIDATION=1, and no validation errors.clear_color_testfails withinteger clear: format 20 ... got 1132462080, expected 255: those are the float bits of 255.clear_color_test(CPU only): 120 checks, up from 110. The new checks cover R8G8_UINT, R16G16_SINT, R16G16B16A16_UINT, and R10G10B10A2_UINT with per-channel limits.ctest: 27/27.d3d12_vulkan_device_test(with Runtime: add missing integer and typeless texture formats (D3D-60) #600's new cases) passes.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code