From 4de9016b56a7f0eebe8beedaf258dab054c40b03 Mon Sep 17 00:00:00 2001 From: ivall Date: Sun, 22 Nov 2026 21:44:55 +0100 Subject: [PATCH] Committed console resources XCL does not place get the PC's description A committed console resource that is not placed in unified memory went to the PC with the console's desc, only its layout field fixed. The console's flag bits and alignment made the PC refuse it. With the 512 MB coherent window (and the room committed textures leave free) Fortnite's menu reached that path for its 3264x1836 scene targets: E_INVALIDARG, and the game crashed reading the missing resource. The fallback now uses device_x::pc_resource_desc, like placed console resources. --- HANDOFF.md | 4 ++++ crates/xcl/src/hle/d3d12x/real.rs | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/HANDOFF.md b/HANDOFF.md index 1549f24..e055390 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -1193,6 +1193,10 @@ of the title (it writes to address 0 after a failed D3D12 call: `call 0x14068c76 and had the 512 MB window full in its first second (no room for readback heaps); it now stops at 384 MB, the picture unchanged. Putting them in the sparse windows instead made XDefiant render black (cache warm, no errors in the log) – not understood yet; the GPU-owned ones go to `vram` arenas either way. + - A committed console resource XCL does not place is created with the PC's description + (`device_x::pc_resource_desc`: the driver's alignment, its layout, console flag bits off). With the smaller + coherent window Fortnite's menu reached that path for its 3264x1836 scene targets; the console desc gave + E_INVALIDARG and the game crashed reading the missing resource. - XDefiant's menu runs at ~53 fps (~50 before PR #40). Its CPU cost of the sparse windows is the per-submit write-watch scan over the mapped tiles (~2 GB): ~0.8 ms per submit at ~800 submits a second, then ~0.3 ms of uploads (64-byte chunk runs of ~0.5 KB on average). Merging the runs or skipping scans would be faster, but a diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs index a49d695..0812889 100644 --- a/crates/xcl/src/hle/d3d12x/real.rs +++ b/crates/xcl/src/hle/d3d12x/real.rs @@ -1627,6 +1627,11 @@ unsafe extern "system" fn dev_create_committed_resource_x(this: *mut c_void, pro return hr; } } + // not placed in unified memory (e.g. its coherent window kept for readback heaps): a PC + // resource of the PC's description – the console's flag bits (0x1000000, 0x300000 …) and + // alignments made the PC refuse Fortnite's 3264x1836 scene targets (E_INVALIDARG, a crash) + let pc_full = (console_desc != 0 && crate::gpu::shader::readable(console_desc, 0x38)).then(|| super::device_x::pc_resource_desc(&(console_desc as *const [u8; 0x38]).read_unaligned())); + let desc = pc_full.as_ref().map_or(desc, |d| d.as_ptr() as usize); // console-only state bits (e.g. 0x100000 on a display target) are not the PC's let hr = dev_create_committed_resource(this, props, flags, desc, state & PC_RESOURCE_STATES as usize, clear, riid, ppv); if hr < 0 {