Skip to content

D3D-68: verify B5G5R5A1 shader sampling and odd-width footprints - #617

Closed
VictorJulianiR wants to merge 5 commits into
ItsNotRexed:mainfrom
VictorJulianiR:codex/d3d12-b5g5r5a1-sampling
Closed

VictorJulianiR wants to merge 5 commits into
ItsNotRexed:mainfrom
VictorJulianiR:codex/d3d12-b5g5r5a1-sampling

Conversation

@VictorJulianiR

@VictorJulianiR VictorJulianiR commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Depends on: #562 (merged).

D3D-68, claimed on the coordination board. Current main already maps B5G5R5A1_UNORM and copies it at two bytes per texel. The remaining diff adds sampling and odd-width footprint tests, and documents the sampled alpha behavior. It changes no runtime code.

The descriptor test uploads four packed words, including red with and without alpha, and checks all four channels after sampling through the bindless set. It reuses the existing B4 upload and view after a fence. The WARP footprint case covers a 13×7 texture, four mip levels, two layers and two base offsets.

  • On the refreshed head 5e55015, Windows Server 2022, MSVC and Mesa 26.3.1 llvmpipe with validation enabled, all 64 B5G5R5A1 samples matched. The B4, RGBA8, RGB9E5, fallback and border checks passed. Forcing alpha on the transparent-red input failed the intended assertion. Standalone run.
  • On the latest commit e36f74f, MSVC reported zero C4456 warnings in the descriptor test after renaming the three per-format locals. The B4 and B5 readbacks still matched 64 texels each, the alpha control failed as expected, and both footprint and tiling comparisons returned zero mismatches. Windows verification.
  • Native D3D11 WARP matched the four expected sample patterns. A separate precision control still differs for 0xc118: WARP packs blue to 197, while the standalone Vulkan path on llvmpipe packs it to 198. The committed mixed-channel word 0xc117 produces (132, 66, 189, 255) on both. Native readback · Direct Vulkan precision control.
  • An automatic merge with D3D-81: sample A8_UNORM textures through the alpha channel #674 passed the B5 and A8/R8 sampling checks together. WARP footprint and tiling comparisons had zero mismatches on main and on both candidates. The full device test still exits 1 on all three trees at the later resolve comparison: this runner's host command list lacks ID3D12GraphicsCommandList7. Combined run · Unmodified main.

AI-assisted. All inputs were synthetic. The hosted readbacks used Windows software adapters.

@VictorJulianiR VictorJulianiR changed the title D3D-61: support B5G5R5A1 sampled textures and copy footprints D3D-68: support B5G5R5A1 sampled textures and copy footprints Nov 22, 2026
@evilclanker9000

Copy link
Copy Markdown
Contributor

Dependency update: #562 now includes main c432cdc at f5f4cb0. Main added the UINT-border probe, which owns SRV slot 0. The updated RGB9E5 test uses the released cube's slot 6 and its existing upload offset 4096. Both the 64 RGB9E5 texels and all three border results (0, 1, 255) passed together on RTX 5080. When merging the updated #562 into #617, please keep RGB9E5 at 6, the UINT view at 0 and B5G5R5A1 at 8, with all three fixtures' uploads/barriers. A trial merge with 008560e reports conflicts in the device format table and the descriptor test.

#610 also supplies the same B5G5R5A1 resource and copy mappings. The sampled-alpha check here remains independent of its byte-copy cases. The landing-order note on #610 applies to those two switch labels if that PR lands first.

@VictorJulianiR

Copy link
Copy Markdown
Contributor Author

@Vonsek, #617 now includes your f5f4cb0 rebase at 0175e92. The UINT view stays at slot 0, RGB9E5 at the released cube slot 6, and B5G5R5A1 at slot 8. The hosted run matched all 64 texels per format and read 0, 1 and 255 from the three border sampler cases with validation enabled. Thanks for checking the combination on the RTX 5080. Updated Windows result

@troythedecoyx

Copy link
Copy Markdown
Contributor

Tested 0175e92 merged onto main c432cdc on NVIDIA GeForce RTX 4060 Ti (Ada), driver 32.0.16.2124 (NVIDIA 621.24), Windows 11 Home 26300, MSVC 2022 / Ninja, Vulkan SDK 1.4.363: pass.

