Repository navigation
Conversation
The console's DXGI_FORMAT_D16_UNORM_S8_UINT family (118, 119, 120) does not exist on the PC: it becomes the D24_UNORM_S8_UINT family (45, 46, 47) in resource descs and in pipelines' DSV / RTV formats (pc_format). The console allows a depth-stencil resource that is also a UAV; the PC refuses that pair, so pc_resource_desc keeps the depth flag and drops unordered access, and a placed depth buffer's UNORDERED_ACCESS initial state becomes DEPTH_WRITE. GTA VI stopped on assertions at +0x344196 (its 2560x1440 D16S8 depth buffer got no size from GetResourceAllocationInfo) and +0x14a6390 (its 768x768x6 shadow maps, placed with the UAV state, were refused). Resources that still get no size or are refused are logged with their PC desc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTYmP6vKUQKatSiA2PC95B
… shaders, D16S8 depth formats (ivall#163)
…offset (from ivall#169) The retail game called ivall#10 (a stub returning E_NOTIMPL) and then wrote to address 0 at +0x2215c35. ivall#10 / ivall#11 are GetSubresourceLayout / GetSubresourceOffsetBytes: the XG_SUBRESOURCE_LAYOUT of a subresource, or its byte offset. Only xg.rs of ivall#169 is taken: its DSV format 118 remap is covered more completely by ivall#163 (merged with ivall#170: resource descs, pipelines, depth buffers that are UAVs).
… shaders, D16S8 depth formats (ivall#163)
…offset (from ivall#169) A title called ivall#10 (a stub returning E_NOTIMPL) and then wrote to address 0. ivall#10 / ivall#11 are GetSubresourceLayout / GetSubresourceOffsetBytes: the XG_SUBRESOURCE_LAYOUT of a subresource, or its byte offset. Only xg.rs of ivall#169 is taken: its DSV format 118 remap is covered more completely by ivall#163 (merged with ivall#170: resource descs, pipelines, depth buffers that are UAVs).
pc_resource_desc drops ALLOW_UNORDERED_ACCESS from a console depth buffer that is also a UAV. GTA VI still creates UAVs of its 768x768 shadow maps: the driver was handed an invalid view (debug layer: "CreateUnorderedAccessView … did not specify ALLOW_UNORDERED_ACCESS") and the device was removed once a dispatch used it. The PC descriptor is now a null view of the same dimension; the console descriptor XCL writes for translated shaders is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTYmP6vKUQKatSiA2PC95B
…-target and texture-address fixes Open upstream pull requests applied as they are (their authors' work): - ivall#151 (gbuyssens): clzero / clwb / rdpru / monitorx / mwaitx / rdpid emulated on CPUs that lack them (HANDOFF.md hunk left out, it did not apply). - ivall#163, ivall#170 (Sr-0w): Xbox D16S8 depth formats, depth + UAV buffers, console mesh pipeline streams, null stand-in shaders. - ivall#168 (ShyVortex): GetGPUVirtualAddress of a placed texture. Local changes: - xg: XGTextureAddressComputer ivall#10 as GetResourceTiling, from the layout model (not checked against the console's library). - d3d12x: a UAV of a texture made without ALLOW_UNORDERED_ACCESS is a null UAV (the real call removed the device); a committed texture gets memory when the title asks for its address; clear values and view descriptions get pc_format; formats 86 / 115 -> R8G8B8A8, 116 / 117 -> R16G16B16A16_FLOAT. - Debug layer log: 8 messages per id instead of 200 in all. - The earlier "AS slot ignored" workaround stays but is no longer reached (ivall#170). - CHANGES.txt, README status and installer version for build 3. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
New commit 634c423: a null UAV for a resource the PC has without unordered access. GTA VI still creates UAVs of its 768x768 D16 shadow maps (whose UAV flag this PR drops). The driver was handed an invalid view (debug layer: 🤖 Generated with Claude Code |
|
At I tested a synthetic 16×16 texture with both
The downstream fork already maps the clear on its address-based and committed paths. The attached patch for this PR also covers the heap-and-offset placement retry and its committed fallback. It maps the clear’s own view format, which preserves valid typed clears on typeless resources. Downstream change · D3D12 clear format rules The patch applies cleanly to
|
… buffers ivall#163 makes the console's D16S8 depth buffers D24S8 on the PC; what refers to them kept the console's formats and the PC refused them (GTA VI, with the D3D12 debug layer): - a clear value of format 118 on a D24S8 resource: E_INVALIDARG, then the title's assertion; - CreateDepthStencilView with format 118 (now hooked): the device was removed (~55 s in); - SRVs of depth / stencil planes as R16_UNORM, R8_UINT, and of a D32S8 (R32G8X24_TYPELESS) as R32_FLOAT – also the SRV XCL makes next to a texture UAV: now R24_UNORM_X8_TYPELESS / X24_TYPELESS_G8_UINT / R32_FLOAT_X8X24_TYPELESS / X32_TYPELESS_G8X24_UINT with the matching plane slice (`depth_srv_format`); - the null UAV of a depth buffer kept the console view's plane slice 1. RTVs and SRVs with 118–120 go through `pc_format` too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA
|
New commit: the PC's formats for everything that refers to a console depth buffer, not only the resource. With the D3D12 debug layer, GTA VI showed each of these, each followed by a device removal:
Overlap note: #169 also remaps DSV format 118 → 45. The two can be combined; #169's version covers PSOs, this one covers resources, clear values and views. 🤖 Generated with Claude Code |
|
Setup: AMD Radeon RX 7800 XT (RDNA3, 16 GB), driver 32.0.32015.7029, 32 GB RAM, Windows 11 Pro 26200, GTA VI retail, Tested 634c423 with the D3D12 debug layer (Agility SDK 1.620.2, What fixed each (all only on the copy handed to the PC driver; the console descriptor XCL writes is unchanged):
Also confirming @YeetSkillet's finding: the clear value has to go through With 1–3 the debug layer shows none of these, and the "invalid call" removal is gone. Patch (real.rs, ~100 lines)@@ dev_create_srv_x
- let Some(slot) = super::console_heap::slot(cpu) else { return f(this, res, desc, cpu) };
+ let mut keep = std::mem::MaybeUninit::uninit();
+ let desc_pc = pc_view(desc, &mut keep);
+ let mut keep2 = std::mem::MaybeUninit::uninit();
+ let desc_pc = pc_depth_srv(res, desc_pc, &mut keep2);
+ let Some(slot) = super::console_heap::slot(cpu) else { return f(this, res, desc_pc, cpu) };
@@
- f(this, res, desc, slot.pc_srv);
+ f(this, res, desc_pc, slot.pc_srv);
@@ dev_create_uav_x
_ => (res, counter, desc),
};
+ let mut keep = std::mem::MaybeUninit::uninit();
+ let desc_pc = pc_view(desc_pc, &mut keep);
+ let mut keep2 = std::mem::MaybeUninit::uninit();
+ let desc_pc = pc_uav_plane(res_pc, desc_pc, &mut keep2);
let Some(slot) = super::console_heap::slot(cpu) else { return f(this, res_pc, counter, desc_pc, cpu) };
@@ dev_create_uav_x, the SRV for dim == 4
- g(this, res, &srv, slot.pc_srv);
+ let (mut keep, mut keep2) = (std::mem::MaybeUninit::uninit(), std::mem::MaybeUninit::uninit());
+ g(this, res, pc_depth_srv(res, pc_view(&srv, &mut keep), &mut keep2), slot.pc_srv);
@@ overrides(Kind::Device)
("CreateRenderTargetView", dev_create_rtv as usize),
+ ("CreateDepthStencilView", dev_create_dsv as usize),
@@ new helpers
+/// A view desc (SRV / UAV / RTV / DSV: the DXGI format comes first) with the console-only
+/// formats as the PC's (`device_x::pc_format`, D16S8 118/119/120 → 45/46/47) for the PC driver;
+/// the console descriptor XCL writes keeps the title's.
+unsafe fn pc_view<T: Copy>(desc: *const T, keep: &mut std::mem::MaybeUninit<T>) -> *const T {
+ if desc.is_null() {
+ return desc;
+ }
+ let mut d = desc.read_unaligned();
+ let f = &mut *(&mut d as *mut T as *mut u32);
+ let pc = super::device_x::pc_format(*f);
+ if pc == *f {
+ return desc;
+ }
+ *f = pc;
+ keep.write(d);
+ keep.as_ptr()
+}
+
+/// An SRV of a depth buffer as the PC wants it: the console reads a depth buffer's depth or
+/// stencil through plain formats; the PC needs the plane formats and plane slice.
+unsafe fn pc_depth_srv(res: *mut c_void, desc: *const D3D12_SHADER_RESOURCE_VIEW_DESC, keep: &mut std::mem::MaybeUninit<D3D12_SHADER_RESOURCE_VIEW_DESC>) -> *const D3D12_SHADER_RESOURCE_VIEW_DESC {
+ use windows::Win32::Graphics::Dxgi::Common::*;
+ let (Some(v), Some(r)) = (desc.as_ref(), ID3D12Resource::from_raw_borrowed(&res)) else { return desc };
+ let rf = r.GetDesc().Format;
+ let d24 = rf == DXGI_FORMAT_D24_UNORM_S8_UINT || rf == DXGI_FORMAT_R24G8_TYPELESS;
+ let d32 = rf == DXGI_FORMAT_D32_FLOAT_S8X24_UINT || rf == DXGI_FORMAT_R32G8X24_TYPELESS;
+ if !d24 && !d32 {
+ return desc;
+ }
+ let stencil = matches!(v.Format, DXGI_FORMAT_R8_UINT | DXGI_FORMAT_R8_TYPELESS | DXGI_FORMAT_X24_TYPELESS_G8_UINT | DXGI_FORMAT_X32_TYPELESS_G8X24_UINT);
+ let format = match (d24, stencil) {
+ (true, false) => DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ (true, true) => DXGI_FORMAT_X24_TYPELESS_G8_UINT,
+ (false, false) => DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
+ (false, true) => DXGI_FORMAT_X32_TYPELESS_G8X24_UINT,
+ };
+ if format == v.Format {
+ return desc;
+ }
+ let mut d = *v;
+ d.Format = format;
+ let plane = stencil as u32;
+ match d.ViewDimension {
+ D3D12_SRV_DIMENSION_TEXTURE2D => d.Anonymous.Texture2D.PlaneSlice = plane,
+ D3D12_SRV_DIMENSION_TEXTURE2DARRAY => d.Anonymous.Texture2DArray.PlaneSlice = plane,
+ _ => {}
+ }
+ keep.write(d);
+ keep.as_ptr()
+}
+
+/// A UAV of plane 1 of a resource the PC has with one plane (a stencil plane on the console)
+/// as plane 0.
+unsafe fn pc_uav_plane(res: *mut c_void, desc: *const D3D12_UNORDERED_ACCESS_VIEW_DESC, keep: &mut std::mem::MaybeUninit<D3D12_UNORDERED_ACCESS_VIEW_DESC>) -> *const D3D12_UNORDERED_ACCESS_VIEW_DESC {
+ use windows::Win32::Graphics::Dxgi::Common::*;
+ let Some(v) = desc.as_ref() else { return desc };
+ // (no resource: a null view, which has one plane)
+ let rf = ID3D12Resource::from_raw_borrowed(&res).map_or(DXGI_FORMAT_UNKNOWN, |r| r.GetDesc().Format);
+ if matches!(rf, DXGI_FORMAT_D24_UNORM_S8_UINT | DXGI_FORMAT_R24G8_TYPELESS | DXGI_FORMAT_D32_FLOAT_S8X24_UINT | DXGI_FORMAT_R32G8X24_TYPELESS) {
+ return desc;
+ }
+ let mut d = *v;
+ match d.ViewDimension {
+ D3D12_UAV_DIMENSION_TEXTURE2D if d.Anonymous.Texture2D.PlaneSlice != 0 => d.Anonymous.Texture2D.PlaneSlice = 0,
+ D3D12_UAV_DIMENSION_TEXTURE2DARRAY if d.Anonymous.Texture2DArray.PlaneSlice != 0 => d.Anonymous.Texture2DArray.PlaneSlice = 0,
+ _ => return desc,
+ }
+ keep.write(d);
+ keep.as_ptr()
+}
+
+/// CreateDepthStencilView: as on the PC, with the view's console format as the PC's (`pc_view`)
+unsafe extern "system" fn dev_create_dsv(this: *mut c_void, res: *mut c_void, desc: *const D3D12_DEPTH_STENCIL_VIEW_DESC, handle: usize) {
+ type F = unsafe extern "system" fn(*mut c_void, *mut c_void, *const D3D12_DEPTH_STENCIL_VIEW_DESC, usize);
+ let f: F = std::mem::transmute(orig_fn(this, slot_of(this, "CreateDepthStencilView")));
+ let mut keep = std::mem::MaybeUninit::uninit();
+ f(this, res, pc_view(desc, &mut keep), handle);
+}
@@ dev_create_rtv
- f(this, res, desc, handle);
+ let mut keep = std::mem::MaybeUninit::<D3D12_RENDER_TARGET_VIEW_DESC>::uninit();
+ f(this, res, pc_view(desc as *const D3D12_RENDER_TARGET_VIEW_DESC, &mut keep) as *const c_void, handle);🤖 Generated with Claude Code |
|
Tested 595b2b7 merged onto main 956a476 on an RTX 3090 (driver 616.92), Windows 11 26300, Ryzen 9 5950X. AI-assisted test report (Claude); tests run locally as stated; the diff was read in full before running. |
|
The stencil-plane alias still reaches the PC with plane 0. I tested PR head
The SRV probe creates a real 16×16 The two tests copied verbatim from the PR cannot compile on main because their new helpers are absent. The last two rows use the same independently compiled probes on both revisions. The SRV probe captures arguments only. GPU sampling, retail content and merge-onto-main were outside this run. AI-assisted review. |
Built at creation, GTA VI's thousands of compute pipelines took 60+ GB of commit in AMD's driver within a minute and the game never left its loading screen (no dispatch at all in 80 s). The device removal this deferral once caused was not the deferral: invalid UAVs of depth buffers (fixed in ivall#163) used by the dispatches it let the game reach. With both, GTA VI reaches its title screen and menus. `XCL_LAZY_COMPUTE=0` builds them at creation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA
|
Closing as covered on main - thanks, this chain is what got the title to its menu. On main (38b05b7, eaa36b6) the retail game now reaches its first menu at 30 fps with ~19 GB of commit, checked on an RX 9070; |
Problem
GTA VI (retail, GDK) stops on two assertions while creating its render targets:
+0x344196: its 2560x1440 depth buffer isDXGI_FORMAT_D16_UNORM_S8_UINT(118, console only) withALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS.GetResourceAllocationInforeturned no size, because the PC driver refuses both the format and the depth + UAV pair.+0x14a6390: its 768x768x6 shadow maps (D16, depth + UAV) are placed with theUNORDERED_ACCESSinitial state, and the PC refuses that state (0x80070057).Change
pc_format: 118 / 119 / 120 (D16S8 family) → 45 / 46 / 47 (D24S8 family). Applied inpc_resource_descand inpc_topology_type(pipelines' DSV/RTV formats; the driver refused GTA VI's pipelines with DSV 118).pc_resource_desc: a depth-stencil resource dropsALLOW_UNORDERED_ACCESS(a plain UAV texture keeps it).create_placed_resource_x: such a depth buffer'sUNORDERED_ACCESSinitial state becomesDEPTH_WRITE.Overlaps with the format part of #150 (D16S8 → D24S8). Whichever lands first, I'll rebase the other.
Result
GTA VI goes past both assertions. On top of 956a476 it then runs at 30 fps like
main(checked:main+ this PR, 600 frames at 29.4 fps after 36 s).Test plan
cargo test --release -p xcl --lib: newconsole_depth_buffers_become_pc_onespasses; onlygpu_wave64_ps_whole_wave_reductionsfails, as onmain+0x344196/+0x14a6390🤖 Generated with Claude Code
https://claude.ai/code/session_01XTYmP6vKUQKatSiA2PC95B