D3D12.X: R9G9B9E5_SHAREDEXP targets become R11G11B10_FLOAT #651
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!651
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/651/head"
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?
@yyc160 on GitHub · 2026-11-24 02:53 UTC · original
yyc160:fix-r9g9b9e5-targets→main· +225 −5 · 2 files · 4 commits · closed without mergingWhat is in it
pc_resource_descmaps console format 67 (R9G9B9E5_SHAREDEXP) to PC format 26 (R11G11B10_FLOAT) when the title asks for a render target or UAV, andpc_shader_view_formatmaps a view requested in 67 onto a resource made 26 (mirroring the existing(28, 86 | 115) => 28). Plain textures (flags 0) keep format 67.pc_clearadditionally takes(console format, PC format)so an optimized clear value the console wrote in its own format follows the retyped resource. Without it the resource is created fine and still refused, because a clear value's format must match the resource's.One table-driven test covers the desc conversion (67 with flags 0/1/4/5, plus the existing 116/117 and 86/115 rules as no-regression cases) and the view conversion; two more cover the clear-value follow.
Why
On an RTX 5070 Ti (driver 32.0.16.1742), a 1920x1080 resource in console format 67 with console flags
0x300005(truncated to PC0x05) is refused by every creation path —vram::place_on_pages' reserved attempt, the arena'sCreatePlacedResource, and theCreateCommittedResourcefallback — withE_INVALIDARG. That call is the last log line before the title's0x80000003at+0xcc2834when the run usesdevice_type = "lockhart".Measured on this device with a standalone D3D12 probe (no game files):
Format 26 is 32 bpp like 67 and holds values above 1.0, so the resource footprint and the title address range (computed from the original console desc in
create_placed_resource_x) are unchanged. Format 28 would clamp HDR values; format 10 would double the bytes per pixel.The clear-value half was verified the same way: a reserved resource in format 26 with flags 0x5 creates with no clear value and with a clear value in format 26, and fails with
E_INVALIDARGwhen the clear value says format 67 or 28 — under bothD3D12_RESOURCE_STATE_COMMONandD3D12_RESOURCE_STATE_UNORDERED_ACCESS.title_textures::registeris not touched:gpu_ownedresources return fromcreate_placed_resource_xat thevram::placeearly return (device_x.rs:888-898), before the register call at line 909, so these targets are not CPU-uploaded.Tested
cargo build --workspacethencargo test --workspace -- --test-threads=4on Windows 11 (build 26200), RTX 5070 Ti, DXC 1.9.2609: 645 passed, 0 failed, 21 ignored in the main crate (666 tests), all other suites green except one e2e — details under this, it fails identically onmainwithout the patch:test_title_runs_and_game_folder_is_untouched:exit code -1073740791after 15 s, withmfplat: MFResetDXGIDeviceManagerX bridged ResetDevice failed: 0x80070057in the log. Verified as pre-existing: stashing this PR's changes and re-running on cleanmainproduces the same failure, same exit code, same mfplat line. This machine has nod3d12SDKLayers.dll, which may be related; I did not dig further since it is independent of this change.Format probe:
cargo test --release -p xcl --test format_probe -- --nocapture, 4 passed / 0 failed — local probe, not part of this PR.Regression run
Both runs on the same title,
-Seconds 180, lockhart config (see below), idle GPU, no uncommitted changes.mainis the merge base9ce2070; the PR's block names its head commit.main@9ce2070(without this PR):This PR @
1cd4dbc(both commits):What this shows and what it does not. The frame-count comparison does not apply here:
maincrashes ~21.7 s in at+0xcc2834, which is exactly the crash this PR removes — the run's last log line is thatCreatePlacedResourceX ... format 67 ... (0x80070057)refusal. With the PR, the title creates that resource (the refusal line is gone from the log) and runs to 27.1 s, then hits a new0x80000003at+0x131a2ad, whose last log line is a different refusal:CreatePlacedResourceX ... 1024x1024 format 118 flags 0x1800002 – (0x80070057)— consoleD16_UNORM_S8_UINT, already retyped toR24G8_TYPELESS, with a depth-stencil flag. That looks like the same class of problem (a console format the PC device refuses under these flags) and is worth its own investigation; I have not bundled it here since one problem per PR.lockhart(device_type = "lockhart"inxcl.toml) is used because with the defaultanacondathis title never renders at all on this machine — every activity line reads0 draws, 0 dispatchesfor the whole run, so neither run can support a frame-count comparison. Peak commit (14300 → 16233 MB, the title allocating further) is the stable number here.Not tested
gpu_ownedand do not reachtitle_textures::register).+0x131a2adbreakpoint (see above — separate investigation).AI use
AI-assisted (gpt-6.2-astra via a local relay): reviewed the approach across several rounds, wrote the standalone D3D12 format/clear probes and the patch. All measurements, source-tracing and the regression runs were executed locally by the contributor; the final text was written by the contributor.
@yyc160 on GitHub · 2026-11-24 03:14 UTC · original
Update: a second fix in the same call chain, and the title now survives the full run.
The
+0x131a2adbreakpoint in the regression run above was the same refusal class, one layer deeper. Commitb212ecbadds:Evidence (RTX 5070 Ti, standalone probe + a temporary diagnostic log in
create_placed_resource_x):The clear value's format was mapped to the resource's typeless format itself (44), and D3D12 refuses a clear value in a typeless format — it must be the family's DSV format (45 = D24_UNORM_S8_UINT).
pc_clearnow also takes the retyped desc's flags and, through a small helper, makes a depth target's typeless clear value take its DSV format (19→20, 39→40, 44→45, 53→55), and drops a color typeless clear value (pass no optimized clear value) instead of guessing a typed format.Result on the same title / lockhart / idle GPU / 120 s:
Timeline on this title: 21.7 s breakpoint (+0xcc2834, format 67) → 27.1 s breakpoint (+0x131a2ad, format 118 depth) → 120 s clean exit. Both resource-creation refusals in the chain are gone.
The title is still in its front end (
0 draws, 0 dispatchesthroughout — same as theanacondanote above), so this is not a rendering milestone; but the crash chain this PR started with is resolved end to end, and the depth probe data (R24G8_TYPELESSrefused on reserved/tile while committed is fine on this device) may be useful for the tiled-resources path generally.@CryingLaughing on GitHub · 2026-11-24 03:47 UTC · original
Tested
b212ecbeff9d83d1755d007b54bcf69219cad2e9with a scratch-only native probe inreal.rs, and a second run adding only the67 => 26case topc_target_format, as in #605. NVIDIA GeForce RTX 4080, driver 621.01, Intel Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, Windows SDK DXC 1.8.2502.11, debug.XCL_ADAPTER=4080,XCL_REQUIRE_GPU=1, allXCL_SAMPLE_*variables unset.cargo test -p xcl --lib --locked -j 4 --no-run --message-format=jsonand ranhle::d3d12x::real::shared_exp_target_witness::shared_exp_target_pipeline_format_and_hdr_readback --exact --test-threads=1 --nocaptureon each scratch tree. Both runs passed 1/1 with zero skips.S_OKfor both that PSO and the identical PSO specifying 26, so successful creation alone leaves a resource/PSO format mismatch. With the explicit format-26 PSO, the draw produced the expected 32 HDR triangle pixels and preserved 32 HDR clear pixels.S_OK. The probe drew using that mapped PSO and matched the same 64 packed HDR pixels. Both draws used PSOs matching the backing resource format.pc_topology_typeusespc_target_formatfor each graphics RTV format. Bringing that mapper into agreement withpc_resource_descandpc_shader_view_formatcloses this particular gap. Target mapping in #605Not tested
AI use
@eizispark on GitHub · 2026-11-24 03:33 UTC · original · edited 2026-11-24 05:10 UTC
Hardware check of
42ec5f71445f878b09f49f1f7c645ad248a6a029(verified clean merge withmaind5442d2): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:689 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none;e2e:3 passed, 0 failed)cargo test -p xcl --lib hle::d3d12x::device_x::tests:10 passed, 0 failed, 0 ignored(includingtarget_resource_and_view_formats,matching_clear_follows_rewritten_resource,unchanged_resource_or_other_clear_format_uses_the_existing_mapping,a_depth_targets_typeless_clear_value_takes_its_dsv_format,a_color_typeless_clear_value_is_dropped_not_guessed)Regression run
Default
anacondadevice configuration, 60 s:main(f4ce27c):PR (
42ec5f7):Not tested
device_type = "lockhart"mode; gameplay past the menusAI use
scripts/smoke.ps1harness on this machine and formatted this report.@MrEjecutor on GitHub · 2026-11-24 06:27 UTC · original
Test report on Windows + NVIDIA for
42ec5f7(this PR's head), Series S profile: no crash in 180 sTested
stable-x86_64-pc-windows-msvc; DXC 1.8.2505.32 (SDK 10.0.28000); releasemaine50836b+ this PR + #495 (3ae0841), merged locally without conflicts (d97851c). #495 is needed on this title to get past a later assert (+0xb18de7) on the Series S profile.cargo test --workspace --release --no-fail-fast -- --test-threads=4: 710 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, 180 s: no refusal of the format-67 target, no assert, no device removal. Onmainthe same setup stops at+0xcc2834at 19 s (format 67,0x80070057).Regression run
From the local merge above, not from this PR's head alone.
Not tested
AI use
@yous0serious on GitHub · 2026-11-24 09:27 UTC · original
Test report on
42ec5f7(this PR's head): RTX 4090, Series X profile – the67 => 26line inpc_target_formatremoves the 8 refused pipelines on NVIDIA@eizispark's Series X run above is on AMD, which takes format 67 as a target; this is the NVIDIA side, where the pipelines @CryingLaughing found are refused.
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 base9ce2070report.jsond3d12.failed_pipelines: base 8, this PR 0 (fallback_pipelines0,translated_pipelines6 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.Regression run
Base (
9ce2070):This PR (
42ec5f7):Not tested
cargo test --workspaceon this headAI use
@raylitebull on GitHub · 2026-11-24 10:43 UTC · original
Closing as a duplicate of #605, which is smaller, cleaner, and passes the
PR descriptioncheck (whereas this PR failsPR description).Pull request closed