D3D12.X & GPU: raytracing SRVs, 64-bit multi-window BVH traversal, and title-list BVH builder slots #25

Merged
raylitebull merged 1 commit from upstream-pr/26 into main 2026-11-22 10:15:14 +00:00
raylitebull commented 2026-11-22 00:22:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-22T00:22:44Z.


Summary

Improves inline raytracing / BVH readiness on default title command lists and multi-window UMA without guessing unverified DXR 1.0 console vtable slots:

  • Acceleration-structure SRVs in console descriptor heaps (gpu/desc.rs, hle/d3d12x/real.rs, console_heap.rs):
    • Added desc::bvh_words(address, box_sort) to encode the 4-dword RDNA2 BVH SRSRC (w[3] >> 28 < 8 so CopyDescriptors leaves it verbatim instead of renumbering it as a T# image).
    • Updated dev_create_srv_x to handle D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE (pResource == NULL, Location == console VA) directly rather than forwarding a console VA to PC and zeroing the console slot.
  • 64-bit multi-window image_bvh64_intersect_ray & AABB edge cases (gpu/recomp/emit.rs, gpu/bvh.rs):
    • Updated image_bvh64_intersect_ray to use both vaddr[0] and vaddr[1] with the 48-bit BVH base address when selecting the UMA memory window ((uint)(addr >> 32)), so BVH nodes in windows 1-3 (including sparse title memory) resolve cleanly.
    • Fixed axis-aligned grazing rays (o == mn / o == mx with d == 0, inv == ±inf causing 0 * inf = NaN) and rejected NaN-disabled / inverted (mn > mx) child boxes in both HLSL bvh_intersect and CPU bvh::intersect_node.
    • Added bvh::prebuild_size (matching XboxBvhBuilder.dll) and bvh::is_compressed_header.
  • Default title command list slots for XboxBvhBuilder.dll (hle/d3d12x/real.rs, bind.rs, list_x.rs):
    • Wired command list slots #146 (global UAV barrier) and #148 (AllocateUploadMemory in UMA, freed on allocator reset) into default title_list command lists, and sized extended vtables to cover the highest slot in console_slots / console_remap.
  • Configurable CheckFeatureSupport(D3D12_OPTIONS5) reporting (config.rs, real.rs, null.rs):
    • Added raytracing config option (auto, tier1_1, tier1_0, off; XCL_RAYTRACING overrides) and one-time logging of the reported RaytracingTier.

Testing

  • cargo test --workspace -- --test-threads=4: all unit, GPU recompiler, and xcl_testtitle e2e checks pass.
  • Added unit tests for desc::bvh_words, console-heap BVH descriptor copies, bvh::prebuild_size / is_compressed_header, grazing rays & NaN/inverted boxes, and parse_raytracing_tier.
  • Added GPU test gpu_bvh64_intersect_ray_across_memory_windows_and_grazing (2 UMA windows above 4 GiB).
  • Added testtitle e2e check gpu::raytracing_surface covering OPTIONS5 (12 B and 16 B probes), RAYTRACING_ACCELERATION_STRUCTURE SRV descriptor output, and #148 / #146 on a default title list.
<!-- greyfinch-sync:ivall/xcl:issue:5433966487 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/26). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-22T00:22:44Z. --- ## Summary Improves inline raytracing / BVH readiness on default title command lists and multi-window UMA without guessing unverified DXR 1.0 console vtable slots: - **Acceleration-structure SRVs in console descriptor heaps (`gpu/desc.rs`, `hle/d3d12x/real.rs`, `console_heap.rs`)**: - Added `desc::bvh_words(address, box_sort)` to encode the 4-dword RDNA2 BVH SRSRC (`w[3] >> 28 < 8` so `CopyDescriptors` leaves it verbatim instead of renumbering it as a T# image). - Updated `dev_create_srv_x` to handle `D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE` (`pResource == NULL`, `Location == console VA`) directly rather than forwarding a console VA to PC and zeroing the console slot. - **64-bit multi-window `image_bvh64_intersect_ray` & AABB edge cases (`gpu/recomp/emit.rs`, `gpu/bvh.rs`)**: - Updated `image_bvh64_intersect_ray` to use both `vaddr[0]` and `vaddr[1]` with the 48-bit BVH base address when selecting the UMA memory window (`(uint)(addr >> 32)`), so BVH nodes in windows 1-3 (including sparse title memory) resolve cleanly. - Fixed axis-aligned grazing rays (`o == mn` / `o == mx` with `d == 0`, `inv == ±inf` causing `0 * inf = NaN`) and rejected `NaN`-disabled / inverted (`mn > mx`) child boxes in both HLSL `bvh_intersect` and CPU `bvh::intersect_node`. - Added `bvh::prebuild_size` (matching `XboxBvhBuilder.dll`) and `bvh::is_compressed_header`. - **Default title command list slots for `XboxBvhBuilder.dll` (`hle/d3d12x/real.rs`, `bind.rs`, `list_x.rs`)**: - Wired command list slots `#146` (global UAV barrier) and `#148` (`AllocateUploadMemory` in UMA, freed on allocator reset) into default `title_list` command lists, and sized extended vtables to cover the highest slot in `console_slots` / `console_remap`. - **Configurable `CheckFeatureSupport(D3D12_OPTIONS5)` reporting (`config.rs`, `real.rs`, `null.rs`)**: - Added `raytracing` config option (`auto`, `tier1_1`, `tier1_0`, `off`; `XCL_RAYTRACING` overrides) and one-time logging of the reported `RaytracingTier`. ## Testing - `cargo test --workspace -- --test-threads=4`: all unit, GPU recompiler, and `xcl_testtitle` e2e checks pass. - Added unit tests for `desc::bvh_words`, console-heap BVH descriptor copies, `bvh::prebuild_size` / `is_compressed_header`, grazing rays & NaN/inverted boxes, and `parse_raytracing_tier`. - Added GPU test `gpu_bvh64_intersect_ray_across_memory_windows_and_grazing` (2 UMA windows above 4 GiB). - Added `testtitle` e2e check `gpu::raytracing_surface` covering `OPTIONS5` (12 B and 16 B probes), `RAYTRACING_ACCELERATION_STRUCTURE` SRV descriptor output, and `#148` / `#146` on a default title list.
upstream-sync closed this pull request 2026-11-24 06:56:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!25
No description provided.