Skip to content

D3D12.X: promote R9G9B9E5_SHAREDEXP render/UAV targets to R11G11B10_FLOAT - #605

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
0x6461726B:d3d12x-r9g9b9e5-target
Nov 24, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
0x6461726B:d3d12x-r9g9b9e5-target

Conversation

@0x6461726B

@0x6461726B 0x6461726B commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

In Xbox Series S (lockhart) mode, a retail title creates a 1920x1080 render target / UAV (ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS, flags 0x300005) with DXGI_FORMAT_R9G9B9E5_SHAREDEXP (67) during startup. PC D3D12 forbids render-target and UAV flags on format 67 and fails CreatePlacedResourceX with E_INVALIDARG (0x80070057), crashing the title (0x80000003) before presenting frames.

Promoting format-67 resources with RT/UAV flags and their RTV/UAV/SRV views to DXGI_FORMAT_R11G11B10_FLOAT (26, same 32 bpp unsigned HDR float with full PC RTV/UAV/SRV support), while keeping sampled-only format-67 textures as format 67, unblocks Series S startup without changing Anaconda behavior.

What is in it

  • Promote format 67 to 26 in pc_resource_desc when ALLOW_RENDER_TARGET or ALLOW_UNORDERED_ACCESS (flags & 5 != 0) is set, and map 67 => 26 in pc_target_format and (26, 67) => 26 in pc_shader_view_format (crates/xcl/src/hle/d3d12x/device_x.rs), plus unit test cases in console_depth_buffers_and_their_views_are_the_pcs.

Tested

  • Hardware & OS: NVIDIA GeForce RTX 2060 (driver 32.0.16.2135), Intel Core i5-10400F, Microsoft Windows 11 Pro (Build 26300), rustc 1.100.0 (0ef1bc386 2026-11-09)
  • cargo test --workspace -- --test-threads=4 (debug): 684 passed, 0 failed, 41 ignored
    • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
  • Series S (lockhart) smoke run (retail title, 60 s, release): main crashed at startup (exit: 0x80000003, 2 crashes, no frame count logged); this branch ran the full 60 s with exit: 0x0, 916 frames shown (PresentX 916), 0 crashes, 0 device removals.

Regression run

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: NVIDIA GeForce RTX 2060
title: 2c508222
seconds: 60
exit: 0x80000003
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 60 58 27
device removals: 0
crashes: 2
peak commit: 15460 MB
xcl-smoke v1
commit: c3d350a5729d7559d00554facc622c6d1c1b9bb6
gpu: NVIDIA GeForce RTX 2060
title: 2c508222
seconds: 60
exit: 0x0
frames shown: 916 (PresentX 916)
presents per 2 s (last 3): 58 39 18
device removals: 0
crashes: 0
peak commit: 15555 MB

Not tested

  • AMD GPUs and native wave64 hardware (no wave64 skipped the two wave64 GPU tests above).
  • Other Series S titles or titles with sampled-only vs RT/UAV R9G9B9E5 precision edge cases.

AI use

  • Google Antigravity (Gemini 4 Neon High): diagnosed the CreatePlacedResourceX format-67 E_INVALIDARG crash from the log, wrote the fix and unit test expansion in device_x.rs, ran the test suite and smoke runs, and drafted this description.

…LOAT

PC D3D12 rejects ALLOW_RENDER_TARGET and ALLOW_UNORDERED_ACCESS on DXGI_FORMAT_R9G9B9E5_SHAREDEXP (67) with E_INVALIDARG (0x80070057). In Series S (Lockhart) mode, a retail title creates a 1920x1080 format-67 target with flags 0x300005 during startup and aborts on the error.

