D3D12.X: console_list binds RootSignature before DescriptorHeaps (#1419), ClearUAV uses uninitialized g.pc_gpu_uav after inline copy, and MSAA companion SRV / null UAV desc bugs #2461
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#2461
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@microwave805 on GitHub · 2026-11-25 19:30 UTC · original
Static audit on
main @ c7e1799found four D3D12 descriptor-heap / view validation bugs in recently merged code (#2323, #1291, #1914) that trigger D3D12 debug-layer errors or device removal (0x887A0001):1.
console_list::close()bindsSetComputeRootSignaturebeforeSetDescriptorHeaps(D3D12 #1419 / #1420)crates/xcl/src/hle/d3d12x/console_list.rs:902-906,crates/xcl/src/gpu/recomp/pso.rs:1350D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED(pso.rs:1350). D3D12 SM 6.6 requiresSetDescriptorHeapsbeforeSetComputeRootSignature(comparebind.rs:994vs1031), yetconsole_list::close()callsSetComputeRootSignature(lines 902-905) beforeensure_dispatch_heaps(line 906).ensure_dispatch_heaps(&list, &mut bound_heaps, &mut has_sampler_heap);above line 901.2.
ensure_view_heapandensure_dispatch_heapsgateglobal_heap()onXCL_HEAP_WINDOWS=1despite unconditionally settingCBV_SRV_UAV_HEAP_DIRECTLY_INDEXEDcrates/xcl/src/hle/d3d12x/list_x.rs:3697-3701,crates/xcl/src/hle/d3d12x/console_list.rs:725,crates/xcl/src/gpu/recomp/pso.rs:1350global_heap()whenpso::heap_windows()(XCL_HEAP_WINDOWS=1, OFF by default) is enabled, and neither lazily callsconsole_heap::shared_heap(dev). Under default settings, a fresh compute list (or any list afterSetDescriptorHeaps(0, NULL)) dispatching a translated shader binds onlyGLOBAL_SAMPLERwith 0 CBV/SRV/UAV heaps bound, violatingCBV_SRV_UAV_HEAP_DIRECTLY_INDEXED(D3D12 #1419 /0x887A0001).pso::heap_windows()gate atlist_x.rs:3697andconsole_list.rs:725and lazily initializeconsole_heap::shared_heap(dev)whenglobal_heap()isNone.3.
ClearUnorderedAccessView*passes uninitializedg.pc_gpu_uavwhen a title copies UAV descriptors via inline RAMmemcpy(CopyDescriptorsSimple)crates/xcl/src/hle/d3d12x/list_x.rs:4226-4232,crates/xcl/src/hle/d3d12x/console_list.rs:830-831(withconsole_heap.rs:13-20, 454-461,real.rs:2653-2656)GLOBALshared hosting active (default), creating a UAV in a CPU-only console heap publishes it intoGLOBALatc.pc_gpu_uav. When a title copies that 32-byte descriptor into a shader-visible console heap via inline RAMmemcpy(CopyDescriptorsSimple, bypassingID3D12Device::CopyDescriptors*),g.pc_gpu_uavis uninitialized (its page may even be freshly allocated on the fly byconsole_heap::slot(gpu)). Bothuav_clear_handlesandconsole_list.rs:830-831passg.pc_gpu_uavinstead ofc.pc_gpu_uav.c.shared_srv != 0 && g.shared_srv != 0(both hosted inGLOBAL), usec.pc_gpu_uavas the GPU handle.4. Invalid null UAV desc (
ArraySize = 0/WSize = 0) indev_create_uav_checked_xand non-MS companion SRV for MSAA textures inuav_companion_srvcrates/xcl/src/hle/d3d12x/real.rs:2117-2123,2480-2538,2702-2708(withdevice_x.rs:806)!pc_typed_uav_supported,dev_create_uav_checked_x(real.rs:2118-2122) constructsnull_descwith..Default::default(), leavingTexture1DArray.ArraySize == 0,Texture2DArray.ArraySize == 0, andTexture3D.WSize == 0(CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS), instead of reusingnull_uav_desc(desc.as_ref(), Some(&rd)).device_x::pc_resource_descstripsALLOW_UNORDERED_ACCESSfrom MSAA textures (samples > 1), sodev_create_uav_xemits a null PC UAV — but then creates the #1914 companion SRV (real.rs:2702-2708) with non-nullresanduav_companion_srvemits non-MSD3D12_SRV_DIMENSION_TEXTURE2D/TEXTURE2DARRAYfor a multisampled resource (CREATESHADERRESOURCEVIEW_INVALIDDESC/0x887A0001). Also, whenno_uav == trueon a non-depth typeless texture withdesc == NULLorFormat == UNKNOWN, line 2529 copies the raw*_TYPELESSformat into the SRV (CREATESHADERRESOURCEVIEW_INVALIDFORMAT).null_uav_descatreal.rs:2117-2122; inuav_companion_srv, mapdim == 4 / 5toTEXTURE2DMS / TEXTURE2DMSARRAYwhen!null_resource && rd.SampleDesc.Count > 1, and avoid emitting raw*_TYPELESSformats for non-null SRVs.AI use
main @ c7e1799and issue drafting.