D3D12.X: R9G9B9E5 render targets / UAVs are half floats where the device refuses them (retail title, Series S) #242
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!242
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-242"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mrp1no on GitHub · 2026-11-23 21:46 UTC · original
mrp1no:d3d12x-r9g9b9e5-targets→main· +96 −2 · 2 files · 1 commits · openOn the Series S profile (
device_type = "lockhart"), the retail title places a 1920x1080DXGI_FORMAT_R9G9B9E5_SHAREDEXPtexture that is both a render target and a UAV (flags 0x300005). On NVIDIA the device accepts neither use of that format, soCreatePlacedResourceXgetsE_INVALIDARGand the title stops on its own assertion (a breakpoint exception). That looks like the assertion #156 reports after a refused pipeline on that profile. An AMD RDNA4 card accepts both uses (MesshM's report below), so the format is changed only on a device that does not take it.This handles the format the way XCL already handles the console's R10G10B10 7e3 / 6e4 floats (116 / 117) and B5G5R5A1 / B4G4R4A4 targets. Half floats hold every shared-exponent value exactly: 9 mantissa bits and exponents down to 2^-24 fit in fp16. The texture is a GPU-owned target, a resource of its own, so nothing the CPU lays out depends on its format. Like the B5G5R5A1 case, it costs twice the memory per texel.
What is in it
D3D12.X: R9G9B9E5 render targets / UAVs are half floats on the PC(crates/xcl/src/hle/d3d12x/device_x.rs,crates/xcl/src/hle/d3d12x/real.rs):probe_rgb9e5_targets, called when the device is made:CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)for format 67. The format is kept when the device hasRENDER_TARGET,TYPED_UNORDERED_ACCESS_VIEWandUAV_TYPED_STORE; otherwiseRGB9E5_AS_HALFis set and the log says which.pc_resource_desc: an R9G9B9E5 texture withALLOW_RENDER_TARGETorALLOW_UNORDERED_ACCESSbecomesR16G16B16A16_FLOATwhenRGB9E5_AS_HALFis set. A texture that is only sampled stays R9G9B9E5.pc_target_format: render target views, pipeline formats and clear values in format 67 follow the same switch.pc_shader_view_format: a shader view in format 67 of a converted texture isR16G16B16A16_FLOAT.pc_srv(real.rs): an R9G9B9E5 shader view of a converted texture reads alpha as the constant 1 (alpha_read_as_one: each read of the fourth component in itsShader4ComponentMappingbecomesFORCE_VALUE_1), as the format does; the half floats hold whatever the title's pixel shader wrote in alpha. Its other component choices stay.console_types_and_descs_become_pc_onestest covers the desc with the switch on and off, the sampled-only case, and the view and target formats;an_rgb9e5_view_of_half_floats_reads_alpha_onecovers the alpha mapping and the views left as they are.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4onff28e60(rebased onmainc160d86): 859 passed, 0 failed, 42 ignored over 20 test binaries. SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).R9G9B9E5 render targets / UAVs: half floats (the device does not render into the format or store to it).device_type = "lockhart"),scripts/smoke.ps1 -Seconds 60with that data folder, release builds:mainf4ce27clogsCreatePlacedResourceX ... 1920x1080 format 67 flags 0x300005 – a resource of its own (0x80070057)at 35.3 s and ends on the title's breakpoint exception 0x80000003 (no frame count: the run did not reach its end); this change (e54a0d4) makes the texture, runs the 60 s and shows 937 frames, no crash. The same 60 s on the Series S profile with 5683056 (the previous head, same change): 1330 frames, no crash, peak commit 18417 MB.pc_target_format, the report from XackiGiFF below).ecdfa5b): klNuno, RTX 5080, Series S: the stop is gone; MesshM, RX 9060 XT (RDNA4): suite green, and the format is accepted there as a target and a UAV, which is why the conversion now depends on the device. XackiGiFF, RTX 5090 Laptop, Series X profile on9ce2070: the 8 failed pipelines ofmain, among them the debug layer's message 676 (R9G9B9E5 render-target support), went to 0 with this change; the intro ran at about 27 fps.failed_pipelines8 on the base, 0 with this change. milas6669, RTX 3070, Series S: the format error is gone, the first screens run at a steady 30 fps, then the same assertion #495 fixes.Regression run
scripts/smoke.ps1 -Game <game folder>(60 s), Series X profile, no input (the title stays at its first menus), release builds;mainatc160d86, this branch's base.main:This PR:
Not tested
AI use
🤖 Generated with Claude Code
@klNuno on GitHub · 2026-11-23 22:23 UTC · original · edited 2026-11-23 22:28 UTC
Test report for #242 on a second GPU: the RTX 3060 result in the description reproduces on an RTX 5080.
Tested
9ab7d76plus theecdfa5bdiff (samegit patch-id --stable, 501b6a29), without #203.device_type = "Lockhart"), 3136 MB coherent window.cargo test --release -p xcl --lib console_depth_buffers_and_their_views_are_the_pcs: 1 passed, 0 failed.ecdfa5b): at 8.5 s the log showsCreatePlacedResourceX at ...: dimension 3 1920x1080 format 67 flags 0x300005 - a resource of its own (0x80070057), then exception 0x80000003.XCL_RUN_SECONDS=55) ended with exit code 0, 1062 frames shown for 1063 PresentX calls.Not tested
AI use
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@MesshM on GitHub · 2026-11-24 00:50 UTC · original
Test run of
ecdfa5bfaon AMD (RDNA4); the PR was tested on NVIDIA only. The branch is based on0f34407, so I merged it onto currentmaina6f5f7alocally (clean merge, onlydevice_x.rs, +15 lines) and tested that tree.Tested
backend 'real' – AMD Radeon RX 9060 XT (16191 MiB VRAM))stable-x86_64-pc-windows-msvc, debug.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4) on the merge: 676 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 636 passed, 0 failed, 21 ignored; the same counts asmainon this machine (the PR extends an existing test rather than adding one);console_types_and_descs_become_pc_onespassesSKIPPEDon this adapterOne finding on AMD: the description says a PC device accepts R9G9B9E5_SHAREDEXP neither as a render target nor as a UAV. On this RDNA4 card it accepts both. A small standalone program (not part of XCL) on the same adapter:
CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)forDXGI_FORMAT_R9G9B9E5_SHAREDEXP:RENDER_TARGET,TYPED_UNORDERED_ACCESS_VIEWandUAV_TYPED_STOREall setCreateCommittedResourceof a 1920x1080 R9G9B9E5 texture withALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS:S_OK(R16G16B16A16_FLOAT:S_OKtoo)So the
E_INVALIDARGis driver-dependent (NVIDIA in the reports so far), not a property of D3D12 on the PC. The conversion is still correct on AMD, since half floats hold every shared-exponent value exactly; it just costs twice the memory there without being needed. Not a blocker; if you want, the conversion could depend on the device's format support for 67, and the comment inpc_resource_desccould say "some PC drivers" instead of "the PC".Review of the change: I checked that every view of a converted texture goes through the new mappings. RTVs (
dev_create_rtv) and UAVs (dev_create_uav_x) usepc_shader_view_format(resource, view), SRVs go throughpc_srv→pc_shader_view_format, and pipeline RTV formats and clear values usepc_target_format. A sampled-only R9G9B9E5 texture stays R9G9B9E5, as the test checks.Not tested: no retail title or Series S profile (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's own head commit on its old base was not run, only its merge ontomain.Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@XackiGiFF on GitHub · 2026-11-24 03:16 UTC · original
Additional Series X/Anaconda test on NVIDIA: upstream
9ce2070plus only this PR’s 15-linedevice_x.rspatch fromecdfa5b. No additional runtime patches.Setup
XCL_NETWORK=0, D3D12 debug enabled, no FrameDump.Tests
Five targeted libtests passed with zero SKIPPED, covering format/descriptor mappings and texture uploads.
The first synthetic run produced 49 PASS / 1 FAIL: XMA2 buffer duration was 64 ms versus approximately 100 ms expected. ZIP compression was concurrent; causation is unproven. An isolated repeat produced 50 PASS / 0 FAIL, exit 0.
Observed
Unmodified
9ce2070reported eight failed pipelines, including early debug IDs 676 (R9G9B9E5 render-target support) and 688 (VS/root-signature mismatch).With this patch, both IDs disappeared. The final report showed 155 translated pipelines and zero failed pipelines. The animated intro visibly rendered at approximately 27 FPS.
Limits
No visible 3D world was reached. World loading ended at 205.215 s with the existing
+0x23cf683null-write signature.A diagnostic minidump briefly suspended threads for 518 ms approximately 1.7 seconds before the fault, so timing was perturbed. One retail run per configuration; profile and shader caches were reused. No pixel-exact format comparison or full workspace suite was performed.
This supports the format/PSO fix on this configuration, but does not demonstrate a fix for the world-loading crash.
AI use
Codex prepared and ran the local builds/tests, analyzed the results, and drafted this report. No game files or memory dumps attached.
@mrp1no on GitHub · 2026-11-24 03:55 UTC · original
Thanks to all three of you for the runs.
@MesshM: confirmed from your numbers. The conversion now depends on the device, in the one commit (now e54a0d4, rebased on
mainf4ce27c). When the device is made,probe_rgb9e5_targetsasksCheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)for format 67. The format stays when the device hasRENDER_TARGET,TYPED_UNORDERED_ACCESS_VIEWandUAV_TYPED_STORE, so an RDNA4 card keeps R9G9B9E5 and pays no extra memory. Otherwisepc_resource_descandpc_target_formatmake the targets half floats, as before. The comment now says "some PC drivers". The unit test covers both settings of the switch.@klNuno: noted that your frames were black. That run had the two local patches, and I have not checked the Series S frames myself either; it is listed under Not tested.
@XackiGiFF: thanks for the Series X run; it is in the description (the pipelines naming format 67 as a target get the half-float format on NVIDIA).
On the Series S profile I reran
mainf4ce27cand this head:mainstill stops at the refused format-67 texture (0x80070057, then the title's 0x80000003), and this head runs on. The suite and the smoke runs on the new head are in the description.Written with Claude Code, Claude Opus 5.5.
@MrEjecutor on GitHub · 2026-11-24 05:36 UTC · original · edited 2026-11-24 06:27 UTC
Test report on
e54a0d4(this PR's head): RTX 5060 Ti + Intel CPU, Series S profile – the R9G9B9E5 assert is gone, the title runs 2.7× longer, then stops on a different assertTested
stable-x86_64-pc-windows-msvc; DXC 1.8.2505.32 (SDK 10.0.28000); releasecargo test --workspace --release --no-fail-fast -- --test-threads=4one54a0d4: 701 passed, 0 failed, 41 ignored;SKIPPED(no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwaredevice_type = "lockhart",XCL_NETWORK=0, 120 s:main(d5442d2):CreatePlacedResourceX1920x1080 format 67 flags 0x300005 →0x80070057, then0x80000003at+0xcc2834at 19.1 sR9G9B9E5 render targets / UAVs: half floats (the device does not render into the format or store to it)at start; no refusal of format 67; the title runs to 51.6 s at 17–25 fps (1920x1080 swap chain), then0x80000003at+0xb18de7Insertq { dst: 0, src: 1, reg: false, len: 16, idx: 16 }emulated at+0x2e7ff1(this CPU has no SSE4a). Not shown to be related; I have no AMD CPU to compare.anaconda, default) onmain: no crash in 120 s but 3840x2160 output at 4.5–5 fps, GPU at 6–9 % utilisation.Regression run
Both with
device_type = "lockhart". Themainblock is fromd5442d2, this PR is based onf4ce27c.Not tested
+0xb18de7assert is caused by the SSE4a emulation.AI use
Update: the
+0xb18de7assert is not the SSE4a emulation. The sameINSERTQis emulated on the Series X profile at 62 s with no crash. The assert isXMemMapPhysicalPagesScattercalled with a NULL page array, which #495 fixes. With this PR and #495 merged onmaine50836b, the title runs the full 180 s on this card on the Series S profile (report on #495).Compared with #605 and #651 (same card, same setup, each merged with #495): none of the three crashes in 180 s, so a run cannot tell them apart here. From the code, checked by me (a comparison drafted by Codex, gpt-6-sol, was the starting point):
FORMAT_SUPPORTprobe), and R16G16B16A16_FLOAT holds every R9G9B9E5 value; R11G11B10_FLOAT (#605, #651) keeps 7/7/6 significant bits where R9G9B9E5 has 9..afrom the retyped view could see what was written or cleared instead of 1. Not observed, the window is black on this card.maintoo:dev_create_placed_resource_xretries withpc_resource_descbut passes the title's clear value unchanged (real.rs:2695,2704, andown_memory_if_larger_on_the_pcat2749), so a format-67 target with an optimized clear on that path would still be refused. This title did not take that path in my runs.@yous0serious on GitHub · 2026-11-24 09:26 UTC · original
Test report on
e54a0d4(this PR's head): RTX 4090, Series X profile – no refused pipeline left; the later crash at+0x23cf683is unchanged@XackiGiFF's Series X run above was on
9ce2070with the earlier patch; this one is on the current head.Tested
stable-x86_64-pc-windows-msvc; releasedevice_type = "anaconda"(Series X),XCL_NETWORK=0,scripts/smoke.ps1 -Seconds 60, no input, on this head and on its basef4ce27creport.jsond3d12.failed_pipelines: base 8, this PR 0 (fallback_pipelines0,translated_pipelines1345 in both). On the base the 8 are pipeline streams with a console VS + PS and one render target in format 67, refused with0x8007000e/0x80070057, and their stand-in versions too (graphics PSO rejected …, the fallback version too), about 8 s after start.main077ce40and once on this head: both end in the same null write atgame_scarlett_master.exe+0x23cf683(#846), about 30 s after the firstID3D12GraphicsCommandList12::#101stub call and after more than 2000 BCPack refusals. This PR does not change that crash.Regression run
Base (
f4ce27c):This PR (
e54a0d4):Not tested
cargo test --workspaceon this headAI use
@milas6669 on GitHub · 2026-11-24 10:02 UTC · original
Series S mode with this PR on an RTX 3070 (3 runs), and what comes after the R9G9B9E5 format. Not a regression run.
Setup: RTX 3070 8 GB (32-lane waves), i9-10900KF, 31.9 GB RAM, Windows 11 Pro 10.0.26200, rustc 1.100.0, release. Build:
main077ce40+ #891 (XCL_PSO_WAIT_MS=50) + this PR's heade54a0d4(clean merge).XCL_NETWORK=0, retail title, warm caches.xcl.tomlwithdevice_type = "lockhart",console_type_raw = 5; the same build and settings withanaconda/ 6 as the control. A button press reached the title in every run (a scriptedXCL_PRESS_A_AT=25plus presses by hand, so the press times in the log differ: 44 s, 127 s, 166 s).With this PR the format error from #914 is gone here. The log has
R9G9B9E5 render targets / UAVs: half floats (the device does not render into the format or store to it)at 2 s, and nonot reserved/ assert about format 67 follows. The title boots, gets through the first screens at a steady 30 fps (4200 frames in the longest run), and answers the A press.What happens next, 3 of 3 runs:
XErrorReport 0x89240107, as it also does in Series X runs);unhandled exception 0x80000003(int3) ingame_scarlett_master.exe+0xb18de7: 174.0 s (press at 166.5 s), 49.7 s (press at 44.2 s) and 133.1 s (press at 127.4 s); 4.9 to 6.9 s after the XStore error each time, with the same registers (rbx=0x7aa5e09a8 rcx=0x57);Insertq { dst: 0, src: 1, reg: false, len: 16, idx: 16 } in game_scarlett_master.exe+0x2e7ff1 ... emulated (logged once)comes 21–23 ms before the int3. The same line appears in Series X runs, which go on. I read the emulation (insn::insertq) against AMD's definition and it matches; I do not claim it is related, only that the two events are 22 ms apart.Memory, Series S against the Series X control (same build,
\Memory\Available Byteslogged once a second):So Series S keeps the machine well clear of the RAM exhaustion I see in Series X (comments on #675), but it does not get as far as the world because of the assert.
Not tested: whether the int3 is the title's own check on something Series S specific; the other Series S fix candidates; AMD.
AI use: Claude Code, Claude Sonnet 5.5, ran the commands and wrote this comment.
@mrp1no on GitHub · 2026-11-24 13:11 UTC · original
Thanks for the three reports. The head is now
5683056, rebased onmain47efa2e, still one commit.@MrEjecutor: both of your points are fixed.
Shader4ComponentMappinghas every read of the fourth component set toFORCE_VALUE_1; the title's other component choices stay. Test:an_rgb9e5_view_of_half_floats_reads_alpha_one. One case remains: a view made with no description (the resource's own format) cannot be told from a view of a real half-float texture, so it is left alone. This is listed under Not tested.dev_create_placed_resource_xandown_memory_if_larger_on_the_pcnow pass the clear value throughpc_clear, ascreate_placed_resource_xalready did. The clear value is therefore in the format of the PC description there. This also covers the B5G5R5A1 / B4G4R4A4 and D16S8 families on those two paths.@milas6669, @MrEjecutor: the Series S int3 at
+0xb18de7, a few seconds after the A press, is the one #495 fixes (MrEjecutor's update above). It is not related to this PR.@yous0serious: thanks for the Series X numbers (
failed_pipelines8 → 0). The+0x23cf683crash happens during the world load and is outside this PR. In my runs it comes about 30 s after the first compute dispatches that XCL skips because their pipelines are still being built.New results on
5683056:cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored.main's 1623.The details are in the description.
(Claude Code, Claude Opus 5.5)
@mrp1no on GitHub · 2026-11-24 19:44 UTC · original
Rebased on
c160d86; still one commit, nowff28e60. One change from the head reviewed above:f4bbf26(emirduran707) onmainnow converts the clear value at the start ofdev_create_placed_resource_x. That covers the retry andown_memory_if_larger_on_the_pc, so I dropped this PR's own conversion there to avoid a second one. The alpha-as-1 mapping for R9G9B9E5 views of the half-float targets stays.cargo test --workspace --no-fail-fast -- --test-threads=4: 859 passed, 0 failed, 42 ignored. Smoke onmainc160d86and onff28e60: 1620 frames each, no crash (blocks in the description).(Claude Code, Claude Opus 5.5)
@adriaespii on GitHub · 2026-11-24 20:22 UTC · original
Independent test run on commit
ff28e60:Tested
stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11, debug build$env:XCL_ADAPTER='RX 9070'; .\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4)SKIPPEDGPU tests: 1 (heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows,XCL_HEAP_WINDOWSunset)Not tested
scripts/smoke.ps1andXCL_SAMPLE_*tests not run)R9G9B9E5_SHAREDEXPrender-target/UAV fallback to half floats triggersAI use
@DavidM1911 on GitHub · 2026-11-25 15:14 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@mokkamokacaffe on GitHub · 2026-11-25 16:57 UTC · original
I resolved this PR’s conflict with current
mainon a helper branch while preserving the original commit authorship:github.com/mokkamokacaffe/xcl@df472e2The resolution retains the newer B5G6R5/B8G8R8X8 handling from
main, while preserving this PR’s:R16G16B16A16_FLOATfallbackcargo check -p xcl --lib --tests --target x86_64-pc-windows-msvcpasses on the rebased commit.I could not perform GPU or retail-title validation, so the required smoke/regression runs still need to be repeated on the updated head.
AI-assisted (OpenAI Codex, GPT-5).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.