Promote format-67 resources with RT/UAV flags and their RTV/UAV/SRV views to DXGI_FORMAT_R11G11B10_FLOAT (26, same 32 bpp unsigned HDR float with full PC RTV/UAV/SRV support), while keeping sampled-only format-67 textures unchanged.
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run and review of c3d350a5729d7559d00554facc622c6d1c1b9bb6 on AMD RDNA4. The branch is based on 9ce2070, so I merged it onto current main cb868b2 locally (clean merge, only device_x.rs) and tested that tree.

Overlap: this fixes the same Series S start-up failure as #242 (still open), the same way except for the target format: #242 makes the format-67 targets R16G16B16A16_FLOAT (10), this PR R11G11B10_FLOAT (26). Only one of them should land; the numbers below may help pick.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4) on the merge: 685 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 645 passed, 0 failed, 21 ignored
  • 0 SKIPPED; console_depth_buffers_and_their_views_are_the_pcs (with the new cases) passes

Review

  1. R11G11B10_FLOAT does not hold R9G9B9E5's values. The description calls it "the same 32 bpp unsigned HDR float format", but the precision differs: R9G9B9E5 gives each channel a 9-bit mantissa (shared 5-bit exponent); R11G11B10 has 6-bit mantissas for R and G and 5 bits for B. Counted over every value an R9G9B9E5 channel can hold (m · 2^(e−24), m 0–511, e 0–31: 8 448 distinct values), exactly representable are:

    For example 1.00390625 (1 + 2⁻⁸) is an R9G9B9E5 value and an fp16 value, but rounds in R11/G11/B10. Max values also drop (R9G9B9E5 65 408, R11 65 024, B10 64 512). So a target the title writes and reads back loses precision here; with fp16 it does not, at twice the memory (8 bytes per texel instead of 4).

  2. The premise does not hold on every PC driver. The code comment says PC D3D12 forbids ALLOW_RENDER_TARGET and ALLOW_UNORDERED_ACCESS on format 67. On this RDNA4 card, CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) for DXGI_FORMAT_R9G9B9E5_SHAREDEXP reports RENDER_TARGET, TYPED_UNORDERED_ACCESS_VIEW and UAV_TYPED_STORE, and a 1920x1080 RT|UAV committed resource in that format is created with S_OK (measured for D3D12.X: R9G9B9E5 render targets / UAVs are half floats where the device refuses them (retail title, Series S) #242, same machine and driver). The E_INVALIDARG is driver-dependent (NVIDIA in the reports so far); the comment could say "some drivers".

  3. The view mappings are complete: RTVs and UAVs go through pc_shader_view_format(resource, view), SRVs through pc_srv, pipeline formats and clears through pc_target_format, and a sampled-only format-67 texture stays 67, as the new test checks.

Not tested: no retail title or Series S profile (I have no unpacked game), so the picture with either format was not compared on screen; no regression run, no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the value counts come from a short script over the three formats' definitions, the format support from the run on this adapter.

@yyc160

yyc160 commented Nov 24, 2026

Copy link
Copy Markdown

I arrived at the same fix independently a few hours ago (#651, created ~02:24 UTC alongside this one) and my PR covers two things this one does not — while this PR covers something mine was missing. Posting the deltas here since the maintainer will have to pick one anyway, and both halves are worth keeping regardless of which PR carries them.

What #605 has that #651 was missing — pc_target_format promoting 67 itself. I only rewrote pc_resource_desc and pc_shader_view_format, so on my branch the graphics PSO mapper still returned 67 for the retyped resource (verified independently by @CryingLaughing on an RTX 4080 in the #651 thread). I've added the same 67 => 26 line to pc_target_format in #651 (commit 42ec5f7) with the comment pointing here.

What #651 has that #605 does not — two clear-value fixes found on the real title, with probe data:

  1. A retyped resource's optimized clear value follows the new format. After the 67→26 resource promotion, pc_clear still mapped the title's clear value to 67, and the device refuses a resource whose clear value's format does not match — so the crash chain moved one door over instead of ending. D3D12.X: R9G9B9E5_SHAREDEXP targets become R11G11B10_FLOAT #651's pc_clear takes the (console, PC) resource formats and follows. Note that pc_target_format(67) => 26 alone does not fully cover this: the depth case below produces a clear value in a typeless format, which no entry in pc_target_format fixes.

  2. A depth target's clear value in a typeless format. Console depth 118 maps to PC 44 (R24G8_TYPELESS), and the title's optimized clear value for it arrives in format 44 — typeless — which the PC refuses outright (E_INVALIDARG under ALLOW_DEPTH_STENCIL, verified under both COMMON and UNORDERED_ACCESS initial states; the correct format is the family's DSV format 45). D3D12.X: R9G9B9E5_SHAREDEXP targets become R11G11B10_FLOAT #651's commit b212ecb handles the depth-typeless family (19→20, 39→40, 44→45, 53→55) and drops color-typeless clear values rather than guessing a typed format. Probe data for all of this is in the D3D12.X: R9G9B9E5_SHAREDEXP targets become R11G11B10_FLOAT #651 thread.

End-to-end result on the title that motivates both PRs (RTX 5070 Ti, lockhart, idle GPU): 21.7 s breakpoint → 27.1 s breakpoint (67's resource fixed, depth clear still broken) → 120 s clean exit, 0 crashes, both refusals gone — with #651's three commits. #605 alone would fix the first refusal; the clear-value follow and the depth-typeless case are what got past the second.

Regression runs on the same hardware are in the #651 description (main 9ce2070 crashing at 21.7 s vs the branch surviving the full 120 s, plus eizispark's RX 9070 XT pass and CryingLaughing's RTX 4080 probe run above).

One scope note for whoever reviews: this title reaches the 67 target only under lockhart — under anaconda it never draws at all on NVIDIA (every activity line reads 0 draws, 0 dispatches; on @eizispark's AMD card anaconda renders at 60 presents/2s). Happy to fold whatever the maintainer prefers into whichever PR they pick — the clear-value follow is a self-contained pc_clear change and would sit cleanly on top of this branch too.

@MrEjecutor

Copy link
Copy Markdown

Test report on Windows + NVIDIA for c3d350a (this PR's head), Series S profile: no crash in 180 s

Tested

Regression run

xcl-smoke v1
commit: c09604072cb3177f4724b0c1a9bb7f570bbdaea1
gpu: NVIDIA GeForce RTX 5060 Ti
title: GTAVI
seconds: 180
exit: 0x0
frames shown: 1163 (PresentX 1163)
presents per 2 s (last 3): 7 8 8
device removals: 0
crashes: 0
peak commit: 18300 MB

From the local merge above, not from this PR's head alone.

Not tested

AI use

@volkan12a-bot

Copy link
Copy Markdown

Test report: retail title, a run confirming the problem this PR fixes

Not a run of this PR's head (c3d350a): it is a run of my local patch with the same logic (format == 67 && flags & 5 != 0 → 26, pc_target_format 67 → 26, (26, 67) → 26), on main 7ebf1b8.

Hardware / build

  • NVIDIA GeForce RTX 4070 Laptop GPU 8 GB, driver 32.0.16.1692; Intel Core i7-14700HX, 40 GB RAM; Windows 11 Pro 26200
  • Rust 1.97.1, cargo build --release
  • Retail title 930.048.020, Lockhart (Series S) profile

Without the fix

  • CreatePlacedResourceX of a 1920x1080 format 67 texture, flags 0x300005, returned 0x80070057, and the title stopped on its own int3 (0x80000003).

With the fix

  • The log shows R9G9B9E5 target / UAV texture 1920x1080 (flags 0x300005) made R11G11B10_FLOAT.
  • A second 1920x1080 one, flags 0x4 (UAV without RT), took the same path.
  • 640x360 format 67 textures with flags 0 that alias format 42 memory stay 67.
  • The title went on past that point: one run reached 1006 s, about 21 000 frames, with no failure of this resource.
  • The patched mappings passed cargo test -p xcl --lib d3d12x::device_x: 5 passed, 0 failed.

Not tested

  • This PR's own commit.
  • Whether the picture that uses these buffers is correct: I did not compare it.
  • smoke.ps1 blocks; AMD GPUs.

I post the report here because this PR has the same condition as my patch. #651 does the same with more changes around it.

AI use

  • Claude Code with Claude Opus 5.5: diagnosed it from the log, wrote the local patch and this report. The runs are mine.

@yous0serious

Copy link
Copy Markdown
Contributor

Test report on c3d350a (this PR's head): RTX 4090, Series X profile – the 8 pipelines with a format-67 target are no longer refused

The runs on this PR so far are on the Series S profile; the Series X profile reaches format 67 too, in pipelines (#914 expected it not to).

Tested

  • NVIDIA GeForce RTX 4090 (wave32), driver 621.01; Intel Core i7-13700KF; 32 GB; Windows 11 Pro 26200; Rust 1.100.0 stable-x86_64-pc-windows-msvc; release
  • Retail title 1.0.2.1, device_type = "anaconda" (Series X), XCL_NETWORK=0, scripts/smoke.ps1 -Seconds 60, no input, on this head and on its base 9ce2070
  • report.json d3d12.failed_pipelines: base 8, this PR 0 (fallback_pipelines 0, translated_pipelines 6 in both). On the base the 8 are pipeline streams with a console VS + PS and one render target in format 67, refused with 0x8007000e / 0x80070057, and their stand-in versions too (graphics PSO rejected …, the fallback version too), about 8 s after start.

Regression run

Base (9ce2070):

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: NVIDIA GeForce RTX 4090
title: GTA6
seconds: 60
exit: 0x0
frames shown: 1575 (PresentX 1575)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

This PR (c3d350a):

xcl-smoke v1
commit: c3d350a5729d7559d00554facc622c6d1c1b9bb6
gpu: NVIDIA GeForce RTX 4090
title: GTA6
seconds: 60
exit: 0x0
frames shown: 1567 (PresentX 1567)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14792 MB

Not tested

  • cargo test --workspace on this head
  • whether the 8 pipelines draw correctly; Series S profile; AMD
  • anything past the first-run screens (no input)

AI use

  • GitHub Copilot app with Claude Opus 5.5: ran the builds and runs, found the pipelines' render-target format with a temporary local log line (in no commit), wrote this report. Checked by me.

@raylitebull

Copy link
Copy Markdown
Member

Code/CI review only (not independently runtime-tested by me): clean merge and PR description green (just awaiting CI workflow approval). Tight +19/-2 fix promoting R9G9B9E5_SHAREDEXP RT/UAV targets to R11G11B10_FLOAT — cleaner than duplicate #651. Recommend approving CI and merging, @ivall.

@MKmajster

Copy link
Copy Markdown

Confirming PR #605 on an RTX 3070 (8 GB VRAM) / 16 GB RAM, Windows 11.

Before #605, Series S (lockhart) aborted at startup: the title creates a 1920×1080 R9G9B9E5_SHAREDEXP (67) render target + UAV (flags 0x300005), the host refuses with 0x80070057, and the title hits int3 (0x80000003) after ~234 frames (~80 s) — matches #914.

With #605 cherry-picked (plus console_type_raw = 5 for lockhart), the assert is gone. Series S now runs to a clean exit (code 0), ~30 fps at 1920×1080, 2585 console frames / 19,610 translated draws, with no device-removed and no OOM — i.e. it fits 8 GB VRAM, where Series X 4K does not (that path exhausts the 8 GB and the GPU is removed after ~3.5 min).

Remaining on this setup: sampled frames stay black (0 non-black). ID3D12GraphicsCommandList10 #126 and #142 (~2585×/frame) and ID3D12CommandQueue #31 (CopyPageMappingsBatchX, #1031) are still stubbed, so the streamed/mapped content never reaches the GPU views. So #605 clears the Series S startup crash; a visible Series S frame additionally needs those console extensions.

Tested with Claude Code (AI-assisted). No game data attached.

@rrrarrra9

Copy link
Copy Markdown

Windows comparison on a GTX 1650 (4 GB)

I compared retail 1.0.2.1 in the Series S profile on main (b7aa9f3) and on the same base with this PR's c3d350a cherry-picked (e21849e, local).

Build First failure PresentX calls Peak process commit
main At 45.08 s, the 1920×1080 format-67 RT/UAV was refused with 0x80070057, followed by 0x80000003 at game+0xcc2834 299 14,446 MiB
main + #605 The run passed the format-67 allocation. At 82.63 s it hit 0x80000003 at game+0xb18de7 (#495). Final process exit was 0xc0000005 670 18,104 MiB

The last sampled frame in each run had 0 of 129,600 non-dark samples. This confirms that #605 clears the #914 startup assertion on this GPU. The #495 follow-up is in testing.

AI use

Codex (GPT-6) ran both builds and wrote the report from the generated logs.

Geckomacabre added a commit to Geckomacabre/gexcl that referenced this pull request Nov 24, 2026
Upstream PR xcl-dev#605 by 0x6461726B (open; the maintainer recommended
merging it), applied unchanged: PC D3D12 refuses ALLOW_RENDER_TARGET /
ALLOW_UNORDERED_ACCESS on R9G9B9E5_SHAREDEXP (67). A retail title's Series S
profile stopped at its first such target (E_INVALIDARG, then the title's
assert); on an RTX 4090 with the Series X profile testers saw 8 pipelines
refused for a format-67 target. Such resources, their target and shader
views and their clear values (pc_clear goes through pc_target_format) are
R11G11B10_FLOAT, the same 32 bpp unsigned float layout class; sampled-only
R9G9B9E5 textures stay 67. Includes the PR's test lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@raylitebull
raylitebull merged commit 177cd40 into xcl-dev:main Nov 24, 2026
2 checks passed
anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…v#1791, xcl-dev#605, xcl-dev#1806, xcl-dev#1745)

Merges 60 upstream commits through c4d37be, incorporating:
- PR xcl-dev#1747 (raylitebull): eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages via contiguous TilePool
- PR xcl-dev#1791 (wondercrash): D3D12.X an ExecuteIndirect reads arguments written before it
- PR xcl-dev#605 (0x6461726B): promote R9G9B9E5_SHAREDEXP render/UAV targets to R11G11B10_FLOAT
- PR xcl-dev#1806 (bmjask): Direct DXIL image_get_lod accepts static samplers
- PR xcl-dev#1745 (gefydev): direct per-lane DXIL recompiler lowering backend

Assisted-by: Antigravity
mastrr9 added a commit to mastrr9/xcl that referenced this pull request Nov 24, 2026
Brings xcl-dev#1747, xcl-dev#1791, xcl-dev#605, xcl-dev#1679, xcl-dev#1806, xcl-dev#1745, xcl-dev#1307, xcl-dev#1321 among others.

Resolutions:
- dxil/kernel.rs: upstream's Lw::new / Lw::finish; the safe s_barrier state
  and policy and xcl-dev#1741's single-wave bounded exchange move into Lw::new, with
  a safe_barrier flag (false for the per-lane lowering).
- dxil/lower.rs: VAR_BAR_DEAD moves to VAR_BUDGET + 6 (+5 is VAR_F32_MODE).
- TRANSLATOR_VERSION 9.
- d3d12x/bind.rs: the bounded ExecuteIndirect call runs inside
  fresh_indirect_arguments.
- d3d12x/list_x.rs: tracked_list_type, and transition (pub(super)) over the
  batched transitions.
- recomp/mod.rs: compact backend and per-lane modules both kept; the
  oversized-structured-code fallback applies to translate after prepare.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

9 participants