Repository navigation
D3D-87: B8G8R8X8 textures (BGRA8 images, views read alpha 1, no typed UAV) - #759
Conversation
7758567 to
55e7760
Compare
quackottu
left a comment
There was a problem hiding this comment.
Tested 55e7760 on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: pass
ctest -C RelWithDebInfo: 97% tests passed, 1 tests failed out of 31d3d12_clear_test(changed here): exit=1 validation=0 | format 28 case 0 byte 2: Vulkan 7f, WARP 80d3d12_descriptor_test(changed here): exit=0 validation=0 | [rt] d3d12_xs: device slot 36 (forwarded) first calld3d12_vulkan_device_test(changed here): exit=1 validation=0 | 10 validation errors- 30 test programs in the build pass with 0 validation errors
d3d12_clear_testfails (format 28 case 0 byte 2: Vulkan 7f, WARP 80) exactly as onmain67204bf, so not from this PR: NVIDIA rounds a 0.5 UNORM clear to 0x7f, which #521 addressesd3d12_vulkan_device_testreports 10 synchronization-validation WRITE_AFTER_WRITE hazards on back-to-back copies (so ctest'sd3d12_vulkan_devicefails).main8df277f shows the same 10 here, so not from this PR: it's @guimsolutions's finding in #634, which #782 addresses
Implicit Vulkan layers (overlays) were off through an empty VK_IMPLICIT_LAYER_PATH.
|
Tested #759 at d3d12_vulkan_device_test: All host comparisons match
ctest: 31/31 PASS with Note: Exit code 1 from AI-assisted. |
|
I checked the sRGB view of B8G8R8X8_TYPELESS on The 8×8 texture stored bytes in B,G,R,X order:
All 64 sRGB texels distinguish conversion from an unconverted UNORM read, and all 64 distinguish the required alpha constant from the stored X byte. The eight one-level differences from the ideal transfer function occur identically in Vulkan and native D3D12 on this GPU. WARP matches the analytic reference on all 64 sRGB texels. The augmented runtime test passed on the RTX with core/sync validation (Windows 11 build 26200, NVIDIA 32.0.16.1692). |
Map B8G8R8X8_UNORM, _UNORM_SRGB and _TYPELESS to the B8G8R8A8 Vulkan formats, so creation, copies, footprints and clears work as for BGRA8. Shader views of the family read alpha as 1 (the T# selects one for the alpha channel), and views between the B8G8R8X8 and B8G8R8A8 typeless families are refused, although both land on the same VkFormat. Compared with the host D3D12 runtime on an RX 9060 XT: it reports no typed UAV for the family and refuses typed B8G8R8X8 textures that allow unordered access (the typeless format is accepted). The BGRA8 image would have advertised storage, so CheckFeatureSupport now leaves the typed UAV bits out, texture creation refuses typed B8G8R8X8 with ALLOW_UNORDERED_ACCESS, CreateUnorderedAccessView gives a null descriptor for the family, and its images get no storage usage. WARP writes the clear's alpha into the X byte, as Vulkan does, so clears need no change. Tests: d3d12_clear_test clears B8G8R8A8_UNORM and B8G8R8X8_UNORM against WARP; d3d12_vulkan_device_test compares B8G8R8X8 footprints, the typed UAV bits and UAV/RTV resource creation with the host runtime; d3d12_descriptor_test samples a B8G8R8X8 and a B8G8R8A8 texture with the same bytes through the bindless set (alpha 1 against the stored byte) and checks the refused views. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
List the B8G8R8X8 formats under what the Vulkan device implements: BGRA8 images whose shader views read alpha as 1, a typeless family of their own, and no typed UAV, as on the host runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55e7760 to
52204af
Compare
What:
DXGI_FORMAT_B8G8R8X8_UNORM,_UNORM_SRGBand_TYPELESSwere refused byCreateCommittedResource. They now map to theB8G8R8A8Vulkan formats, so creation, copies, footprints and clears work as for BGRA8. Shader views of the family read alpha as 1 (the T# selects one for alpha), and views between the B8G8R8X8 and B8G8R8A8 typeless families give a null descriptor. As the host runtime answers, the family has no typed UAV:CheckFeatureSupportleaves the typed UAV bits out (the BGRA8 image would have advertised them), typed B8G8R8X8 textures withALLOW_UNORDERED_ACCESSare refused (the typeless format is accepted, as on the host),CreateUnorderedAccessViewgives a null descriptor, and these images get no storage usage.Why: D3D-87 in #313 (split from D3D-61); claim: #634 (comment)
Measured on the host runtime before deciding (RX 9060 XT, AMD's Windows D3D12 driver, and WARP):
ClearRenderTargetViewon B8G8R8X8_UNORM: WARP writes the clear's alpha into the X byte, as Vulkan does in a BGRA8 image, so clears need no change.CheckFeatureSupport: B8G8R8X8_UNORM, _UNORM_SRGB and _TYPELESS report noTYPED_UNORDERED_ACCESS_VIEWand noUAV_TYPED_LOAD/STORE; B8G8R8A8_UNORM reports all three.CreateCommittedResourcewithALLOW_UNORDERED_ACCESS: E_INVALIDARG for B8G8R8X8_UNORM and _UNORM_SRGB, S_OK for _TYPELESS; withALLOW_RENDER_TARGET, S_OK for all three.Tests:
d3d12_clear_test: B8G8R8A8_UNORM (control) and B8G8R8X8_UNORM clears, full and rectangle, byte-exact against WARP.d3d12_vulkan_device_test: B8G8R8X8 footprints (mips, array, SRGB, typeless) against the host runtime; the three formats in the D3D-60 creation check; typed UAV bits and UAV/RTV resource creation compared with the host runtime.main's FORMAT_SUPPORT comparison with the host now covers the three formats as well.d3d12_descriptor_test: a B8G8R8X8_UNORM and a B8G8R8A8_UNORM texture uploaded with the same bytes (fourth byte never 255), sampled through the bindless set: same red, green, blue; alpha 1 against the stored byte. T# formats and swizzles, a typed SRGB view of the typeless resource, refused views across the two families and refused UAVs. Since D3D-81: sample A8_UNORM textures through the alpha channel #674 took the upload offsets the earlier revision used, the two textures are now uploaded past the cube array's footprints, and their views sit at the end of the slot enum.Tested:
41f4482+ this PRd3d12_clear_test: 197/197 readbacks matched WARP (189 on41f4482; the 8 new are B8G8R8A8 and B8G8R8X8)d3d12_descriptor_test: pass, the B8G8R8X8 checks included (64 texels each). With Runtime: depth-plane SRVs only on their own depth family (#678 follow-up) #767 inmain, D3D-75's depth-plane check passes on this GPU too, so no local change was needed this timed3d12_vulkan_device_test: pass; FORMAT_SUPPORT against the host: 83 formats compared (80 on41f4482), 0 mismatches.d3d12_uav_clear_test: passLEONIDA_VK_VALIDATION=1(implicit layers off): all four tests above pass with 0 validation errorsctest --test-dir runtime\build -C RelWithDebInfo: 89/89 (the same on41f4482)python -I scripts\run_gpu_tests.py: 150 translated, 150 pass spirv-val; 145/145 native wave64, 145/145 withLEONIDA_W64_EMULATE=1python -m compileall -q make_game.py tools tests,python -I make_game.py --help: pass;tests/semantic: 1338 OK;python -I tests/test_*.py: 161/161; pytest-based tests: 1184 passed, 9 skippedThe checks posted on
55e7760were on the previous base. This rebase changes no behavior, only where the descriptor test uploads its two textures and numbers their slots.Not in this PR:
main: blend factors that read destination alpha should see 1 on these formats, and what WARP leaves in the X byte after a draw isn't measured yet.AI-assisted: written with Claude Code; reviewed and tested by me.
No game data, keys or decryption involved.
🤖 Generated with Claude Code