Repository navigation
Runtime: RTVs in a castable-format list's other channel order - #3781
SpositoDouglas wants to merge 4 commits into
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Tested ce95df0d on Windows 11, MSVC 19.44.35228, RTX 5070 Ti, Vulkan SDK 1.4.363.0. Build needed -DBUILD_TESTING=ON -DLEONIDA_BUILD_WINDOWS_RUNTIME=ON; all four targets linked cleanly.
- ctest
^(d3d12_clear|d3d12_descriptor|d3d12_draw|typeless_rtv)$-> 3/3 matched, 3 passed, 0 failed. At this commit thed3d12_clearentry isd3d12_rgb9e5_rtv(d3d12_clear_test --rgb9e5), which skipped (exit 77) because RGB9E5 render targets are unavailable on this adapter. typeless_rtv_test-> exit 0, 100 scenarios passed, including the new cross-order accepts and the 3 rejects.d3d12_descriptor_test-> exit 0, 20/20 checks, includingB8G8R8X8alpha 1 through a castable-format list (64 texels each).d3d12_draw_test-> exit 0, castable RTVs 8 draws in the view's channel order/encoding; MSAA 4096/4096 and M1 4096/4096.d3d12_clear_testwith no args -> exit 1, 13 formats differ from WARP vs 5 on base16282101(same build/config): all are the pre-existing NVIDIA 0.5-UNORM tie at case-0 byte 0/2 (7fvs80), plus one depthff/00; the PR adds 8 instances of the same tie, no new failure class. CMake keeps this differential test out of ctest until the tie lands.
The castable-order behavior is positively covered by the typeless/draw/descriptor tests; no blocker from me.
|
Tested ce95df0 merged onto main f847748 (clean merge) on Windows 11 build 26300, MSVC 19.44, Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, on two GPUs picked by
On NVIDIA, the castable cases hit the tie rounding that #521 handles; I didn't merge the two to check that its rounding reaches the castable views. The listed-RTV check ( The UHD 770 sRGB cases.
So on this GPU the layer writes what Intel's own driver writes. A byte-for-byte comparison of sRGB colour channels against WARP can't pass on Intel. NVIDIA's native D3D12 with castable lists ( AI-assisted (Claude Code). Native probes made with |
A castable-format list may name an R8G8B8A8 texture's B8G8R8A8 formats, or the reverse, or cross B8G8R8X8 and B8G8R8A8. WARP and AMD's D3D12 driver store a clear or a draw through an RTV in a listed format in the view's channel order and encoding: an R8G8B8A8 texture cleared to (0.2, 0.4, 0.6, 0.25) through a B8G8R8A8 RTV holds 153, 102, 51, 64. CreateRenderTargetView refused such an RTV on an R8G8B8A8 texture, so the clear failed Close and draws were dropped, and a typed B8G8R8A8 texture's RTV kept the image's format whatever the view named, so its clears came out in BGRA order and without the sRGB encoding. An RGBA8 or BGRA8 UNORM/SRGB texture (B8G8R8X8 included) now gets an RTV in another of these formats when its list, as the application gave it, names that format, and color_view_format lets a castable image's clear cross between the two channel orders. Draws already used the PSO's format for the attachment view. A format the list doesn't name stays refused; a typed B8G8R8A8 texture without a list keeps ignoring the RTV's format, as before. d3d12_clear_test compares 8 such textures with WARP in full and rectangle clears (the X byte of an X8 view left out: WARP and AMD write different values there) and checks that 3 unlisted formats get no RTV; d3d12_draw_test draws through the same views; typeless_rtv_test checks the replay's crossing and its refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Say that an RGBA8 or BGRA8 texture whose castable-format list names the RTV's format in the other channel order, or across B8G8R8X8 and B8G8R8A8, gets an RTV in that format and stores clears and draws in the view's order and encoding, as the host does; what was wrong before; and that a typed B8G8R8A8 texture without a list still ignores the RTV's format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The castable cases in d3d12_clear_test compared each byte with WARP exactly. Drivers round the 0.5 tie differently (WARP stores 128, NVIDIA 127), and Intel's driver encodes sRGB 1 off WARP in places, where its own D3D12 driver stores the same bytes as the layer (measured on a UHD 770 and an RTX 4070 SUPER in the review of this change). Compare within 1, as the castable draws in d3d12_draw_test do: a wrong channel order or a missing sRGB encoding is many steps off, so the cases still catch what they test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ce95df0 to
9c2eaaa
Compare
|
Thanks @CowBoYdu76 and @Kam471 for testing on NVIDIA and Intel.
Retested at the new head on an RX 9060 XT (AMD 26.11.2): |
|
PASS, with one pre-existing gap now left asymmetric. The remap covers RGBA8/BGRA8/B8G8R8X8 in UNORM and SRGB, both directions; UINT/SNORM/typeless are untouched; a replay crossing requires The gap: a typed B8G8R8A8/B8G8R8X8 texture with a list silently keeps the resource format for an RTV format the list does not name (e.g. unlisted sRGB) instead of refusing - AI-assisted review, no game files, no GPU. |
|
Tested 9c2eaaa on AMD Radeon(TM) Graphics (gfx1036, driver 26.10.1) and NVIDIA GeForce RTX 5080 (driver 616.92), Windows 11, MSVC RelWithDebInfo: |
A typed B8G8R8A8 or B8G8R8X8 texture with a castable-format list took an RTV in a format the list doesn't name (its own sRGB format, say) and silently kept the image's format, where a typed R8G8B8A8 texture with a list refuses it. CreateRenderTargetView now refuses it for these textures too; without a list they keep the image's format, as before. d3d12_clear_test's negative check covers a B8G8R8A8 texture listing R8G8B8A8 and a B8G8R8X8 one listing B8G8R8A8 next to the R8G8B8A8 one: each takes its own and its listed format and refuses 3 formats its list doesn't name. Without the shim change it fails on the B8G8R8A8 texture's unlisted B8G8R8A8_UNORM_SRGB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @tupacfan04, you're right: a typed B8G8R8A8 or B8G8R8X8 texture with a list kept the image's format for an RTV format the list doesn't name, so the doc's "stays refused" was only true for R8G8B8A8 textures. New commit: Thanks @Vonsek too for running Retested on an RX 9060 XT (AMD 26.11.2): |
|
Tested 1e0b4cd on NVIDIA RTX 4080, driver 610.88, Windows 11: pass This is the head after
Review: no findings. AI-assisted. |
|
Tested 1e0b4cd on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran AI-assisted. |
Claimed in the coordination issue as: RTVs through a castable-format list in another channel order or family (the RTV half BUILD-768 left out; no item ID in the table yet), claim: #3381 (comment)
Depends on: #3252 (merged); this branch is rebased on
main.What and why
A castable-format list may name an R8G8B8A8 texture's B8G8R8A8 formats, or the reverse, or cross B8G8R8X8 and B8G8R8A8. WARP and AMD's D3D12 driver store a clear or a draw through an RTV in a listed format in the view's channel order and encoding. The layer got this wrong in two ways:
CreateRenderTargetViewrefused an RTV in a listed B8G8R8A8, B8G8R8A8_SRGB or B8G8R8X8 format: the clear madeClosefail, and draws through it were dropped without an error.Now an RGBA8 or BGRA8 UNORM/SRGB texture (B8G8R8X8 included) gets an RTV in another of these formats when its castable list, as the application gave it (
lists_castable_formatfrom #3252), names that format.color_view_formatlets a castable image's clear cross between the two channel orders. A format the list doesn't name is refused, on typed B8G8R8A8 and B8G8R8X8 textures as on R8G8B8A8 ones (the BGRA8 ones kept the image's format before), and UINT, SNORM and the other families are unchanged.A typed B8G8R8A8 texture without a list still ignores the RTV's format, as before. Refusing it would also refuse, for example, sRGB RTVs of swap-chain buffers.
Measured on the host before changing anything (WARP and an RX 9060 XT with AMD's D3D12 driver; both agree): a 4x4 texture cleared to (0.2, 0.4, 0.6, 0.25), then its 2x2 centre cleared to (0.9, 0.7, 0.5, 0.75) or drawn with (0.8, 0.6, 0.4, 0.3).
Where two values are given, WARP stores 230 and AMD 229. The X byte after a clear or a draw through an X8 RTV differs between the two (WARP 64 after a clear and 0 after a draw, AMD 0 and 76), so no test compares it.
Tested
main4c52ce27+ this PR.d3d12_clear_test: 8 textures with a castable list (the cases above plus B8G8R8A8_UNORM {B8G8R8A8_UNORM_SRGB}) are cleared through the listed RTV, full and with a rectangle, and compared with WARP within 1 (drivers round the 0.5 tie differently, and Intel's encodes sRGB 1 off WARP in places; a wrong channel order is many steps off), the X byte of an X8 view left out. A new check makes R8G8B8A8_UNORM {B8G8R8A8_UNORM}, B8G8R8A8_UNORM {R8G8B8A8_UNORM} and B8G8R8X8_UNORM {B8G8R8A8_UNORM} textures: each takes an RTV in its own and its listed format, and 3 formats its list doesn't name leave the descriptor empty. With that shim change reverted, the B8G8R8A8 one takes an RTV in its unlisted B8G8R8A8_UNORM_SRGB. 229/229 readbacks matched WARP.d3d12_draw_test: an opaque full-screen draw through the same 8 views; each must store (0.8, 0.6, 0, 1) in the view's order and encoding (within 1). 3/3 runs pass, and 3/3 with validation.typeless_rtv_test: the replay clears a castable RGBA8 image through BGRA8 UNORM/SRGB views and the reverse through attachment views. It refuses the other order for a typed image without a list, a typeless RGBA8 image and a castable RGBA8_UINT image.typeless_rtv_testfails at the first crossing,d3d12_clear_testat the listed RTV, andd3d12_draw_testreads 0, 0, 0, 0 for R8G8B8A8 {B8G8R8A8}.d3d12_descriptor_test,d3d12_uav_clear_test,d3d12_vulkan_device_test: pass. They andd3d12_clear_testpass withLEONIDA_VK_VALIDATION=1too (0 validation errors).ctest --test-dir runtime\build -C RelWithDebInfo: 153/153, the same withLEONIDA_VK_VALIDATION=1.run_gpu_tests.pywere not rerun for this PR (they passed on BUILD-768: views across B8G8R8X8 and B8G8R8A8 through castable-format lists #3252's head).Not in this PR: a typed B8G8R8X8 texture with
ALLOW_UNORDERED_ACCESSand a list naming B8G8R8A8, which the host accepts and the layer still refuses (the other follow-up #3252 names).Checklist
docs/design.md, with how it was confirmed. (No translator change.)AI-assisted: written with Claude Code; reviewed and tested by me.
No game data, keys or decryption involved.
🤖 Generated with Claude Code