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

Manually merged
github merged 1 commit from gh-pr/26/head into gh-pr/26/base 2026-11-26 04:05:00 +00:00
Owner

@⁠raylitebull on GitHub · 2026-11-22 00:22 UTC · original
raylitebull:raytracing-dxr → main · +386 −18 · 12 files · 1 commits · merged 2026-11-22 10:15 UTC

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.
**@⁠raylitebull** on GitHub · 2026-11-22 00:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/26) `raylitebull:raytracing-dxr` → `main` · +386 −18 · 12 files · 1 commits · merged 2026-11-22 10:15 UTC ## 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.
- Encode RDNA2 BVH descriptors (desc::bvh_words) for RAYTRACING_ACCELERATION_STRUCTURE SRVs in console descriptor heaps instead of zeroing the slot when pResource is NULL, and preserve them across descriptor copies.
- Fix image_bvh64_intersect_ray to use the full 64-bit node pointer (including vaddr[1]) and 48-bit BVH base address when selecting UMA memory windows, so BVH nodes above 4 GiB (including sparse title windows) resolve cleanly.
- Fix axis-aligned grazing rays (0 * inf = NaN) and reject NaN/inverted child boxes in both HLSL bvh_intersect and CPU bvh::intersect_node; add console prebuild_size and compressed-header helpers.
- Wire XboxBvhBuilder.dll command list slots #146 (global UAV barrier) and #148 (AllocateUploadMemory in UMA) into default title command lists (and size extended vtables to cover all console slots).
- Add configurable CheckFeatureSupport(D3D12_OPTIONS5) RaytracingTier reporting (config.raytracing / XCL_RAYTRACING: auto, tier1_1, tier1_0, off) with one-time tier logging in real and null backends.
- Add unit, multi-window GPU, and testtitle end-to-end tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:04:59 +00:00
github manually merged commit 0fb82c65bb into gh-pr/26/base 2026-11-26 04:05:00 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.