Skip to content

d3d12: R9G9B9E5_SHAREDEXP never reports render-target, blend or MSAA support - #1388

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Dom-in:r9g9b9e5-no-render-target
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Dom-in:r9g9b9e5-no-render-target

Conversation

@Dom-in

@Dom-in Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1380 (comment)

What and why

d3d12_r9g9b9e5_uav (added in #1287) fails on main on an AMD Radeon RX 9070 (RDNA4, AMD 26.11.2) at line 399: (fs.Support1 & D3D12_FORMAT_SUPPORT1_RENDER_TARGET) == 0.

  • This driver's VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 advertises COLOR_ATTACHMENT and COLOR_ATTACHMENT_BLEND (from vulkaninfo --show-formats), as well as storage.
  • CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) in runtime/shims/d3d12_vulkan_device.cpp turned those into RENDER_TARGET, BLENDABLE and the multisample bits.
  • D3D12 never offers DXGI_FORMAT_R9G9B9E5_SHAREDEXP as a render target, which is exactly what the test pins. So on any GPU whose Vulkan driver can render to E5B9G9R9, the layer answered differently from the PC runtime.

For that format, the change clears RENDER_TARGET, BLENDABLE, DEPTH_STENCIL, MULTISAMPLE_RENDERTARGET, MULTISAMPLE_RESOLVE and MULTISAMPLE_LOAD after the Vulkan-derived bits are assembled. Everything else, including the native or emulated UAV support, is unchanged.

Not changed here: CheckFeatureSupport(MULTISAMPLE_QUALITY_LEVELS) and resource creation with ALLOW_RENDER_TARGET for this format. Both may also need the same rule; I didn't measure them against the host.

Tested

Windows 11 Pro 26300, MSVC 14.44, AMD Radeon RX 9070, AMD 26.11.2, on f85582e2:

d3d12_r9g9b9e5_uav_test full ctest
main exit 1, line 399: ... RENDER_TARGET) == 0 66/67
this PR R9G9B9E5 UAV mode: native (Support1=0x020003f0 Support2=0x00000080), OK (0 validation errors) 67/67

AI-assisted (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: runtime only)

🤖 Generated with Claude Code

@Vonsek

Vonsek commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

@Dom-in, I reproduced the same original assertion on another Radeon, then checked the native Windows D3D12 device. On gfx1036 (1002:13c0, driver 32.0.21045.16010), native CheckFeatureSupport reports RENDER_TARGET for DXGI_FORMAT_R9G9B9E5_SHAREDEXP. Native CreateCommittedResource(ALLOW_RENDER_TARGET), CreateRenderTargetView, full clear, partial clear, CopyTextureRegion and readback all work: nine outer texels were 0x94010040 and six rectangle texels were 0x91010100. WARP independently matched all 15. Native RTX 5080 (10de:2c02, 616.92) did not advertise RTV support. The native format query and 15-texel fixture and results are available.

At 1040841 this PR masks the feature bits on every device; #1375 allows the actual single-sample native-color-attachment path and keeps the RTX mutable UAV case out of the RTV path. Hard-coding RENDER_TARGET off would hide functionality that native D3D12 exposes on the tested Radeon. Could you run the following on your RX 9070 using a hardware IDXGIAdapter from EnumAdapters1 passed to Windows D3D12CreateDevice? Please report both native Support1/Support2 words, sample-count-1 RTV resource creation, and the two packed colors from the linked check_shared_exponent_target(nativeDevice). The Radeon 9070 Vulkan flags alone do not settle its D3D12 result. I have not measured native blend or multisample behavior on the RX 9070.

Additional native measurements on this machine (D3D12CreateDevice per adapter, identical 16×16 ALLOW_RENDER_TARGET resource at each sample count): gfx1036 reports Support1=02e8d3f0, Support2=000002c0; 1x/2x/4x/8x each returned one quality level and resource creation S_OK; 16x returned zero and E_INVALIDARG. WARP (02ecd3f1/000002c0) succeeded through 16x. RTX 5080 (008013f0/00000200) refused all five RTV creations, including 1x. I only measured pixel readback at 1x. Multisample resource support would be a separate change from #1375.

…support