Besides ctest, I ran each test program this PR changes directly (several aren't registered with ctest):

  • d3d12_descriptor_test: exit 0
  • d3d12_vulkan_device_test: exit 0

ctest: 100% tests passed, 0 tests failed out of 27.

AI-assisted.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 0175e92 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass

No game files used. AI-assisted run (Claude Code).

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
#617 and #694 each added the B5G6R5 and R9G9B9E5 cases to the DXGI format map and the copy block table, so the
switch statements had duplicate labels and the Vulkan device tests no longer compiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matheuskshn

Copy link
Copy Markdown
Contributor

Checked the packed fixture arithmetic at 6e1e5c5. Decoding bits 10:14, 5:9, 0:4 and 15, then scaling to bytes, reproduces all four expected RGBA values. The two red words confirm that only alpha changes, and 0x83e1 distinguishes the green and blue fields. This was an independent CPU calculation of the oracle values, without a Vulkan run. AI-assisted.

@AC-Storm-YT

Copy link
Copy Markdown
Contributor

@VictorJulianiR heads-up for the rebase: main now has a B4G4R4A4 block (D3D-61, from @ismailchaka1, around d3d12_descriptor_test.cpp line 675) that declares its own packed_desc / packed / packed_placed inside a { } scope. On current main they shadow the RGB9E5 ones at line 573, and MSVC /W4 reports three C4456 warnings (VS 2026). Your change removes the outer declarations, so the warnings should go away with it. The B4G4R4A4 block might also fit your stage_packed helper while you're in there.

AI-assisted (Claude Code).

@VictorJulianiR VictorJulianiR changed the title D3D-68: support B5G5R5A1 sampled textures and copy footprints D3D-68: verify B5G5R5A1 shader sampling and odd-width footprints Nov 22, 2026
@AC-Storm-YT

Copy link
Copy Markdown
Contributor

Tested 5e55015 on an RX 9070 XT (RDNA4, driver 32.0.31041.1004), Windows 11, VS 2026, Vulkan SDK 1.4.363.1.

  • Correction to my note above: after the rebase the RGB9E5 packed / packed_desc / packed_placed (line 572) stay, so the B4G4R4A4 block's names at 686–692 still shadow them. MSVC /W4 still reports the three C4456 warnings. Renaming the inner three (e.g. b4_desc / b4 / b4_placed) would clear them.
  • d3d12_descriptor_test exits 1 at line 548 (depth_image.format == g::format_from_vulkan(depth_vk)), with and without validation. Current main fails the same way on this GPU, so it's not this PR: AMD has no native D24, and @Derpbeat claimed that follow-up to Runtime: depth-plane shader-resource views of depth-stencil textures #678 on Coordinating who works on what (3) (moved to #1006) #634. The test stops before the B5G5R5A1 samples, so this GPU couldn't check them.
  • d3d12_vulkan_device_test passes with LEONIDA_VK_VALIDATION=1; ctest 29/29.

AI-assisted (Claude Code).

@VictorJulianiR

Copy link
Copy Markdown
Contributor Author

@AC-Storm-YT, e36f74f renames the three locals in the B4/B5 loop. The earlier Windows build reproduced all three C4456 diagnostics. On the new commit MSVC reported zero in this file, and the B4 and B5 readbacks each matched 64 texels. I have kept the RX 9070 XT result scoped to the device test since the earlier D24 assertion prevented B5 sampling on that adapter. Thanks for reporting where it stopped. Windows result and alpha control.

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
@VictorJulianiR

Copy link
Copy Markdown
Contributor Author

D3D-68 landed via the maintainer's merge of the tested 5e55015 revision. On unmodified main 8df277f, the descriptor test again matched all 64 B5 texels and all 64 B4 texels with Vulkan validation enabled. The separate full device executable stopped later at the host shader-model/root-signature comparison. Stock Windows run.

I am closing this PR because its only remaining delta renames three locals. @ismailchaka1 already owns that cleanup in #765 (TEST-106). The loop on main now handles B4 and B5; e36f74f is the standalone three-name change against that shared loop, available to reuse. MSVC warning and sampling check.

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
@JavierBlanco23

Copy link
Copy Markdown
Contributor

Tested #617 at e36f74f on Windows 11, RTX 5080 (Blackwell), driver 616.56, Vulkan 1.4.x, MSVC 19.44.

d3d12_vulkan_device_test: All host comparisons match

  • Copy comparison: 0/69 cases differ (known BC mip differences documented)
  • MSAA quality: 12 compared, 8 skipped, 0 mismatches
  • Resolve: 60/60 matched, 10 skipped
  • WriteToSubresource/ReadFromSubresource: both paths matched

ctest: 29/29 PASS with LEONIDA_VK_VALIDATION=1

Note: Exit code 1 from d3d12_vulkan_device_test with validation due to 1 pre-existing ReShade layer load error, not from this PR.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants