[Architecture] Native Hardware Ray Tracing (DXR 1.1 RayQuery + BVH Optimization) #339
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T13:38:30Z.
Goal
Bring MiniVI's ray-tracing path from software-emulated BVH (~3.5 fps) to fast, playable RT across NVIDIA RTX, AMD RDNA, and Intel GPUs — developed in small, isolated PRs gated behind
VICTORY_HW_RT=1(off by default until verified) so the RT-off track in #276 never regresses.Staged Roadmap
Phase 1 — Software BVH & AMD Fast Wins
docs/fork-ray-tracing.md) without adding a 20 ms frame stall.global_loadand optimize DXIL BVH traversal + unified BVH arena pool (GPL-3.0 reference:ReTerryDavis/ReVIctorycommit925ac0a).VICTORY_BVH_HARDWARE) on RDNA 2/3/4 GPUs (GPL-3.0 reference:lobomfz/VIctory-xmem).VICTORY_MEMORY_CARD_MBwith MiniVI's sparse VRAM pool so 8–12 GB GPUs avoid shared-memory thrash.Phase 2 — Native DXR 1.1 Acceleration Structures (
VICTORY_HW_RT=1)xboxbvh.rs) and host DXR 1.1 BLAS/TLAS registry (hwrt.rs) keyed by console GPU VA.D3D12_RAYTRACING_TIER_1_1and Shader Model 6.5/6.6 with graceful fallback when unsupported.D3D12_RAYTRACING_INSTANCE_DESC::AccelerationStructurepointers from console VAs to host BLAS GPU VAs.TrustNo1-Coder/Darner(Codeberg:hwrt.rs,xboxbvh.rs) andreadmet3xt-lab/foxhound(hwrt.rs,xboxbvh.rs).Phase 3 — Native SM 6.6
RayQueryShader Lifting (VICTORY_HW_RT=1)RayQueryemitter (emit/rayquery.rs:AllocateRayQuery,TraceRayInline,Proceed,CommittedStatus,CommittedRayT, instance/geometry/primitive accessors) with unit + DXIL validator tests.image_bvh64_intersect_rayandimage_bvh_intersect_ray), including inlined non-opaque candidate callbacks, with automatic fallback to software BVH for unmatched loops.TrustNo1-Coder/Darner(Codeberg:emit/rayquery.rs) andreadmet3xt-lab/foxhound(emit/rayquery.rs).Coordination & Guardrails
feat/hw-rt-*branches (VICTORY_HW_RT=1off by default while incubating) so merge conflicts with #276 stay minimal.cargo testand DXIL validation for offline verification; never run concurrent live GPU sessions alongside the main core track.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T13:50:26Z.
Phased Implementation & PR Breakdown
Baseline state inspected on
main:SLOT_VIEW_ADDRESSES(251) andUSER_VIEW_ADDRESS(0x101) are already wired,VICTORY_RT_MEMORY_MB/VICTORY_MEMORY_CARD_MBexist independently, andVICTORY_MEMORY_NEARcaches dominating page lookups. The following clean, isolated PR sequence implements the three phases cleanly (all DXR 1.1 changes strictly gated behindVICTORY_HW_RT=1, off by default):Phase 1 — Software BVH & Memory Wins
feat/hw-rt-phase1-shader-bvh-opt) — DXIL BVH Traversal &global_load_*Coalescing (purevictory-shader, zero RT-off runtime impact):bvh_memoryinside both the lane guard andkind < 6so inactive lanes and kind6/7misses never touchSLOT_MEMORY/SLOT_FAULTSor widen descriptor waterfalls.16dwords,align = 16) into a single fetch forkind < 6before diverging on box vs triangle, and extract triangle vertices in registers (first_all[0..15]+first_all[15]) instead of issuing dependent loads.bvh_test_box) and before loading the second 64 bytes of 32-bit box nodes to reduce live VGPRs and PHIs acrossjoin.global_load_*onMEMORYinbegin_guarded, coalesce consecutive same-base/same-guardglobal_load_*runs within 256 bytes (try_global_load_cluster), use wave-uniform heap handles fors_load_dword*(memory_smem), and replaceURemwith power-of-2 bitmask + select forSLOT_FAULTShashing (GPL-3.0 ref:ReTerryDavis/ReVIctorycommit925ac0a).feat/hw-rt-phase1-arena-pool) — Unified BVH Arena Pool & VRAM Budget Coordination (behindVICTORY_BVH_ONE_ARENA,victory-gpu):ArenaPool,map_buffer_tiles) to collapse non-uniform BVH waterfalls into one descriptor slot, reuse a 64 KiB scratch buffer, skipGetWriteWatchon cold static chunks, and move fullSLOT_FAULTSto a GPU-local sink (GPL-3.0 ref:ReTerryDavis/ReVIctory925ac0a).VICTORY_RT_MEMORY_MB/VICTORY_MEMORY_CARD_MBagainstpool.rs/residency.rsbudgets to avoid shared-memory thrash on 8–12 GB GPUs.feat/hw-rt-phase1-bvh-sync) — Dynamic BVHSIZESReadback Sync & AMDVICTORY_BVH_HARDWAREFeasibility:asks_size/copyback) without a 20 ms frame stall.lobomfz/VIctory-xmem(VICTORY_BVH_HARDWARE): determine whether any portable optimizations apply cleanly on D3D12 (note custom opcode0x5642_4836requires a patched Mesa RADV shader compiler on Linux and cannot pass D3D12/DXIL validation on standard Windows drivers, making Phase 2/3 DXR 1.1RayQuerythe portable HW-RT path on RDNA 2/3/4, RTX, and Intel).Phase 2 — Native DXR 1.1 Acceleration Structures (
VICTORY_HW_RT=1)feat/hw-rt-phase2-registry-hle) — HLExboxbvhInterposer & Core DXR 1.1 BLAS/TLAS Registry:crates/victory-hle/src/modules/xboxbvh.rs(clean-room GPL-3.0 adaptation fromTrustNo1-Coder/Darner&readmet3xt-lab/foxhound) andcrates/victory-gpu/src/hwrt.rsgated onVICTORY_HW_RT=1,D3D12_RAYTRACING_TIER_1_1, and SM 6.5/6.6.D3D12_RAYTRACING_INSTANCE_DESC::AccelerationStructureaddresses.feat/hw-rt-phase2-mesh-decoders) — Console BVH Geometry Decoders & Telemetry:IndexFormat == 53,VertexFormat == 16), readable-memory fallbacks, shader-cache key wiring, andF1overlay status.Phase 3 — Native SM 6.6
RayQueryShader Lifting (VICTORY_HW_RT=1)feat/hw-rt-phase3-dxil-rayquery) —emit/rayquery.rsDXIL Intrinsics & Validator Tests:AllocateRayQuery,TraceRayInline,Proceed,CommittedStatus,CommittedRayT, and candidate/committed instance/geometry/primitive accessors +SFI0RAYTRACING_TIER_1_1flag, with unit anddxil.dllvalidation tests.feat/hw-rt-phase3-traversal-lifter) — Traversal-Loop Lifter, Candidate Callbacks & Shadow-Mask Check:image_bvh64_intersect_rayandimage_bvh_intersect_ray), including inlined non-opaque candidate loops and descriptor-slot TLAS binding (SLOT_TLAS_BASE), with automatic fallback to software BVH for unmatched loops.SLOT_VIEW_ADDRESSES(251) and DXR 1.1 lifting.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:05:24Z.
Opened PR #1 (#341, \eat/hw-rt-phase1-shader-bvh-opt): coalesced 64-byte BVH fetch, register-extracted triangles, sequential low-VGPR \vh_test_box, guarded/coalesced \global_load_*\ clusters, wave-uniform \smem\ heap handles, and bitmask \SLOT_FAULTS\ hashing. Starting Phase 1b (#2: unified BVH arena pool & VRAM budget coordination).
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:20:22Z.
Opened PR #2 (following #341 CI pass) on \eat/hw-rt-phase1-arena-pool: unified reserved BVH arena pool (\VICTORY_BVH_ONE_ARENA), \Shadow::card_offset()\ propagation, cold static chunk \GetWriteWatch\ skip, \ring_buf, and aligned 8-12 GiB VRAM ceilings (\VICTORY_MEMORY_CARD_MB\ / \VICTORY_RT_MEMORY_MB\ / \card_room_for). Starting Phase 1c (PR #3: dynamic BVH \SIZES\ sync & AMD \VICTORY_BVH_HARDWARE\ audit).
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:37:16Z.
Phase 1 Complete (PRs #341, #342, #343)
All Phase 1 items are implemented in small, focused PRs off \main:
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T14:59:39Z.
Pre-Merge Audit Fixes Required (#282 comment
7349410307)The read-only static audit found confirmed P0/P1 issues in open Phase 1 PRs (
#341,#342,#343).PR check and mergeshas been asked to hold these until fixed:#341(P1 —#282finding #16):memory_smem(crates/victory-shader/src/emit/lower.rs:4453) hardcodesNonUniformIndex = falseonSLOT_MEMORYheap handles, which can mis-broadcast lane 0's arena when SGPRs diverge via waterfallv_readfirstlane_b32or divergent SGPR PHIs. Keepnonuniform = trueunless proven wave-uniform.#342(P0 —#282findings #13 & #14):by_address_in/map_buffer_tiles: allocateshared_buffer_staging(len)beforemap_buffer_tiles, and on any error afterUpdateTileMappings, unmap tiles (D3D12_TILE_RANGE_FLAG_NULL) and retireheapviahost::retireinstead of dropping it synchronously.Memory::bring_up: replace theDIRTY_WINDOW = 8/free_pages > 0heuristic with per-chunk(dirty_epoch, refreshed_epoch)tracking and ensure submit-timem.land(at)triggersshadow.refresh()on every touched/allocated chunk.#343(P1 —#282finding #17):has_pending_sizes:SIZES_SEEN+THIN_DONE < THIN_QUEUEDcauses permanent per-framebehind::drain()stalls and has aSIZES_QUEUED/THIN_DONEload-order race. Trackhas_sizesperRecordingdirectly instead.Quiet::wake(quiet.rs:90-91): always lockself.stateand resetstreak = 0even whenself.readyisfalse.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T15:02:03Z.
Phase 2 PRs are open (both gated behind \VICTORY_HW_RT=1, off by default with zero RT-off impact):
Starting Phase 3 (Native SM 6.6 DXR 1.1 \RayQuery\ Shader Lifting) next:
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T16:39:19Z.
Phase 1 Audit Fixes & Phase 3 Completion Update (
#339)Phase 1 — Audit Fixes & Rebases (
#282comment7349410307)#341(feat/hw-rt-phase1-shader-bvh-opt,3bf8fad): Rebased ontomain(3efe907, resolving thelower_tests.rsconflict) and resolved#282finding #16 viauniform_scalarshost-wave uniformity analysis (NonUniformIndex = truewhenever an address word orsoffsetmay derive fromwaterfall.reads,waterfall.loads,v_readfirstlane_b32, divergentAtom::Uniformbranches, or divergent/loop-carried SGPR PHIs), withsmem_memory_load_divergent_sgpr_keeps_nonuniform_handletest coverage. Localemit::lower::tests(27 passed; 0 failed; 1 ignored),emit::intersect_tests(11 passed; 0 failed), workspaceclippy,xtask policy, and CI (46924759840) are green (MERGEABLE).#342(feat/hw-rt-phase1-arena-pool,f204e9c): Rebased ontomain(3efe907) and resolved#282findings #13 (shared_buffer_stagingallocated beforemap_buffer_tiles; failedUpdateTileMappingspaths unmap withD3D12_TILE_RANGE_FLAG_NULLand retire heaps viahost::retire) and #14 (replacedDIRTY_WINDOW/free_pagesheuristics with monotonic(dirty_epoch, refreshed_epoch)tracking onArenaChunkanddirectoryadvancing only on actual submission refreshes, plus submit-timeland_and_refresh->host::submit_refresh->Batch::add_fresh). Local (VICTORY_D3D12_WARP=1)memory::tests(10 passed),shadow::window_tests(10 passed),host::(193 passed; 0 failed; 17 pre-existing ignored), workspaceclippy,xtask policy, and CI (46926192173) are green (MERGEABLE).#343(feat/hw-rt-phase1-bvh-sync,6b9c843): Rebased ontomain(80d3ff4) and resolved#282finding #17 (replacedSIZES_SEEN/THIN_QUEUED/THIN_DONEwith per-Recordinghas_sizesviapipeline::maybe_size_query, pairednote_queued_sizes->THIN_SIZES_DONERelease /THIN_SIZES_DONE->SIZES_QUEUEDAcquire ordering inhas_pending_sizes, filteredwake_quietto small buffers, and removed the early!self.readyreturn inQuiet::wake). Local (VICTORY_D3D12_WARP=1)list::thin::tests(13 passed),queue::behind::tests(9 passed),quiet::tests(8 passed),host::sizes::tests(2 passed),memory::tests(10 passed), workspaceclippy, andxtask policypassed (MERGEABLE, CI run46927447464running).(Per local GPU sharing guardrails, Phase 1 PRs are verified locally via WARP/DXIL unit suites and GitHub Actions CI, and are ready for the maintainer's real-GPU A/B smoke gate.)
Phase 2 — Native DXR 1.1 BLAS/TLAS & Decoders (
VICTORY_HW_RT=1, off by default)#347(feat/hw-rt-phase2-registry-hle): DXR 1.1 BLAS/TLAS registry +XboxBvhBuilder.dllHLE — CI green,MERGEABLE.#349(feat/hw-rt-phase2-mesh-decoders, basefeat/hw-rt-phase2-registry-hle): Meshlet IB (IndexFormat == 53) & quant24 VB (VertexFormat == 16) decoders, menu toggle, shader-cache key isolation, telemetry — CI green,MERGEABLE.Phase 3 — Native SM 6.6 DXR 1.1
RayQueryLifting & Dispatch Binding (VICTORY_HW_RT=1, off by default)#352(feat/hw-rt-phase3-dxil-rayquery): SM 6.6 DXILRayQueryintrinsic emitter +RTAccelerationStructure(kind = 16) — MERGED tomain(80d3ff4).#354(feat/hw-rt-phase3-traversal-lifter,6a686c5): Rebased cleanly ontomain(80d3ff4,MERGEABLE). Recognizes and lifts both BVH traversal templates (image_bvh64_intersect_rayandimage_bvh_intersect_ray), non-opaque candidate callbacks, and falls back cleanly on unhandled patterns (VICTORY_HW_RT_LIFT=0,VICTORY_HW_RT_WHY=1). Localemit::rayquery(11 passed; 0 failed) and workspaceclippy(normal &--all-features) passed.#357(feat/hw-rt-phase3-gpu-dispatch-binding,cbcfeb5, basefeat/hw-rt-phase3-traversal-lifter): Restacked cleanly onto rebased#354+#349(MERGEABLE). Wires root TLAS SRVs (pipeline/host.rs,draw.rs), descriptor-heapRT_ACCELERATION_STRUCTURESRVs (descriptor/host.rs),shader_cache.rsRayQueriesserialization,CS_RaytracingResolveenablement,hwrttelemetry, andhwrt::manager()requested()guard. Local (VICTORY_D3D12_WARP=1,VICTORY_HW_RTunset)hwrt::(27 passed),shader_cache::tests(2 passed),--features diagnosticsdescriptor::host::tests::note_buffer_populates_and_clears_view_address_table(1 passed),victory-hle::xboxbvh(2 passed),xtask(8 passed, includingrepository_passes_policy), and workspaceclippy(normal &--all-features) passed.(Clean-room GPL-3.0 references:
ReTerryDavis/ReVIctorycommit925ac0a,TrustNo1-Coder/Darner,readmet3xt-lab/foxhound.)Merge Order & Activation
main):#341,#342,#343#347->#349#352(merged) ->#354->#357(after#349lands onmain)VICTORY_HW_RTunset) for zero RT-off impact; setVICTORY_HW_RT=1on DXR 1.1 + SM 6.5/6.6 hardware to test nativeRayQueryexecution (VICTORY_HW_RT_WHY=1for lift diagnostics).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T17:00:44Z.
Audit Pass #2 Verdict (#282 comment
7352688269)#341and#342(and#352already merged). Great work on the Pass #1 fixes!#343: Pass #1 finding #17 is still unchanged (de84a1e1) — please push the per-Recordinghas_sizesflag +Quiet::wakefix.#347,#349,#357(GPU/HLE DXR 1.1): Address#282comment7352688269findings #1–#9 (especially P0 #1:Arc::strong_count(existing) == 1always true -> retainArc<HostAs>inlist.hold/Shown/BlasRefsor double/triple-buffer TLAS gated on fence; P1 #2–#8:COPY_DEST -> COMMONbarrier inemit_postbuild,mgr.blas_workstarvation whenblas.is_empty(), LRU-evicted copy sources, stale TLAS SRVs inHostHeap::mirror, removeunsafe std::env::set_varfrom parallel workers, safe title-memory copy instead of raw aliasing reads, TLASn == 0barrier).#354(DXR 1.1RayQuerylifter): Address#282comment7352688269findings #10–#20 (especially P0 #10 cache key isolation so#354is safe standalone, P0 #11–#12CallbackKind::BlocksPHI/dominance & EXEC-masked non-opaque callbacks, and P1 #13–#19 loop-invariantTMaxvsTMin,InstanceInclusionMasktruncation, live-out header PHIs, outer-loop counter PHI, Template B multi-exit latch,trace_tlas_from_shr, guardedAttrSource::Single).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T18:40:17Z.
Audit Pass #2 Resolutions — Native HW-RT Stack Ready for Final Verification
All confirmed findings from Pass #1 (
#17) and Pass #2 (#1–#20in#282comment7352688269) have been resolved and pushed across the stack:1. BVH Sync —
#343(feat/hw-rt-phase1-bvh-sync@6b9c843)SIZES_SEEN+THIN_DONE < THIN_QUEUEDchecks with a per-Recordinghas_sizesflag so only batches with BVH size queries incrementSIZES_QUEUED, and fixedQuiet::waketo unconditionally lock and resetstreak,audit,range, andready.2. GPU / HLE DXR 1.1 Runtime —
#347(5140ce4),#349(769d11c),#357(be6135a, merging#349+#354)Arc::strong_count(existing) == 1in-place reuse checks with explicitArc<HostAs>retention across command-list holds/Shown/BlasRefs/fence-gated retirement, and publish newly built TLASes toshownon submit vialist.defer_host(preventing recording-time exposure of unbuilt TLASes).emit_postbuildtransitionsShadow::bufferCOPY_DEST -> COMMONafter postbuild writes/copies.execute_opinvokesmgr.blas_workunconditionally even whenblas.is_empty()so deferredwaitingand LRUwantedrebuilds never starve.execute_copyandcopy_waitinghandle LRU-evicted copy sources cleanly.descriptor/host.rs+hwrt.rs: excludedD3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTUREfromis_texture_viewandnote_buffertexture queueing; addednull_rtas_viewinnull_forand returnedNonefromtlas_for_descriptorfor unbound/unbuilt/evicted TLASes; added per-slottlas_gen: Vec<AtomicU64>invalidation acrossHostHeap::mirror(quick,shown == keyremake, and non-pinning of null RTAS fallbacks when HW-RT is active) andunmake. Added WARP regression testrtas_srv_skips_texture_queue_accepts_null_and_invalidates_on_tlas_generation.unsafe { std::env::set_var(...) }fromhwrt::requested()and normalizedVICTORY_BVH_BUILDERinsideshader_cache::build().prepare_triangles(#347) andhwrt/decoders.rs(#349) snapshot title memory safely via fault-tolerant copies instead of aliasing live title pointers.execute_build(TLAS)n == 0pre-build UAV barrier, ordered scratch/AS lease before transitioningdst_inst_buf, and usedread_volatileonpool.stats_rb.prepare_aabbsstride &prebuild_geometry_descstiny-index validation, chunked oversized sanitize inputs (sanitize_chunks), settlas_srvsroot descriptors toD3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE, and added early return on!requested()inhwrt::note_dispatch.3. DXR 1.1 Traversal Lifter —
#354(feat/hw-rt-phase3-traversal-lifter@7ae7398)#354standalone-safe by tracking normalizedVICTORY_HW_RT=1/VICTORY_HW_RT_LIFT=0inshader_cache::build()and serializing/deserializingHostShader::ray_queriescleanly.CallbackKind::Blocksmulti-block CFG/PHI lowering (self.tail[*entry_block],merge_blockPHI materialization,CommitDecision::MergeEdges& dominance checks) and strict bailouts when EXEC-masked/branched/shadow callbacks cannot be lifted soundly.TMax(tmax_val) vsTMinidentification; unified 8-bitInstanceInclusionMaskshift/bfematching; preserved live-outorigin/dirpre-loop inputs inis_pure_bvh_internal_scratch(PreLoopInit); handled outer-loop counter back-edges (rq.latch == q && rq.exit == b); fixed Template B multi-exit latch selection (select_bvh32_exit_latch); handledtrace_tlas_from_shrdynamic2, coalesceds_load_dwordx8/x16,nonuniform, and deferreddead_sites; guardeddead_sitesandAttrSource::Single(guard && COMMITTED_STATUS == 1) + nesteds_and_saveexec/s_mov execdepth; validated non-cmpxopacity polarity +!dyn_ray_flagsFORCE_OPAQUE+Plan::is_eliminatedinline callback preservation. Added 11 regression unit +dxil.dllvalidation tests.Offline Verification (
VICTORY_D3D12_WARP=1,-j 4)#343(6b9c843):cargo test -p victory-gpu --lib -j 4 -- list::thin::tests queue::behind::tests quiet::tests host::sizes::tests memory::tests— 42 passed, 0 failed.#347(5140ce4):victory-gpu --lib -- hwrt::(26 passed, 0 failed),victory-hle --lib -- xboxbvh(2 passed, 0 failed),clippyexit0,xtask policy(328 files ok).#349(769d11c):victory-gpu --lib -- hwrt:: shader_cache::(34 passed, 0 failed),clippyexit0,xtask policy(329 files ok).#354(7ae7398):victory-shader --lib -- rayquery(22 passed, 0 failed, includingdxil.dllvalidation),victory-gpu --lib -- shader_cache::(3 passed, 0 failed),clippyexit0,xtask policy(331 files ok).#357(be6135a, full merged stack tip):VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -j 4 -- hwrt:: descriptor:: shader_cache:: pipeline::— 163 passed, 0 failed (634filtered out).VICTORY_HW_RT=1 VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -j 4 -- rtas_srv_skips_texture_queue_accepts_null_and_invalidates_on_tlas_generation— 1 passed, 0 failed.cargo test -p victory-shader --lib -j 4 -- rayquery— 22 passed, 0 failed (364filtered out).cargo test -p victory-hle --lib -j 4 -- xboxbvh— 2 passed, 0 failed (243filtered out).cargo test -p xtask -j 4— 8 passed, 0 failed.cargo clippy --workspace --all-targets -j 4 -- -D warnings— exit 0.cargo xtask policy—asset policy: 336 files ok.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T19:13:34Z.
Audit Pass #3 Verdict (#282 comment
7355749301) — Almost There!#343(6b9c8435) — ALL of Phase 1 (#341,#342,#343) is now 100% verified clean!#1,#3,#4,#6,#7,#8,#9,#10,#13,#14,#16, and#17are ALL cleanly resolved!#347/#349/#354/#357:#347/#349/#357(2 P1s + 3 P2s — Pass #3 findings#1–#5):[P1]#357: BindlessResourceDescriptorHeap[]RTAS SRVs staying null/stale +HostHeap::keptBLAS UAF / lag.[P1]#347/#349/#357:emit_postbuild+ localread_shadowsRESOURCE_BARRIER_BEFORE_AFTER_MISMATCH.[P2]#349/#357: Bounddecoders.rsvec![0u8; ...]beforeread_into;#349standaloneshader_cache.rsVICTORY_BVH_BUILDERnormalization;#357gatenull_rtas_view/should_pin_descriptoronhwrt::active().#354(2 P0s + 3 P1s + 1 P2 — Pass #3 findings#6–#11):[P0]#6:find_triangle_hit_infoPattern C EXEC-maskedCallbackKind::Blockscommits & opaque-onlytri_merge_block.[P0]#7:CallbackKind::BlocksPHI resolution zeroing live lazy-param/missing arms & aborting on unread lane-mask/SCC.[P1]#8–#10:is_pure_bvh_internal_scratchmutated live-outorigin/dirback-edge; non-callback opacity polarity droppingst.reach[search_blk]; Pattern AMergeEdgesearlybreakoninvalid.[P2]#11: Remaining edge cases.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T20:43:49Z.
Pass #3 Fixes Complete — Ready for Final Verification (
#347/#349/#354/#357)All Audit Pass #3 findings (
#1–#11from#282comment7355749301) have been resolved, verified offline with-j 4underVICTORY_D3D12_WARP=1, and pushed to their respective branches (with#347->#349and#349+#354merged cleanly into#357). Excluded#360(Finding#12) as requested.Updated PR Heads
#347(feat/hw-rt-phase2-registry-hle):a4aab82#349(feat/hw-rt-phase2-mesh-decoders):36e700b#354(feat/hw-rt-phase3-traversal-lifter):5b974f3#357(feat/hw-rt-phase3-gpu-dispatch-binding):363edc5Summary of Resolved Findings (
#1–#11)#1([P1],#357) — Bindless/dynamic RTAS SRV refresh, BLAS pin lifetime, & same-submission TLAS lag:hwrt::tlas_for_descriptorto returnOption<(u64, ID3D12Resource, Arc<dyn Any + Send + Sync>)>retainingArc<HostAs>(and itsBlasRefs).KeptView,kept_pins,pin_count,rtas_slots,rtas_count, andRtasTrackedonHostHeap;keep_view/keep_innerretires replaced or clearedArc<HostAs>pins viahost::retireoutside locks, andrelease/release_batch/unmake/make_null_inneruntrack and retire dynamic/bindless pins.mirror, including when initiallyNone/later) and dynamic (make_at_inner) RTAS slots inHostHeap::rtas_slots; addedHostHeap::refresh_rtas_slots+descriptor::refresh_rtas_heaps(), invoked afterdrop(heaps_synced)/drop(h.heaps)andlist.run_deferred()in bothHost::submitandHost::send_publishedbeforeExecuteCommandListsso bindless and dynamic slots update in-place without TLAS lag and revert to null on eviction.#2([P1],#347/#349/#357) — Per-HostListshadow buffer barrier tracking & miss return:HostList::shadow_to+HostList::shadows_common()(called inHostList::close()), removing localread_shadowssets acrossdraw.rs,indirect.rs, andhwrt.rs;PreparedBlas/ReadyBlastrackinput_shadowsandemit_postbuildtransitions throughshadow_to(COPY_DEST->COMMON).tlas_for_descriptormiss fallback toNone.#3([P2],#349/#357) — Bounded decoder & IB staging allocations:MAX_DECODE_READ_BYTES(64 MiB),alloc_zeroed/try_reserve_exactfallible allocation helpers,try_reserve_stage, and boundedread_prefix_intoacrosshwrt/decoders.rsandhwrt.rs.#4([P2],#349standalone) —VICTORY_HW_RT=1vsVICTORY_BVH_BUILDERnormalization:victory-shader'sintersect.rs(bvh_override_enabled/bvh_override_active) soVICTORY_HW_RT=1suppressesVICTORY_BVH_BUILDER=1in lockstep withshader_cache.rs.#5([P2],#357) — Gatenull_rtas_view,should_pin_descriptor,tlas_gen, &make_twinnedonhwrt::active():hwrt::requested()checks indescriptor/host.rs(tlas_genallocation,make_listed_batched,mirror,make_twinned, andnull_rtas_view) withhwrt::active().#6([P0],#354) — Pattern CCallbackKind::BlocksEXEC guards &tri_merge_blockambiguity:st.reach[site.0]comparison tocb_head(blocks.first()) and validated callback commitst.guards[site.0][site.1]dominance (bool_dominates_cb_commit), falling back cleanly on empty/ambiguous inline entry ortri_merge_blockguards and detecting opaque-onlymerge_guardvia bothmeet_seenand complementary compare predicates.#7([P0],#354) —CallbackKind::Blocks&merge_blockPHI resolution:collect_rq_needed_vals) and resolvedlazy_barycentric+paramsinputs across PHI arms before numbering, skipping unread/lane-mask/SccPHIs and refusing silently zeroing live missing arms.#8([P1],#354) —is_pure_bvh_internal_scratchvs mutated live-outorigin/dirback-edges:v_mov_b32,s_mov_b*,v_cndmask_b32,s_cselect_b*) while excluding flag registers (Scc/Vcc/Exec).#9([P1],#354) — Non-callback opacity culling polarity (st.reach[search_blk]):st.reach[search_blk]andst.guards[search_blk][ci]inq_true/q_falseselection.#10([P1],#354) — Pattern A (MergeEdges) inconsistent merge PHI rejection:breakoninvalidso allcb_predspopulatecommitsand mismatched merge PHIs fail cleanly to software BVH.#11([P2],#354) — Remaining edge cases (analyze.rs&emit_rq.rs):heap_tlas_loadsusingplan.is_eliminated(...)and non-callbackskipped_blocks; handledAtom::Uniforminbool_dominates_cb_commit; boundedfind_invariant_preloop_sourcewalk (seen.len() > 128); requiredsaved_exec.is_some()in Case 2extract_callback_region; guarded duplicate counter PHI creation inemit_rq.rs.Verification Results (Offline,
VICTORY_D3D12_WARP=1,-j 4)On final
#357head (363edc5):cargo xtask policy->asset policy: 336 files okcargo clippy --workspace --all-targets -j 4 -- -D warnings-> passed (0 warnings)VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib -j 4 -- --test-threads=1 descriptor::host::bake_flip_tests::rtas descriptor::host::bake_flip_tests::hwrt hwrt::tests indirect::tests host::uav_pool::tests host::upcheck::tests-> 37 passed, 0 failed, 18 ignoredcargo test -p victory-gpu --lib -j 4 -- hwrt:: descriptor:: indirect:: draw:: shadow:: host::uav_pool:: host::upcheck:: host::refresh_tests shader_cache::-> 237 passed, 0 failed, 26 ignoredcargo test -p victory-gpu --lib -j 4 -- pool::tests-> 20 passed, 0 failed, 1 ignoredcargo test -p victory-gpu --lib -j 4 -- host::list_upload_pool_tests-> 9 passed, 0 failedcargo test -p victory-shader --lib -j 4 -- rayquery intersect::-> 28 passed, 0 failed (including DXIL validation tests for Findings#4and#6–#11)cargo test -p victory-core -p victory-pe -p victory-hle -p victory-formats -p victory-pipeline -j 4->victory-core(15 passed),victory-formats(69 passed, 7 ignored),victory-hle(242 passed, 3 ignored +no_dll_planting1 passed),victory-pe(36 passed),victory-pipeline(13 passed), 0 failuresImported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T22:31:40Z.
Audit Pass #4 Verdict (#282 comment
7359964895) — 1 Final Fix Left!#1,#3–#11) are VERIFIED CLEAN!#357(and#347/#349/#354) before full Native DXR 1.1 merge:[P0](Pass #4 #1): Revertshadow_to/shadows_commonhooks indraw.rs,host/place.rs,indirect.rs, andhost.rs:9196(they brokeVICTORY_HW_RT=0zero-impact and caused D3D12 state mismatches onShadow::buffer). Instead, insidehwrt.rs(hwrt::active()only), write the 8–16 byteemit_postbuildresult intosh.buffervia a tiny 1-thread compute shader (SetComputeRootUnorderedAccessViewonsh.gpu(dest_va)+ plain UAV barrier, keepingShadow::bufferinCOMMON/implicit promotion everywhere).[P2](Pass #4 #2): Incrates/victory-shader/src/emit/lower/rayquery/emit_rq.rs:1126-1198(collect_rq_needed_vals), seed theworkqueue with allphi.valueincb_set/merge_blockwhereself.read_phis.contains(&phi.value)so PHI-to-PHI chains propagate transitively.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:06:23Z.
Scout Note —
TrustNo1/Darner(Codefloe, GPL-3.0)Once
#357clears final verification, worth checking33ceb0a(codefloe.com/TrustNo1/Darner): tracks a running minimum of hit distances in DXR 1.1RayQueryso only candidates closer than the committed hit run callback/shading work.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:34:52Z.
Audit Pass #4 resolved —
#357ready to merge behindVICTORY_HW_RT=1:#347/#349/#357): Reverted allshadow_to/shadows_common/shadow_stateshooks outsidehwrt;emit_postbuildnow writesShadow::buffer(COMMONvia implicit promotion) with thewrite_postbuild1-thread UAV compute shader + plain UAV barrier (VICTORY_D3D12_WARP=1+VICTORY_D3D12_DEBUG=1hwrt::36/36 pass).#354/#357): Seededcollect_rq_needed_valswithread_phisentries and transitiveresolve_rq_phi_armPHI propagation, covered bycallback_blocks_phi_to_phi_chain_propagates_lazy_param_arm(rayquery_tests24/24 pass).#347(d065fff),#349(5a50f8f),#354(e680116), and#357(5d0eedb) all pass GitHub CI (MERGEABLE) with zeroorigin/mainmerge conflicts.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T23:54:30Z.
Pass #5 Final Merge Sign-Off — PR
#357(5d0eedb) VERIFIED CLEAN (GREEN LIGHT):[P0]d065fff: Allshadow_to/shadows_commonhooks removed outsidecrates/victory-gpu/src/hwrt.rs(zeroVICTORY_HW_RT=0impact);emit_postbuild(hwrt.rs:2657-2737) cleanly runs a gated[numthreads(1, 1, 1)]compute UAV shader (write_postbuild,cs_5_1,hwrt/sanitize.rs:461-484) with 16-byte VA alignment +dst_bias,uav_barriers, andstate.replayrestoration. (Non-blocking[P2]follow-up: checkALLOW_UNORDERED_ACCESSonsh.bufferinemit_postbuildlikedraw.rs:2581-2586.)[P2]65e3d13/e680116:collect_rq_needed_vals(emit_rq.rs:1191-1193) andresolve_rq_phi_arm(emit_rq.rs:1232-1236) soundly seed and propagate transitive PHI chains inread_phis; merges (5a50f8f,7cc5837,5d0eedb) verified conflict-clean. Ready to merge behindVICTORY_HW_RT=1.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T01:24:18Z.
Scout Drop #2 —
TrustNo1/DarnerDXR 1.1 HW-RT Fixes (v2026.12.02.02, GPL-3.0)Three critical HW-RT wins from
codefloe.com/TrustNo1/Darnerto check against our newly merged#357(VICTORY_HW_RT=1):fa84f7e(CodeFloe#294, by cafe): Deferred BLAS builds must snapshot position/vertex data at queue time instead of reading live title memory that may be reused before build — fixes broken/flickering shadows, reflections, and phantom dark-wall shadows.#293(by cafe): Ensure DRED breadcrumbs are strictly OFF unless explicitly requested during HW-RT (left-on DRED cost >50% frame time:7.7 -> 18.2 fpson RTX 2080 Ti!).#214: Animated skin/clothes stretching/exploding under HW-RT +33ceb0arunning min hit distance (HWRT_MIN_T).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T09:22:54Z.
Live RTX 4060 Ti HW-RT Verification on
main(88351ce, with#378)Tested
1440DLSS Quality withVICTORY_HW_RT=1on RTX 4060 Ti 8 GB (Windows 11 26300, NVIDIA 621.24). Two exact, actionable findings:1. All 12 Gameplay RT Shaders Fell Back (
lifted 0 of 12) for 4 Specific Patterns invictory-shader/src/emit/lower/rayquery/analyze.rsEvery active RT dispatch fell back to miss/software (
lifted shaders 0, partly 0, fell back 12; per frame 0.0 dispatches all lifted, 75.0 none) due to exactly 4 analyzer rejections:bvh32 multi-exit PHI disagrees(5 shaders):45b9b6e4(0/2),2138527b(0/8),076769b8(0/4),2c42d20b(0/10),ce7d8161(0/6)bvh64: ambiguous multiple commit mechanisms inside non-opaque callback(4 shaders):1847ddce(0/5),010a8328(0/8),510704d8(0/8),c1d046aa(0/4)bvh64: cannot determine instance mask in kind==6 block(2 shaders):859b83b2(0/2),321e1587(0/3)bvh64: tri_merge_block move reach differs from search_blk(1 shader):ca3fbac9(0/7)2. Reproducible
DXGI_ERROR_DEVICE_HUNG(0x887A0006) inhwrt.rsAS Builds/Refits (~16–38s into gameplay)0shaders were lifted (0.0DXRRayQuerydispatches ran), the GPU hang (~6.8sstall afterhwrt build (13)/hwrt build (5)at ~3,536 BLAS builds / 1,975 BLAS refits / 1,290 TLAS builds) originates insidecrates/victory-gpu/src/hwrt.rsacceleration structure builds/refits/copies rather than lifted shaders.#378(ALLOW_UNORDERED_ACCESSguard on postbuild destination shadow buffers) was included in this build (88351ce), so the hang is a distincthwrt.rscommand/barrier/refit defect. Next step: capture exact D3D12 debug layer message with adiagnosticsbuild (VICTORY_D3D12_DEBUG=1) + testVICTORY_HW_RT_REFIT=0.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T09:26:14Z.
Bisect Confirmed:
VICTORY_HW_RT_REFIT=0Eliminates the0x887A0006HW-RT GPU Hang!VICTORY_HW_RT_REFIT=1(default): reproducibleDXGI_ERROR_DEVICE_HUNG(0x887A0006) 16–38s into gameplay (both withLIFT=1andLIFT=0).VICTORY_HW_RT_REFIT=0: ran full 65s gameplay (130.2stotal,10.8–11.8 fps,max_dedicated_mb=6163 / 6809,max_commit=21311 MB) with ZERO hangs / ZERO DRED / ZERO errors!PERFORM_UPDATE/ refit) path incrates/victory-gpu/src/hwrt.rsis feeding an invalid/incompatible refit geometry, scratch/source buffer, or missing UAV barrier toBuildRaytracingAccelerationStructure.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T12:21:24Z.
Milestone Update — PR #387 (\eat/hwrt-rayquery-lift-all-patterns, commit \bcbb36)
Lifted 4 \ictory-shader\ RayQuery analysis patterns in \crates/victory-shader/src/emit/lower/rayquery/analyze.rs\ (staged \ ri_merge_block\ PHIs, \kind == 6\ guarded instance masks, \vh32\ multi-exit dead/rejoin PHIs, and \ ri_merge_block\ post-waterfall reach):