D3D12 doesn't render to the shared-exponent format, but AMD's RDNA4 Vulkan driver (26.11.2) gives
E5B9G9R9_UFLOAT_PACK32 COLOR_ATTACHMENT and COLOR_ATTACHMENT_BLEND, and CheckFeatureSupport(FORMAT_SUPPORT)
passed them through as RENDER_TARGET, BLENDABLE and the multisample bits. d3d12_r9g9b9e5_uav (ItsNotRexed#1287) failed
on an RX 9070 at its RENDER_TARGET == 0 check. The format's render-target, blend, depth-stencil and
multisample bits are now cleared whatever the driver advertises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Dom-in
Dom-in force-pushed the r9g9b9e5-no-render-target branch from 1040841 to 495910e Compare November 22, 2026 10:58
@kapitche

Copy link
Copy Markdown
Contributor

Heads-up: #1375 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 1040841 on NVIDIA GeForce RTX 3090 (Ampere), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

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.

Note that #1375 goes the other way and reports native RGB9E5 render-target support where the device has it. On this NVIDIA GPU there is none, so both give the same answer here.

@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).

@zneel

zneel commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@Vonsek, here is the native RDNA4 measurement you asked for, on an RX 9070 XT (1002:7550), AMD 26.11.2 (UMD 32.0.32029.2010), Windows 11 Pro 10.0.26300. I used a standalone probe: a hardware IDXGIAdapter1 from EnumAdapters1 passed to Windows D3D12CreateDevice, plus WARP from the same factory. Its clear/readback is the 5x3 fixture from check_shared_exponent_target (full clear RGB 1,2,4, then rect {1,1,4,3} RGB 4,2,1), copied to a readback buffer and compared packed.

native D3D12 RX 9070 XT WARP
Support1 / Support2 0x02e8d3f0 / 0x000102c0 0x02ecd3f1 / 0x000002c0
RENDER_TARGET, BLENDABLE, MULTISAMPLE_RENDERTARGET, UAV_TYPED_STORE 1, 1, 1, 1 1, 1, 1, 1
16x16 ALLOW_RENDER_TARGET resource, 1x / 2x / 4x / 8x S_OK each, 1 quality level each S_OK each, 1 quality level each
same at 16x 0 quality levels, E_INVALIDARG 1 quality level, S_OK
1x RTV full + rect clear, packed readback 15/15: 9 x 0x94010040, 6 x 0x91010100 15/15

So the RDNA4 native driver behaves like your gfx1036 numbers: it reports and renders RGB9E5 render targets. Support1 is identical, and Support2 differs only by bit 16 (0x10000).

Leonida, both heads built from source in a separate worktree (MSVC 14.51, Ninja, RelWithDebInfo):

d3d12_r9g9b9e5_uav d3d12_rgb9e5_rtv full ctest
#1375 217fbf51 OK, native, Support1=0x0264c3f0 Support2=0x00000080, 0 validation errors full + rect clears match all 15 packed texels 68/68 (gameinput disabled)
#1375 with LEONIDA_VK_VALIDATION=1 OK, 0 validation errors pass not run
#1388 495910e1 OK, native, Support1=0x020003f0 Support2=0x00000080 not in this branch not run

Both branches pass their own tests on this card. On this hardware, though, #1388's layer reports no RENDER_TARGET, while the native D3D12 driver on the same adapter reports it and renders the format correctly. #1375 matches the native answer. Blend and MSAA through the layer weren't measured. Natively the driver reports both, with RT resources at up to 8x.

The probe is synthetic (no game data); I can attach its source if useful. AI-assisted (Claude Code); I checked the results.

@ItsNotRexed
ItsNotRexed merged commit 89f1d25 into ItsNotRexed:main Nov 22, 2026
9 of 10 checks passed
@kacper-serewis

Copy link
Copy Markdown
Contributor

Tested 495910e 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 79/79; d3d12_r9g9b9e5_uav: OK (6/6 UAV clears matched WARP, 0 validation errors)

Same result on main (c2967a5): this GPU doesn't offer E5B9G9R9 as a render target, so only an RGB9E5-renderable GPU (AMD) can show the change. #1375 touches the same RGB9E5 support answer.

@Dom-in

Dom-in commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

@Vonsek, @zneel: thanks for measuring the native driver. You're right, and my premise here was wrong: AMD's native D3D12 reports and renders R9G9B9E5 render targets. This PR merged after #1375 and its mask overrides it. On AMD d3d12_r9g9b9e5_uav now fails on main and d3d12_rgb9e5_rtv is skipped. #1466 removes the mask: both pass on an RX 9070 and ctest is 82/82. AI-assisted (Claude Code).

@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.

8 participants