Repository navigation
Conversation
|
Review (head d310d83, diff read, not a merge-check):
Suggested verdict: not yet (show the bug, measure the cost). (Review written with Claude Code, Claude Opus 5.5.) |
bmjask
left a comment
There was a problem hiding this comment.
Review of d310d833: 4 finding(s). 3 are inline. These are on lines outside the diff:
crates/xcl/src/hle/d3d12x/real.rs:3724: This only covers views with no PC view at all. Paths that publish one half still leave the other half naming the old resource. If a slot holds an SRV and a UAV of tex and the title makes a buffer UAV in it, publish(uav=true, buf) gives names (tex, buf), and the SRV half and its mirror still name tex. A CopyDescriptors of the slot then carries tex into the destination, and resource_gone counts it. Null-resource SRV paths that publish only the SRV half behave the same. A single "slot overwritten" step in slot creation (clear both halves, then publish the new one) would fix every path.
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.
| return; | ||
| }; | ||
| let _w = SLOT_WRITES.lock().unwrap(); | ||
| copy_views(&dev, 2, pc_srv, nulls_cpu); |
There was a problem hiding this comment.
clear_views writes null views into the shared-heap SRV/UAV pair at the slot's index, but the module documents that titles keep T#s, each holding a shared-heap index, in their own memory. If a title makes a texture SRV in slot k, copies the T# words into a material table, then reuses slot k for a CBV, the copied T# still samples the texture on the console. Before this PR the PC shared index still held the live view. Now it's null, so the material renders black. This might also be related to the 1695 -> 1554 frames in the PR's smoke run.
| // translated shaders read BVH nodes from UMA (`bvh_intersect`), never from a PC DXR SRV, | ||
| // so write the RDNA2 BVH descriptor directly and skip forwarding the console VA to PC. | ||
| if let Some(v) = desc.as_ref().filter(|v| v.ViewDimension == D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE) { | ||
| super::console_heap::clear_views(&slot); |
There was a problem hiding this comment.
The !s.sampler guard was added to the buffer branches of #70/#71 but not to the RTAS branch, which this PR also touches. dev_create_srv_inner takes console_heap::slot(cpu) with no sampler filter. clear_views returns early for samplers, then console_heap::write(&slot, &[bvh w0..w3,0,0,0,0]) writes 4 words over the S#, including word 3 [11:0], the PC sampler index. Later samples through that slot use a garbage sampler index, which is the defect this PR fixes for #70/#71.
| return; | ||
| } | ||
| note_resource(s, 0); | ||
| if s.shared_srv == 0 || names_of(s) == (0, 0) { |
There was a problem hiding this comment.
The early return when shared_srv == 0 or names_of(s) == (0, 0) skips nulling the mirror descriptors at pc_srv/pc_uav, even if they hold a live view. If slot k got its views via CopyDescriptors from a source with no shared place (names (0,0)), the mirror holds tex while NAMES says 0. A CBV over k skips the clear, and a later copy of k publishes the mirror's tex view into another shared index with NAMES 0. resource_gone(tex) never nulls it, so after tex is released the shared heap keeps a descriptor of a destroyed resource. Nulling the mirror needs no GLOBAL state and could be done unconditionally.
|
Closing: conflicts in |
Clear stale PC SRV/UAV descriptors and
NAMEStracking when a console view slot is overwritten by a UMA-only view (CBV, raytracing acceleration structure, or buffer view by address), and guard buffer-by-address descriptor writes against sampler-heap slots.What is in it
crates/xcl/src/hle/d3d12x/console_heap.rs:clear_views(s: &Slot)to clearnote_resourceand, whenever a view slot previously tracked a live resource orGONE(names_of(s) != (0, 0)), null both its title-heap mirror descriptors (pc_srv,pc_uav) and its shared-heap descriptors (dst,dst + inc) and reset bothNAMESentries to0using the sameHEAPS -> GLOBALlease +SLOT_WRITESlock order aspublish. Slots already at(0, 0)return immediately with two relaxed atomic loads and no locks or D3D12 calls.crates/xcl/src/hle/d3d12x/real.rs:console_heap::clear_views(&slot)fromdev_create_cbv_x, theD3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTUREbranch ofdev_create_srv_inner, and theBUFFERbranches ofdev_create_srv_at_x(#70) anddev_create_uav_at_x(#71)..filter(|s| !s.sampler)) in the buffer branches ofdev_create_srv_at_xanddev_create_uav_at_x, matchingdev_create_cbv_x.stale_view_clear_tests::cbv_bvh_and_buffer_view_at_clear_stale_pc_views_and_skip_sampler_slotscovering all four overwrite paths, subsequentCopyDescriptorsSimple,resource_gonereporting0stale slots, and sampler-slot preservation.Tested
cargo test -p xcl --lib -- hle::d3d12x::real::stale_view_clear_tests::):slot 0 must not retain stale tex reference after overwrite/copy((tex, tex)instead of(0, 0)).1 passed; 0 failed(0.23s, zero debug-layer errors).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::2600 passed; 0 failed; 49 ignored(324.5s).SKIPPED:1(1no heap windows).Regression run
Baseline (
mainancestorf0e8fdd5c3942ddd399d5ee11384c8595c5aacff) and this PR (d310d833960f51efbe0f9362e958c4a8e4e7f3b6), 150 s on RTX 5070 Ti:Not tested
shared_srv == 0) console view heaps that are never registered intoGLOBAL.test_title_runs_and_game_folder_is_untouchedanduma_driver::tests::were skipped in the workspace test run.AI use