Repository navigation
RT-303: typed B8G8R8X8 textures with unordered access through a castable-format list - #4581
Open
SpositoDouglas wants to merge 3 commits into
Open
SpositoDouglas wants to merge 3 commits into
SpositoDouglas wants to merge 3 commits into
Conversation
…the host does (D3D-466) Typed R8G8B8A8_UNORM_SRGB, B8G8R8A8_UNORM_SRGB, D32_FLOAT and D16_UNORM have no UAV view in D3D12 without a castable-format list, so their UAV-flagged images no longer get VK_IMAGE_USAGE_STORAGE_BIT, which these Vulkan formats lack. The host creates them; the layer refused them (sRGB on NVIDIA, all four on AMD). The test this adds also showed what the storage bit had been refusing by chance: the host refuses unordered access on D24_UNORM_S8_UINT and D32_FLOAT_S8X24_UINT, and any volume texture in a depth format (with or without flags). Both are now refused explicitly, in creation and GetResourceAllocationInfo alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able-format list A typed B8G8R8X8 texture with ALLOW_UNORDERED_ACCESS is valid on the host when its castable-format list names a format with a typed UAV (B8G8R8A8_UNORM, R8G8B8A8_UNORM, R8G8B8A8_UINT, R32_UINT): WARP and AMD's D3D12 driver create it, committed or placed, and refuse it without a list or with one naming only sRGB or B8G8R8X8 formats. Through a B8G8R8A8_UNORM UAV both drivers store the alpha in the X byte, byte for byte alike. The layer refused every such texture in texture_format and every UAV view of the family. texture_format and allocation now take whether the list names a format with a typed UAV; the BGRA8 image then gets storage usage, with mutable format and extended usage so a B8G8R8X8_UNORM_SRGB texture's sRGB image need not take storage writes itself, and bind_image keeps that image's views in formats without storage to sampling. CreateUnorderedAccessView takes a listed B8G8R8A8_UNORM or one-channel 32-bit format. A UAV in B8G8R8X8, in an unlisted format, or in the other channel order stays refused: the bindless set's storage view takes the image's order, so an R8G8B8A8 UAV would store red and blue swapped. d3d12_vulkan_device_test creates ten such textures, committed and placed, and compares the answers with the measured ones and the host's; checks which UAV views get a descriptor; and clears through a B8G8R8A8_UNORM UAV (float, uint, and a float rectangle over the uint clear), comparing the bytes, the X byte included, with the measured ones and the host's. It skips where BGRA8 has no storage images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Say that a typed B8G8R8X8 texture allows unordered access when its castable-format list names a format with a typed UAV, as on WARP and AMD's D3D12 driver; how the layer creates its image and which UAV views it takes; and what is left: UAVs in the other channel order, shader stores through these views (only clears are checked), and GPUs whose BGRA8 has no storage images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Verified PR #4581 on Windows 11 (25H2
Change looks solid: AI-assisted (Gemini, Antigravity). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: RT-303 (claim: #4421 (comment))
Depends on: #4493 (D3D-466). This branch is built on its commit, which shows here until #4493 merges; the two commits of this PR are the last two. It uses the
castable_listargument #4493 givesTextureCreateInfo.What and why
A typed B8G8R8X8 texture with
ALLOW_UNORDERED_ACCESSis valid on the host when its castable-format list names a format with a typed UAV. The layer refused every such texture (texture_format) and every UAV view of the family (CreateUnorderedAccessView). This is the follow-up #3252 named.Now:
texture_formatandallocationtake whether the list names a format with a typed UAV, committed and placed.lists_typed_uav_formatcounts the formatsCheckFeatureSupportreports withTYPED_UNORDERED_ACCESS_VIEW: a typed colour format, not sRGB, depth or B8G8R8X8, whose image can take storage writes.bind_imagekeeps that image's views in formats without storage to sampling (VkImageViewUsageCreateInfo).CreateUnorderedAccessViewtakes a UAV in a listed B8G8R8A8_UNORM or one-channel 32-bit format.Still refused: a UAV in B8G8R8X8 itself, in a format the list doesn't name, and in the other channel order (R8G8B8A8_*). The last one because the bindless set's storage view takes the image's channel order (
bind_image,vulkan_view_format), and the translator'simage_storewrites the components in order, without the T#'s DST_SEL, so an R8G8B8A8 UAV of the BGRA8 image would store red and blue swapped. Whether the console applies a T#'s swizzle to image stores isn't measured. The same question applies onmainto an R8G8B8A8 texture with a B8G8R8A8 UAV through a list, which this PR doesn't touch.Measured on the host before changing anything:
CreateCommittedResource3withALLOW_UNORDERED_ACCESS, on WARP and on an RX 9060 XT with AMD's D3D12 driver (26.11.2). The two answer identically, byte for byte.Through a UAV in the listed format, with every texel starting as bytes 10, 20, 30, 40:
ClearUnorderedAccessViewFloat, same valueClearUnorderedAccessViewUint(0x11, 0x22, 0x33, 0x44)The alpha lands in the X byte, the same on both drivers. A texel the store doesn't touch keeps its bytes.
Tested
main03b09a08+ d3d12: sRGB and depth-only textures with unordered access created as the host does (D3D-466) #4493 + this PR.d3d12_vulkan_device_test, new block:ctest --test-dir runtime\build -C RelWithDebInfo: 154/154, the same withLEONIDA_VK_VALIDATION=1.d3d12_vulkan_device_test,d3d12_clear_test,d3d12_descriptor_test,d3d12_uav_clear_test,d3d12_r9g9b9e5_uav_test,typeless_rtv_test: pass, with and without validation, with no validation messages.run_gpu_tests.pywere not rerun.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