Repository navigation
Conversation
|
merge-check AI-written and posted by Foniass without a human check of each point. |
bmjask
left a comment
There was a problem hiding this comment.
Review of 5dc64ea7: 2 finding(s). 2 are inline.
These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
| @@ -511,6 +510,9 @@ pub unsafe fn shared_heap(dev: &ID3D12Device) -> bool { | |||
| fill_nulls(dev, cpu, inc, crate::gpu::recomp::MEM_HEAP_BASE, cap, at); | |||
There was a problem hiding this comment.
The fix for slots 20/21 looks right, but fill_nulls still starts at MEM_HEAP_BASE, so it writes Texture2D null SRV/UAVs over the window slots 4..19, which are reserved for raw buffer UAVs too. set_window_views only rewrites windows.len().max(MAX_WINDOWS) slots (4 for a normal layout), so slots 8..19 keep Texture2D nulls. A heap-windows shader that reaches window k >= count (a cached PSO translated for a wider layout, or the #3096 expansion) hits the same type mismatch this PR fixes for 20/21 (GBV 939/941, undefined on hardware). Starting fill_nulls at MEM_NULL_STORE + 1 (where Global.next starts), and having null_window_views write raw null UAVs for all of MEM_HEAP_BASE..=MEM_NULL_STORE once, would fix the whole region.
| }); | ||
| // Written after `fill_nulls` so the two out-of-layout raw buffer null UAVs at | ||
| // `MEM_NULL_LOAD` and `MEM_NULL_STORE` are not overwritten with Texture2D null SRV/UAVs. | ||
| null_window_views(dev, cpu, inc); |
There was a problem hiding this comment.
Not certain about this one: with slots 20/21 holding raw buffer UAVs again, a stale or garbage T# index that lands on them reaches a raw UAV through a Texture2D access. The image guard only checks tw0 < VIEW_HEAP_MAX_SRV, with no lower bound past the window region. A T# with word 0 = 20 indexes ResourceDescriptorHeap[20] as Texture2D and [21] as RWTexture2D and finds a 4-byte raw buffer UAV. The MEM_HEAP_BASE doc already records that a raw buffer UAV read as a texture hangs NVIDIA GPUs, and the shared_heap comment's promise that garbage T# indexes read zeros no longer holds for 4..21.
Write the shared view heap's out-of-layout null raw buffer UAVs (
MEM_NULL_LOADandMEM_NULL_STORE) afterfill_nullsinconsole_heap::shared_heap(crates/xcl/src/hle/d3d12x/console_heap.rs), sofill_nullsno longer overwrites those twoRWByteAddressBuffernull UAV slots withTexture2Dnull SRV/UAV descriptors.What is in it
crates/xcl/src/hle/d3d12x/console_heap.rs:null_window_views(dev, cpu, inc)after thefill_nulls(dev, cpu, inc, MEM_HEAP_BASE, cap, at)pass inshared_heap. Previouslynull_window_viewsran first andfill_nullsimmediately overwroteMEM_NULL_LOAD(even index20) with aTexture2Dnull SRV andMEM_NULL_STORE(odd index21) with aTexture2Dnull UAV, causing descriptor-type mismatches wheneverXCL_HEAP_WINDOWS=1shaders redirected out-of-layout memory loads/stores to those slots (set_window_viewsonly writesMEM_HEAP_BASE..MEM_NULL_LOAD).ID3D12Debug1::SetEnableGPUBasedValidation(true)) testhle::d3d12x::console_heap::tests::shared_heap_preserves_null_window_raw_uavsthat initializesshared_heap, dispatches a Direct DXIL SM 6.6 compute shader accessingResourceDescriptorHeap[MEM_NULL_LOAD]andResourceDescriptorHeap[MEM_NULL_STORE]asRWByteAddressBuffer, verifies readback (0 ^ 0xA5A5_5A5A), and asserts0D3D12 debug/GBV errors.Tested
console_heaptests (cargo test -p xcl --lib -j 4 -- hle::d3d12x::console_heap::andcargo test -p xcl --test console_heap_contract -j 4):shared_heap_preserves_null_window_raw_uavsfailed on WARP+GBV with two D3D12 GPU-based validation errors ([id=939]Descriptor Heap Index: [20], Descriptor Type in Heap: D3D12_DESCRIPTOR_RANGE_TYPE_SRV, Register Type: D3D12_DESCRIPTOR_RANGE_TYPE_UAVand[id=941]UAV Dimension Expected: D3D12_UAV_DIMENSION_BUFFER, UAV Dimension In Descriptor: D3D12_UAV_DIMENSION_TEXTURE2D, Descriptor Heap Index: [21]).26 passed; 0 failed(0.27s) inhle::d3d12x::console_heap::(includingshared_heap_preserves_null_window_raw_uavswith0GBV errors and0xA5A5_5A5Areadback) and9 passed; 0 failed(0.01s) inconsole_heap_contract.rustc 1.99.0, RTX 5070 Ti driver32.0.16.1074, DXC1.9.2609.5):cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests::2610 passed; 0 failed; 49 ignored(128.2s).SKIPPED:26runtimeSKIPPEDlines (21wave64-only checks on this wave32 RTX 5070 Ti,3wave32 per-lane#1426op refusals,2heap-windows opt-in checks).Regression run
Baseline (
mainancestorf0e8fdd5c3942ddd399d5ee11384c8595c5aacff) and this PR (5dc64ea70b240d48ee0da31b1deff64ae1260710), 150 s on RTX 5070 Ti:Not tested
set_window_viewsslot expansion pastwindows.len().max(MAX_WINDOWS)(left untouched for#3096).AI use