Repository navigation
Tests: placed castable clears compare with the layer's own adapter; a different adapter may differ by one code at an exact .5 tie - #1616
Conversation
D3D12 converts a float clear to the nearest UNORM code with a tie going up (0.5 * 255 = 127.5 is 0x80, per WARP and the Radeon host). Vulkan leaves the tie to the GPU and NVIDIA rounds it down (0x7f), so the placed castable clear in d3d12_vulkan_device_test differed on the RTX 5070. render_target_clear_color now hands Vulkan the code above an exact tie (code / max) for the 8- and 16-bit UNORM formats; every other value is passed through. Pinned in replay_clear_gate_test; clear_color_test expects the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flyander
left a comment
There was a problem hiding this comment.
The fix covers 8-bit and 16-bit UNORM formats, but the runtime also maps DXGI_FORMAT_R10G10B10A2_UNORM through VK_FORMAT_A2B10G10R10_UNORM_PACK32. Exact ties in the 10-bit RGB channels (0.5 * 1023) and the 2-bit alpha channel (0.5 * 3) still pass through unchanged, so the same rounding mismatch can remain on this common render-target format. Please handle per-channel maxima (1023 for RGB, 3 for alpha) and add a packed-format regression case, or document why this format is intentionally excluded.
| case VK_FORMAT_R16_UNORM: | ||
| case VK_FORMAT_R16G16_UNORM: | ||
| case VK_FORMAT_R16G16B16A16_UNORM: unorm_max = 65535; break; | ||
| default: break; |
There was a problem hiding this comment.
This switch omits VK_FORMAT_A2B10G10R10_UNORM_PACK32, the backing format for DXGI_FORMAT_R10G10B10A2_UNORM. RGB and alpha have different UNORM maxima (1023 and 3), so a scalar maximum is insufficient, but the exact-tie rule should cover this format too.
|
AI-assisted independent verification of the published head Native D3D12 on the RTX 3080 returned
The table is for the no-list R8G8B8A8_UNORM control. Each RGBA tuple occurred in all 16 texels. Each 48/64 comparison differed in all 16 green bytes only. The sRGB cast was The focused variant extracted the unchanged stock The earlier #1083 pre-rebase Radeon result recorded Tracking is already in place under D3D-188 in #1548, carrying forward the original finding and claim in #1380. |
|
Tested f4eab25 on NVIDIA GeForce RTX 3090 (Ampere), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: this PR makes The PR's diff applied cleanly to
So the host the test compares against, the NVIDIA D3D12 driver on this adapter, also rounds the 127.5 tie down to 0x7f on 610.88. It isn't a fixed D3D12 rule. WARP and the 880M give 0x80, NVIDIA's D3D12 610.88 gives 0x7f, and NVIDIA Vulkan gives 0x7f here. On this driver, Which NVIDIA driver failed on |
|
New independent GPU data changes my read of the rounding rule: native D3D12 returned 0x7f on an RTX 3080 (driver 616.64) and RTX 3090 (610.88), while Radeon and WARP returned 0x80. On those NVIDIA systems, this patch changes a native-matching result into a mismatch. The current helper and test therefore should not encode round-up as a universal D3D12 rule; please resolve the host-vs-layer behavior per adapter and update the test to compare against the same adapter. My packed 10:10:10:2 coverage note is secondary until the expected rule is clear. |
NVIDIA's own D3D12 driver rounds the 127.5 tie down too (RTX 3090, 610.88), so D3D12 has no single tie rule and the layer passes clear values through as before. The mismatch was a host device on another adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Two-vendor desktop data, adding to whattheflop's and Rainmaker33's results above: it's the comparison's host choice that fails, not the layer's rounding. AI-assisted (omp orchestrator), no game files. Setup. RTX 5060 Ti (621.24) and RX 9060 XT (AMDVLK 32.0.32029.2010), Windows 11. I made default-flag builds of main
What the table shows.
The test already has a fix. The castable placed comparison creates its host with
It's your claim (D3D-188), so I'm leaving the fix with you. I'm happy to run a revision on this box, on both GPUs and with either host. |
|
Additional finding in the coordination issue (#1548, comment by abilliontokens): this failing placed comparison uses create_host_device() (the default D3D12 adapter), while the same test suite already has create_host_device_for_physical() to match LUID/PCI IDs. On RTX 5060 Ti and RX 9060 XT the baseline main passes when compared to the same physical GPU. That points to a host-selection bug in the comparison as the original signal; please verify against the same GPU before changing clear values. The reported native 0x7f on RTX 3080/3090 also means an unconditional 0x80 can regress real same-adapter behavior. |
|
The coordinator has now confirmed in #1548 that the castable-clear comparison is using the wrong D3D12 adapter: the same-GPU helper makes baseline main pass on RTX 5060 Ti and RX 9060 XT, while this tie-up change fails on NVIDIA because native D3D12 writes 0x7f. Please replace the unconditional clear rewrite with a same-physical-adapter host comparison in d3d12_vulkan_device_test.cpp and rerun the case; the data now points to a test-comparator bug, not a missing clear conversion. |
Flyander
left a comment
There was a problem hiding this comment.
The main blocker is now the comparator, not the conversion: the existing d3d12_vulkan_device_test clear comparison uses create_host_device() (default adapter) while the Vulkan device may be another GPU. The coordination issue reports baseline main passes with create_host_device_for_physical() on RTX 5060 Ti and RX 9060 XT, and this forced tie-up rule fails on NVIDIA where native D3D12 returns 0x7f. Please fix the host match and retest before changing clear values. The packed 10:10:10:2 coverage question is secondary until same-adapter behavior is established.
… layer's own adapter Float -> UNORM at an exact tie (0.5 * 255 = 127.5) may map to either code (D3D11.3 functional spec 3.2.3.6, 0.6 ULP tolerance). Native D3D12 gives 0x7f on NVIDIA (RTX 3080 616.64, RTX 3090 610.88; Vulkan too) and 0x80 on Radeon and WARP, so comparing the layer on NVIDIA with a host on another adapter failed the placed plain clear. The host is now the layer's own adapter (LUID, then PCI ids) unless LEONIDA_HOST_ADAPTER names one, and the output says which adapter it was and whether it is the layer's. Against a different adapter or WARP an exact tie may differ by one code; every other byte stays exact. The layer is unchanged. Measurements and review by @Rainmaker33 and @Flyander. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flyander
left a comment
There was a problem hiding this comment.
The new head removes the unconditional clear rewrite and fixes the comparator to use the Vulkan device's matching D3D12 adapter. It keeps same-adapter comparisons exact and allows only the documented one-code difference for exact UNORM ties against a different adapter/WARP. No blocking issue remains in this review.
|
AI-assisted follow-up on exact head
These runs directly verify the revised selector and comparator on the hardware from my earlier report. Existing tracking is under D3D-188 in #1548. |
|
Tested cb43923 (0 behind main) on a desktop with an AMD Radeon RDNA2 iGPU (Ryzen 7 9800X3D, 32.0.21042.62) and an RTX 5070 (617.42), where the NVIDIA card is the default DXGI adapter. That's the pairing that fails on main: with the layer on the iGPU, main's check compares it with the NVIDIA host and fails at
Full ctest ( AI-assisted (Claude Code). No game files. |
|
Tested cb43923 on NVIDIA GeForce RTX 3060 (driver 32.0.16.1714), Windows 11, MSVC 19.51, Windows SDK 10.0.26100: pass. Built AI-assisted (Claude). |
What and why
d3d12_vulkan_device_testfailed on NVIDIA at the placed castable clear (D3D-90 / #1083):placed plain clear row R byte 1/5/9/13: ours 7f, host 80. A float 0.5 clear of a UNORM channel is an exact rounding tie (0.5 * 255 = 127.5), and D3D does not pin it: the D3D11.3 functional spec, 3.2.3.6 FLOAT -> UNORM, computesc * (2^n - 1) + 0.5and drops the fraction but permits a tolerance of 0.6 ULP on the integer side, so either neighbouring code is valid. Native D3D12 gives 0x7f on NVIDIA (RTX 3080 616.64, RTX 3090 610.88, measured by @Flyander and @Rainmaker33) and 0x80 on Radeon and WARP; the layer's Vulkan path gives 0x7f on NVIDIA and 0x80 on AMD. The failure came only from comparing the layer on the NVIDIA GPU with a host device on a different adapter.The layer is unchanged. (An earlier revision of this PR changed the layer to round ties up; it is reverted, thanks to the 610.88 measurement and review.) The test changes:
LEONIDA_HOST_ADAPTERnames one, and the comparison against it is exact.Tested
Tested cb43923 on NVIDIA GeForce RTX 5070 Laptop (617.42) and AMD Radeon 880M (26.11.2), Windows 11: pass.
d3d12_vulkan_device_teston each GPU, default host andLEONIDA_HOST_ADAPTER=warp: 4/4 pass. Default host is the GPU's own adapter (exact comparison); WARP, and a Radeon host under the NVIDIA layer, take the tie tolerance on 16 bytes.LEONIDA_VK_VALIDATION=1: 87/87 pass (NVIDIA: d3d12_rgb9e5_rtv skipped), 0 VUIDs.pytest tests/test_ctest_registration.py: 3 passed.AI-assisted (Claude Code).
Checklist
🤖 Generated with Claude Code