Repository navigation
BUILD-768: views across B8G8R8X8 and B8G8R8A8 through castable-format lists - #3252
Merged
Merged
Conversation
… list (BUILD-768) A castable-format list may name the other family of a B8G8R8X8 or B8G8R8A8 texture (relaxed casting). WARP and AMD's D3D12 driver accept such lists both ways, typed and TYPELESS, and an SRV in a listed format reads by its own format: alpha 1 for B8G8R8X8, the stored byte for B8G8R8A8, and red and blue swapped when the list crosses channel orders (an R8G8B8A8 texture read as B8G8R8A8 or B8G8R8X8). The layer kept the list only as Vulkan formats, where both families are BGRA8, so it refused a view across them, and its T# took the channel order from the image's format, so a B8G8R8A8 view of an R8G8B8A8 texture read unswapped. The resource now also keeps the list as the application gave it, image_descriptor lets a view cross the families when the list names its format, the alpha swizzle follows the view's format, and a colour view in the other channel order takes its swizzle from that order (both orders share one T# format code). d3d12_descriptor_test adds a B8G8R8A8_UNORM texture listing B8G8R8X8_UNORM, a B8G8R8X8_UNORM one listing B8G8R8A8_UNORM, and two R8G8B8A8_UNORM ones listing B8G8R8X8_UNORM and B8G8R8A8_UNORM, each viewed through the listed format: T# formats and swizzles, an unlisted format refused, and the same bytes sampled through the bindless set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Say that a castable-format list naming the other family lets a view cross B8G8R8X8 and B8G8R8A8, that the view's format decides the alpha and the channel order, and that a typed B8G8R8X8 texture with unordered access and such a list is still refused, where the host accepts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Tested
|
This was referenced Nov 22, 2026
2 tasks done
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.
What: a castable-format list (
CreateCommittedResource3/CreatePlacedResource2) may name the other family of a B8G8R8X8 or B8G8R8A8 texture. The layer kept the list only as Vulkan formats, where both families are BGRA8, soimage_descriptorrefused the view. Now the resource also keeps the DXGI list, a view may cross the families when the list names its format, and the view's format decides the alpha: 1 for B8G8R8X8, the stored byte for B8G8R8A8.Measuring this found an older bug in the same function: a colour view in the other channel order, such as a B8G8R8A8 view of an R8G8B8A8 texture whose list names it, read red and blue unswapped. Both orders share one T# format code, and the swizzle came from the image's format. A colour view in the other order now takes its swizzle from its own format.
Why: BUILD-768, the second follow-up #759 / D3D-87 left out, after D3D-240; claim: #2516 (comment)
Measured on the host runtime before changing anything (RX 9060 XT with AMD's D3D12 driver, and WARP, both
RelaxedFormatCastingSupported): a 4x4 texture whose texels are bytes B,G,R,X/A = 10, 20, 30, 40, read by a compute shader through each SRV.CreateCommittedResource3returned S_OK for every list tried, sRGB variants included. A clear through a B8G8R8X8 RTV leaves the X byte different on the two (WARP 64 for UNORM and 0 for sRGB, AMD 0), so no test compares that byte.Tests:
d3d12_descriptor_test: the B8G8R8X8 block grows from two textures to six, all uploaded with the same bytes. The four new ones are B8G8R8A8_UNORM listing B8G8R8X8_UNORM, B8G8R8X8_UNORM listing B8G8R8A8_UNORM, and R8G8B8A8_UNORM listing B8G8R8X8_UNORM or B8G8R8A8_UNORM, each viewed through the listed format. The test checks their T# formats and swizzles, checks that an unlisted format (B8G8R8X8_UNORM_SRGB) stays refused, and samples them through the bindless set. They must read the colours of the table above: alpha 1 through B8G8R8X8 views, the stored byte through B8G8R8A8 views, red and blue in the view's order.line 1232: image_at(cast_bgrx_slot, ...)).line 1237: cast_rgba_image.swizzle == bgra_image.swizzle. That is the B8G8R8A8 view of an R8G8B8A8 texture, which involves no B8G8R8X8, so this second bug exists onmaintoday.Tested:
16282101+ this PRd3d12_descriptor_test,d3d12_clear_test(197/197 readbacks matched WARP),d3d12_uav_clear_test,d3d12_vulkan_device_test: pass, with and withoutLEONIDA_VK_VALIDATION=1(0 validation errors)d3d12_draw_test: 3/3 runs pass, and 3/3 with validationctest --test-dir runtime\build -C RelWithDebInfo: 129/129, the same withLEONIDA_VK_VALIDATION=1python -I scripts\run_gpu_tests.py: 194 translated, 194 pass spirv-val; 175/189 pass and 14 skip, native wave64 and withLEONIDA_W64_EMULATE=1python -m compileall -q make_game.py tools tests,python -I make_game.py --help: pass;tests/semantic: 4142 OK; pytest-based tests: 1479 passed, 16 skipped;python -I tests/test_*.py: 222/223.test_report_paths.pyfails its macOS case-sensitive-volume test on this Windows machine, and this PR changes no Python file.Not in this PR:
ALLOW_UNORDERED_ACCESSand a list naming B8G8R8A8: the host accepts it, and the layer still refuses it. Accepting it needs storage usage on the image and B8G8R8A8 UAV views of a B8G8R8X8 texture.AI-assisted: written with Claude Code; reviewed and tested by me.
No game data, keys or decryption involved.
🤖 Generated with Claude Code