Skip to content

Honor native RGB9E5 render-target support in the D3D12 shim - #1375

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/rgb9e5-render-target
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/rgb9e5-render-target

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as native shared-exponent render targets.

What and why

On Radeon RDNA2 the shim advertises RENDER_TARGET for R9G9B9E5_SHAREDEXP but refuses the matching committed resource and nulls its RTV. Allow a native color attachment when supported. A combined RTV/UAV requires native support for both usages. The RTX 5080 mutable R32_UINT fallback remains limited to UAV use.

Tested

Base f85582e on Windows, Radeon gfx1036 (32.0.21045.16010, Vulkan 1.4.315). The new clear case failed at CreateCommittedResource and the allocation test also failed. On 217fbf5 both pass under core and synchronization validation. A full clear to RGB (1,2,4) and a rectangle at (1,1) to (4,2,1) produced 0x94010040 and 0x91010100 respectively at all 15 expected positions. Native Windows D3D12 on the same Radeon and WARP independently produced those words. Swapping red and blue in the rectangle input failed at the predicted first texel (1,1), with 0x94010040 instead of 0x91010100.

On RTX 5080 (616.92, Vulkan 1.4.351), both native D3D12 and Leonida report no RGB9E5 render target. The focused clear test skipped and the allocation/UAV rejection test passed. The broader, unregistered clear comparison passes on Radeon and still reports three separate mismatches against WARP on RTX (RGBA8 UNORM, RGBA8 SNORM and D16). Only synthetic clear/copy/readback was exercised.

ctest --test-dir build-review/runtime -V -R "^d3d12_(rgb9e5_rtv|r9g9b9e5_uav)$"

Checklist

  • No game data, keys or decryption, including in logs or reports.
  • No translator rule changed.

AI-assisted.

Radeon advertises a color attachment for shared-exponent textures. Allow the native path to create the resource and RTV while keeping the mutable R32 UAV backing unavailable for render targets.
@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Cross-reference: #1388 proposes masking the feature bits on every adapter after reproducing the original test failure on RDNA4. I requested a native RX 9070 D3D12 query, resource creation and packed readback so we can compare RDNA4 against the measured RDNA2, WARP and RTX results.

@kapitche

Copy link
Copy Markdown
Contributor

Heads-up: #1388 changes the same R9G9B9E5_SHAREDEXP render-target reporting in d3d12_vulkan_device.cpp in the opposite direction. #1375 allows a native colour attachment when the device advertises it (Radeon RDNA2). #1388 stops ever reporting RENDER_TARGET/blend/MSAA, because the RX 9070's E5B9G9R9_UFLOAT_PACK32 advertises COLOR_ATTACHMENT and trips d3d12_r9g9b9e5_uav's line-399 check. Both can't land as they are. It looks like the d3d12_r9g9b9e5_uav expectation (from #1287) needs to decide whether native support is allowed, and then one of the two follows. Worth settling in the coordination issue.

@Rainmaker33

Copy link
Copy Markdown

Tested 217fbf5 on NVIDIA GeForce RTX 3090 (Ampere), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass, but the new native path isn't reachable on NVIDIA.

The PR's diff applied cleanly to main f85582e. VS 2022, Vulkan SDK 1.4.363.0. Runtime built with scripts\build_runtime.ps1 (CMake, RelWithDebInfo); ctest run with LEONIDA_VK_VALIDATION=1, no VUIDs.

  • d3d12_rgb9e5_rtv: "RGB9E5 render targets unavailable on this adapter". The NVIDIA Vulkan driver doesn't offer E5B9G9R9 as a colour attachment, so this run covers only the refusal path.
  • d3d12_r9g9b9e5_uav: OK, 0 validation errors. Emulated mutable R32_UINT, Support1=0x020003f1 Support2=0x000000c0, no render-target bit. UAV clears 6/6 match WARP, copies 16/16, bindless round trip 16/16.
  • ctest: 67/68. process_cmdline fails only because this base predates process shim: keep the game's command line wide so a non-ASCII argument can't crash --run (RT-84) #1350 (RT-84; this PC uses code page 1253).

#1388 changes the same CheckFeatureSupport answer the other way ("never reports render-target, blend or MSAA support"). On this GPU both PRs give the same answer, so the choice between them only matters on a GPU with native RGB9E5 attachments.

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51), as data for the #1375/#1388 conflict: d3d12_r9g9b9e5_uav passes with this branch on both the RTX 4080 SUPER and the Intel UHD 770, and the same is true of the other PR's branch. Neither driver advertises what trips the RX 9070, so these two GPUs can't tell the approaches apart. ctest on NVIDIA: all pass. The Intel failures are the known ones, plus d3d12_present on newer bases (reported in #1380).

@ItsNotRexed
ItsNotRexed merged commit 6f0b788 into ItsNotRexed:main Nov 22, 2026
11 checks passed
@kacper-serewis

Copy link
Copy Markdown
Contributor

Tested 217fbf5 merged onto current main (c2967a5) (clean merge) on RTX 5070 (Blackwell, subgroup 32..32), NVIDIA 616.56, Windows 11 Pro 26200, MSVC 19.50, Vulkan SDK 1.4.363.0: pass.

  • ctest 80/80
  • d3d12_r9g9b9e5_uav: OK (UAV clears 6/6 matched WARP, 16/16 copies, 16/16 bindless round-trip, 0 validation errors)
  • d3d12_rgb9e5_rtv: skipped. Like the RTX 5080 in the PR description, this GPU has no RGB9E5 render target, so only the rejection path is covered here

@AlxcBTW

AlxcBTW commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

A data point for D3D-158 vs D3D-160 (#1375 / #1388): d3d12_r9g9b9e5_uav fails on main on AMD.

  • Radeon 880M (RDNA3.5, driver 26.11.2, Windows 11), main at c2967a5e and later. It fails on both runs, at line 399: (fs.Support1 & D3D12_FORMAT_SUPPORT1_RENDER_TARGET) == 0. The test expects R9G9B9E5 to report no render-target support, but on this device the layer reports it.
  • RTX 5070 (617.42), same build: passes.

So on main, the behaviour behind the format answer and the test that pins it disagree on AMD. Whichever of #1375 and #1388 lands should make the test follow the device: native support reported where VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 has COLOR_ATTACHMENT, and none where it doesn't. Right now the test only passes on GPUs where the format can't be a render target. I can run either branch on the 880M if that helps.

AI-assisted (Claude Code).

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.

6 participants