Ray tracing stutter: the console BVH builder fills the card, and a copy-at-its-place wait turns that into ~50 ms hitches. Native DXR prototype results #1370

Closed
opened 2026-11-28 18:18:33 +00:00 by github-bot · 18 comments
Owner

@⁠Yorivel on GitHub · 2026-11-28 18:15 UTC · original

Setup

RTX 4090, i9-14900K, 64 GB. VIctory-NVIDIA main 63b902f + #57. Series X profile, 2560x1440, DLSS quality, 30 fps cap (VICTORY_FRAME_INTERVAL_US=33333), frame generation off, ray tracing on (VICTORY_BVH_BUILDER=1). Numbers are from the 10-second log lines (fps, "the card's clock per frame", "preparing per frame, the submitting thread").

1. With ray tracing on, the card has no time left, mostly because of the builder

fps in gameplay card busy
ray tracing off 25-30 ~79 %
ray tracing on 11-18 86-94 %

A per-dispatch timestamp breakdown (local diagnostic; timestamps around every dispatch keep them from overlapping, so the absolute numbers are inflated, but the ranking holds) puts the translated XboxBvhBuilder programs first by far: caa78b8ca62bc3d6 (~200 dispatches a frame) and 28918b7150a7aad5 together were over half of the card's frame. The traversal programs (f22a76fcb967ee59 GI, 6d7fe7745ab9c6d8 reflections, the shadow programs) were a few ms each.

2. The hitches: a copy at its place whose source a flight writes

The only refusal reason for card steps in these runs is a copy at its place in a list writes what it reads, or reads or writes what it writes, 0.6-1.0 submissions a frame. The settles that follow are logged as title memory read, ~50 ms a frame in the bad stretches.

A local log of the refused submissions shows the same four copies every time:

copy from to read behind it by
56 B / 364 B 0x3e2f3f20… (in a 174 MB range fdd56d97a806bcca declares written) 0xd5d19eea0 refreshes of 0xd5d19eea0.. and of the 64 KiB block around it
240 B same buffer 0xd9079f600 two fills of 240 B (constant buffers)
4098 B same buffer 0xd5f8ed350 refreshes of that range
48 B same buffer 0xd4940fad0 refreshes of that range

fdd56d97a806bcca (compute), ab619d0b7b7684d2 and ed8559670386bfe1 also run with ray tracing off (bound in 13 of 13 RT-off runs), where the same copies cost ~0.1 ms of waiting a frame: the card has long finished that program when the copy's submission is prepared. With ray tracing on, the card still has most of a frame queued, so the wait is most of a frame.

With VICTORY_PLACED_READS=1 the fills are taken on the card from the copy's source as designed, and the refusal becomes a step other than a fill done on the card reads what a copy at its place writes: the refreshes of the other host copies of the destination remain. VICTORY_PLACED_ORDER=1 did not change the rate in these runs.

Question: is doing those refreshes on the card (a GPU copy from the copy's destination host copy into the other host copy, in a submission cut behind the copy's list, as cut_for does for fills) the direction you would take? Or is there a reason it was left out? I am trying it behind a switch and will report back.

3. Native DXR prototype: builds and ray queries in place of the console's

Local branch, not a PR yet:

  • Builds: XboxBvhBuilder.dll is interposed (like the FidelityFX HLE). Each batched build, rehydrate and copy also builds a native DXR structure from the same descriptions (geometry through the host copies; top levels from the instance descriptors, readable at the call, with each instance's bottom level replaced by ours). All of a list's builds run side by side, each with its own part of the scratch, in pooled 256 MiB chunks. They cost ~1.2 ms of the card a frame, measured with only these stamped.
  • Traversal: the translator finds the loop around image_bvh_intersect_ray and replaces it:
    • A block in front looks up our structure by the console descriptor's base address, in a small table in the bound view heap, and traces a RayQuery with the loop's ray. Opaque loops become one TraceRayInline + Proceed.
    • Loops with see-through tests become a Proceed() loop. Each candidate runs a copy of the console's own any-hit code, and its four reads of the structure are answered by CandidateTriangleRayT, CandidateInstanceID, CandidateInstanceContributionToHitGroupIndex and CandidateGeometryIndex. The candidate is committed where that code accepts.
  • Where: five programs, 15 loops: 559d9f0184e15fe3 TraceShadowRays_Checkerboard, e8c962358d862e3f, afeea48bbb9913ad, a1b20bc47e3c9597 and 17829ac71aab4e8d (RTDistantShadowTrace*). Every lookup found its structure (millions of rays a session), and the shadows look the same.

With the console's walk left out of those five, they read no title memory by address any more. With the console builder's own work then switched off as a measurement (GI, reflections and the sky probe still walk the console's structures, so those three are wrong in this mode):

fps waits for flights a frame
ray tracing on, before 11-18 15-40 ms
native shadows, console builder off mostly 25-30 1-6 ms, spikes ~50 ms from section 2

Still to do before a PR: 0873f80dd84a3c5c (sky probe), f22a76fcb967ee59 (GI) and 6d7fe7745ab9c6d8 (reflections), whose loops return hit attributes. Also: the per-program list (by hash) needs to become a general rule, and the diagnostics need to come out.

If the native approach is something you would take upstream, I'd like to hear how you'd want it shaped (switches, where the HLE part lives) before I turn it into PRs.

**@⁠Yorivel** on GitHub · 2026-11-28 18:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370) ## Setup RTX 4090, i9-14900K, 64 GB. VIctory-NVIDIA main `63b902f` + #57. Series X profile, 2560x1440, DLSS quality, 30 fps cap (`VICTORY_FRAME_INTERVAL_US=33333`), frame generation off, ray tracing on (`VICTORY_BVH_BUILDER=1`). Numbers are from the 10-second log lines (`fps`, "the card's clock per frame", "preparing per frame, the submitting thread"). ## 1. With ray tracing on, the card has no time left, mostly because of the builder | | fps in gameplay | card busy | |---|---|---| | ray tracing off | 25-30 | ~79 % | | ray tracing on | 11-18 | 86-94 % | A per-dispatch timestamp breakdown (local diagnostic; timestamps around every dispatch keep them from overlapping, so the absolute numbers are inflated, but the ranking holds) puts the translated XboxBvhBuilder programs first by far: `caa78b8ca62bc3d6` (~200 dispatches a frame) and `28918b7150a7aad5` together were over half of the card's frame. The traversal programs (`f22a76fcb967ee59` GI, `6d7fe7745ab9c6d8` reflections, the shadow programs) were a few ms each. ## 2. The hitches: a copy at its place whose source a flight writes The only refusal reason for card steps in these runs is `a copy at its place in a list writes what it reads, or reads or writes what it writes`, 0.6-1.0 submissions a frame. The settles that follow are logged as `title memory read`, ~50 ms a frame in the bad stretches. A local log of the refused submissions shows the same four copies every time: | copy | from | to | read behind it by | |---|---|---|---| | 56 B / 364 B | `0x3e2f3f20`… (in a 174 MB range `fdd56d97a806bcca` declares written) | `0xd5d19eea0` | refreshes of `0xd5d19eea0..` and of the 64 KiB block around it | | 240 B | same buffer | `0xd9079f600` | two fills of 240 B (constant buffers) | | 4098 B | same buffer | `0xd5f8ed350` | refreshes of that range | | 48 B | same buffer | `0xd4940fad0` | refreshes of that range | `fdd56d97a806bcca` (compute), `ab619d0b7b7684d2` and `ed8559670386bfe1` also run with ray tracing off (bound in 13 of 13 RT-off runs), where the same copies cost ~0.1 ms of waiting a frame: the card has long finished that program when the copy's submission is prepared. With ray tracing on, the card still has most of a frame queued, so the wait is most of a frame. With `VICTORY_PLACED_READS=1` the fills are taken on the card from the copy's source as designed, and the refusal becomes `a step other than a fill done on the card reads what a copy at its place writes`: the refreshes of the other host copies of the destination remain. `VICTORY_PLACED_ORDER=1` did not change the rate in these runs. **Question:** is doing those refreshes on the card (a GPU copy from the copy's destination host copy into the other host copy, in a submission cut behind the copy's list, as `cut_for` does for fills) the direction you would take? Or is there a reason it was left out? I am trying it behind a switch and will report back. ## 3. Native DXR prototype: builds and ray queries in place of the console's Local branch, not a PR yet: - **Builds:** `XboxBvhBuilder.dll` is interposed (like the FidelityFX HLE). Each batched build, rehydrate and copy also builds a native DXR structure from the same descriptions (geometry through the host copies; top levels from the instance descriptors, readable at the call, with each instance's bottom level replaced by ours). All of a list's builds run side by side, each with its own part of the scratch, in pooled 256 MiB chunks. They cost ~1.2 ms of the card a frame, measured with only these stamped. - **Traversal:** the translator finds the loop around `image_bvh_intersect_ray` and replaces it: - A block in front looks up our structure by the console descriptor's base address, in a small table in the bound view heap, and traces a `RayQuery` with the loop's ray. Opaque loops become one `TraceRayInline` + `Proceed`. - Loops with see-through tests become a `Proceed()` loop. Each candidate runs a copy of the console's own any-hit code, and its four reads of the structure are answered by `CandidateTriangleRayT`, `CandidateInstanceID`, `CandidateInstanceContributionToHitGroupIndex` and `CandidateGeometryIndex`. The candidate is committed where that code accepts. - **Where:** five programs, 15 loops: `559d9f0184e15fe3` TraceShadowRays_Checkerboard, `e8c962358d862e3f`, `afeea48bbb9913ad`, `a1b20bc47e3c9597` and `17829ac71aab4e8d` (RTDistantShadowTrace*). Every lookup found its structure (millions of rays a session), and the shadows look the same. With the console's walk left out of those five, they read no title memory by address any more. With the console builder's own work then switched off as a measurement (GI, reflections and the sky probe still walk the console's structures, so those three are wrong in this mode): | | fps | waits for flights a frame | |---|---|---| | ray tracing on, before | 11-18 | 15-40 ms | | native shadows, console builder off | mostly 25-30 | 1-6 ms, spikes ~50 ms from section 2 | Still to do before a PR: `0873f80dd84a3c5c` (sky probe), `f22a76fcb967ee59` (GI) and `6d7fe7745ab9c6d8` (reflections), whose loops return hit attributes. Also: the per-program list (by hash) needs to become a general rule, and the diagnostics need to come out. If the native approach is something you would take upstream, I'd like to hear how you'd want it shaped (switches, where the HLE part lives) before I turn it into PRs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 18:18:33 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 18:15 UTC · original

Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

**@⁠github-actions[bot]** on GitHub · 2026-11-28 18:15 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7243649996) Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
Author
Owner

@⁠POMXARK on GitHub · 2026-11-28 18:44 UTC · original

@⁠Yorivel Sharing NVIDIA RTX 5080 (Blackwell) testing results on maren-halv/VIctory-Fast@2472db1 (which implements Native DXR 1.1 RayQuery + XboxBvhBuilder suppression + Mode-2 tripwired copyback + Relaxed Format Casting), in case these NVIDIA-specific driver findings help anyone porting Native DXR 1.1 into VIctory-NVIDIA:

Setup

  • Hardware: AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB (DXR Tier 1.1 tier=20), 32 GB RAM, Windows 11.
  • Profile: Series X, --release, separate clean shader cache.

Findings on NVIDIA (Blackwell)

  1. VICTORY_RELAXED_CAST=1 triggers immediate DXGI_ERROR_INVALID_CALL (0x887A0001) on NVIDIA:

    • Within ~6 s of startup, right after binding a format-aliased view via relaxed format casting (width=1280 height=720 written_as=42 [R32_UINT] read_as=67 [R9G9B9E5_SHAREDEXP]), relay fence reported device removal fires with 0x887A0001 (DXGI_ERROR_INVALID_CALL).
    • Setting VICTORY_RELAXED_CAST=0 eliminates this completely (0 D3D12 errors). Worth gating R32_UINT <-> R9G9B9E5_SHAREDEXP casting (or checking CastableFormats list compatibility strictly) on NVIDIA drivers.
  2. VICTORY_NATIVE_RT=1 crashes inside NVIDIA's RT driver (nvrtum64.dll) upon entering 3D:

    • With VICTORY_RELAXED_CAST=0 + VICTORY_BVH_BUILDER=1 + VICTORY_NATIVE_RT=1, startup and asset loading complete cleanly, and on entering the first 3D frame (frame=2454), the process hits an access violation inside NVIDIA's user-mode RT compiler/builder:
      0xc0000005 at nvrtum64.dll+0x39a60b (write 0x24b02725380: nothing mapped there)
      rax=0xfffffffff0006a01 rcx=0xfffffffa0027c060 rdx=0x10 r8=0xc r9=0x4
      #0 nvrtum64.dll+0x39a60b -> #3 nvrtum64.dll+0x2c41e6
      #4 nvwgf2umx.dll+0x44f87d -> #6 nvwgf2umx.dll+0x7cae93
      #7 D3D12Core.dll+0x13ec2b -> victory.exe
      
    • Notice rcx=0xfffffffa0027c060 (negative/underflowed offset into a buffer/instance descriptor or shader table). Running the exact same binary and cache with RT-Off (VICTORY_NATIVE_RT unset) enters 3D cleanly with 0 errors and 0 crashes, confirming the fault is specific to the DXR 1.1 path on NVIDIA drivers (likely an assumption validated on AMD RDNA 4 that NVIDIA's nvrtum64.dll rejects).
  3. Xbox GDKX / D3D12X contract hint for DXR 1.1 portability:

    • When translating console BVH/RT descriptors to host D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC on NVIDIA, verify that:
      • ScratchAccelerationStructureData and DestAccelerationStructureData strictly respect D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT (256 B) and GetRaytracingAccelerationStructurePrebuildInfo sizes queried from the host device (never reusing console prebuild byte sizes directly),
      • D3D12_RAYTRACING_INSTANCE_DESC arrays are 16-byte aligned and never contain stale/unpatched console GPU VAs in AccelerationStructure, and
      • D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC vertex/index strides and counts are bounds-checked against the underlying host resource size before BuildRaytracingAccelerationStructure (NVIDIA's nvrtum64.dll is much less forgiving of out-of-bounds/zero-stride or unaligned inputs than AMD).
  4. Non-RT memory win observed on the same build (RT-Off):

    • Even without RT, the fork's residency/copyback stack (VICTORY_GPU_ONLY_COPYBACK=2 with tripwire + whole-section heaps) kept 3D Shared GPU memory around ~2.5 GB (VRAM ~8.4 GB, RAM private ~19.8 GB, 0 errors) vs ~8.9 GB Shared / ~29.5 GB Commit on standard VIctory-NVIDIA — very promising candidate ideas to evaluate individually on NVIDIA.
**@⁠POMXARK** on GitHub · 2026-11-28 18:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7244024082) @⁠Yorivel Sharing NVIDIA RTX 5080 (Blackwell) testing results on [`maren-halv/VIctory-Fast@2472db1`](https://github.com/maren-halv/VIctory-Fast/commit/2472db1) (which implements Native DXR 1.1 `RayQuery` + `XboxBvhBuilder` suppression + Mode-2 tripwired copyback + Relaxed Format Casting), in case these NVIDIA-specific driver findings help anyone porting Native DXR 1.1 into `VIctory-NVIDIA`: ### Setup - **Hardware:** AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB (DXR Tier 1.1 `tier=20`), 32 GB RAM, Windows 11. - **Profile:** Series X, `--release`, separate clean shader cache. ### Findings on NVIDIA (Blackwell) 1. **`VICTORY_RELAXED_CAST=1` triggers immediate `DXGI_ERROR_INVALID_CALL` (`0x887A0001`) on NVIDIA:** - Within ~6 s of startup, right after binding a format-aliased view via relaxed format casting (`width=1280 height=720 written_as=42 [R32_UINT] read_as=67 [R9G9B9E5_SHAREDEXP]`), `relay fence reported device removal` fires with `0x887A0001` (`DXGI_ERROR_INVALID_CALL`). - Setting `VICTORY_RELAXED_CAST=0` eliminates this completely (`0` D3D12 errors). Worth gating `R32_UINT <-> R9G9B9E5_SHAREDEXP` casting (or checking `CastableFormats` list compatibility strictly) on NVIDIA drivers. 2. **`VICTORY_NATIVE_RT=1` crashes inside NVIDIA's RT driver (`nvrtum64.dll`) upon entering 3D:** - With `VICTORY_RELAXED_CAST=0` + `VICTORY_BVH_BUILDER=1` + `VICTORY_NATIVE_RT=1`, startup and asset loading complete cleanly, and on entering the first 3D frame (`frame=2454`), the process hits an access violation inside NVIDIA's user-mode RT compiler/builder: ``` 0xc0000005 at nvrtum64.dll+0x39a60b (write 0x24b02725380: nothing mapped there) rax=0xfffffffff0006a01 rcx=0xfffffffa0027c060 rdx=0x10 r8=0xc r9=0x4 #0 nvrtum64.dll+0x39a60b -> #3 nvrtum64.dll+0x2c41e6 #4 nvwgf2umx.dll+0x44f87d -> #6 nvwgf2umx.dll+0x7cae93 #7 D3D12Core.dll+0x13ec2b -> victory.exe ``` - Notice `rcx=0xfffffffa0027c060` (negative/underflowed offset into a buffer/instance descriptor or shader table). Running the exact same binary and cache with **RT-Off** (`VICTORY_NATIVE_RT` unset) enters 3D cleanly with `0` errors and `0` crashes, confirming the fault is specific to the DXR 1.1 path on NVIDIA drivers (likely an assumption validated on AMD RDNA 4 that NVIDIA's `nvrtum64.dll` rejects). 3. **Xbox GDKX / D3D12X contract hint for DXR 1.1 portability:** - When translating console BVH/RT descriptors to host `D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC` on NVIDIA, verify that: - `ScratchAccelerationStructureData` and `DestAccelerationStructureData` strictly respect `D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT` (`256 B`) and `GetRaytracingAccelerationStructurePrebuildInfo` sizes queried from the host device (never reusing console prebuild byte sizes directly), - `D3D12_RAYTRACING_INSTANCE_DESC` arrays are 16-byte aligned and never contain stale/unpatched console GPU VAs in `AccelerationStructure`, and - `D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC` vertex/index strides and counts are bounds-checked against the underlying host resource size before `BuildRaytracingAccelerationStructure` (NVIDIA's `nvrtum64.dll` is much less forgiving of out-of-bounds/zero-stride or unaligned inputs than AMD). 4. **Non-RT memory win observed on the same build (`RT-Off`):** - Even without RT, the fork's residency/copyback stack (`VICTORY_GPU_ONLY_COPYBACK=2` with tripwire + whole-section heaps) kept 3D Shared GPU memory around **`~2.5 GB`** (`VRAM ~8.4 GB`, `RAM private ~19.8 GB`, `0` errors) vs `~8.9 GB` Shared / `~29.5 GB` Commit on standard `VIctory-NVIDIA` — very promising candidate ideas to evaluate individually on NVIDIA.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-28 19:40 UTC · original

Thanks @⁠POMXARK, useful to compare. An update from my side (still a local branch, RTX 4090, same setup as above).

Native traversal now covers all eight programs. GI (f22a76fcb967ee59, 5 loops), reflections (6d7fe7745ab9c6d8, 7 loops) and the sky probe (0873f80dd84a3c5c, 3 per-lane walks with 64-bit node pointers) translate to RayQuery too. With the console builder's own work switched off, no traversal reads the console's structures any more.

Two things that may help anyone doing the same:

  1. Instance masks. The console walks test the instance mask in software: the instance node's dword at +48 (InstanceID | mask << 24) ANDed with mask << 24, then != 0. The mask differs per program: 0xA0 for the distant shadows' see-through rays, 0xDA for three of the GI loops, and a per-wave value (s52) for the reflections. The other loops have no test. The title's top levels hold two sets of many objects under masks 32 and 64 (for example 522 + 522 of 2989 instances), so tracing with 0xFF walks both. The translator now reads the mask off each loop's test and passes it to TraceRayInline.

  2. What the reflections read after the loop. Besides instance id, hit group, geometry and primitive index (answered by Committed*), the two closest-hit reflection loops read the hit triangle's three vertices from the triangle node (for the geometric normal) and the instance's object-to-world rows at +0/+16/+32. Shader model 6.8 has no TriangleObjectPositions, so:

    • the host keeps each bottom build's geometry (title addresses of the index buffer, vertices and transform, stride, formats) in an append-only pool;
    • per top level it keeps an instance table: a ring of 16, and the dispatch's root word picks the one current when the dispatch was recorded;
    • the shader then reads the triangle from title memory through the index buffer.

    This title builds with R32G32B32_FLOAT and R32G32_FLOAT vertices and R16_UINT indices only.

Open: closest-hit cost. With GI and reflections native, the card takes around a second a frame for about 2.6 M rays, while the first-hit shadow rays stay cheap. The masks did not change that.

On your point 3: prebuild sizes come from the host device, and structures and scratch are 256-byte aligned (pooled chunks). Instance descs get our bottom structure's address. An instance whose bottom structure isn't ours stays in, inactive (address 0), so CommittedInstanceIndex keeps the title's numbering. The bounds check against the host copy is a good catch. Our build clamps the refresh to the host copy but still passed the full vertex count, so I'm counting how often a range runs past its copy's end; it may be what makes the closest-hit walks slow. I'll report back. I haven't seen the nvrtum64.dll crash on the 4090.

**@⁠Yorivel** on GitHub · 2026-11-28 19:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7244716583) Thanks @⁠POMXARK, useful to compare. An update from my side (still a local branch, RTX 4090, same setup as above). **Native traversal now covers all eight programs.** GI (`f22a76fcb967ee59`, 5 loops), reflections (`6d7fe7745ab9c6d8`, 7 loops) and the sky probe (`0873f80dd84a3c5c`, 3 per-lane walks with 64-bit node pointers) translate to `RayQuery` too. With the console builder's own work switched off, no traversal reads the console's structures any more. Two things that may help anyone doing the same: 1. **Instance masks.** The console walks test the instance mask in software: the instance node's dword at +48 (`InstanceID | mask << 24`) ANDed with `mask << 24`, then `!= 0`. The mask differs per program: `0xA0` for the distant shadows' see-through rays, `0xDA` for three of the GI loops, and a per-wave value (`s52`) for the reflections. The other loops have no test. The title's top levels hold two sets of many objects under masks 32 and 64 (for example 522 + 522 of 2989 instances), so tracing with `0xFF` walks both. The translator now reads the mask off each loop's test and passes it to `TraceRayInline`. 2. **What the reflections read after the loop.** Besides instance id, hit group, geometry and primitive index (answered by `Committed*`), the two closest-hit reflection loops read the hit triangle's three vertices from the triangle node (for the geometric normal) and the instance's object-to-world rows at +0/+16/+32. Shader model 6.8 has no `TriangleObjectPositions`, so: - the host keeps each bottom build's geometry (title addresses of the index buffer, vertices and transform, stride, formats) in an append-only pool; - per top level it keeps an instance table: a ring of 16, and the dispatch's root word picks the one current when the dispatch was recorded; - the shader then reads the triangle from title memory through the index buffer. This title builds with R32G32B32_FLOAT and R32G32_FLOAT vertices and R16_UINT indices only. **Open: closest-hit cost.** With GI and reflections native, the card takes around a second a frame for about 2.6 M rays, while the first-hit shadow rays stay cheap. The masks did not change that. On your point 3: prebuild sizes come from the host device, and structures and scratch are 256-byte aligned (pooled chunks). Instance descs get our bottom structure's address. An instance whose bottom structure isn't ours stays in, inactive (address 0), so `CommittedInstanceIndex` keeps the title's numbering. The bounds check against the host copy is a good catch. Our build clamps the refresh to the host copy but still passed the full vertex count, so I'm counting how often a range runs past its copy's end; it may be what makes the closest-hit walks slow. I'll report back. I haven't seen the `nvrtum64.dll` crash on the 4090.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-28 19:44 UTC · original

Follow-up on section 2 (the copy waits) and the stutter, as promised:

The copy waits are gone with two existing switches together. VICTORY_FILL_TITLE=1 plus VICTORY_PLACED_READS=1 (no change of mine needed, so I dropped the idea of doing the refreshes on the card myself). In the setup above (native shadows, console builder off) that gives 0 card-step refusals and 0.1-2 ms of waiting for flights a frame (15-40 ms at the start), and fps mostly 28-31 with occasional dips into the low 20s. I know the switches are off by default because a constant a shader really writes could be read one step stale. I haven't seen anything look wrong in these runs.

What still stutters is the per-frame refresh of title memory, not ray tracing (the RT-off runs show the same dips):

  • the submitting thread works 25-33 ms a frame, right at the 33 ms budget;
  • most of it is refreshing 40-50 MB a frame in play: 14-17 MB in the 174 MB view-memory heap, the rest spread over about 2,500 buffers;
  • while the world loads it is up to 128 MB a frame plus about 2.2 GB of textures, which is where the worst hitches are.

From the inplace.rs notes, VICTORY_INPLACE can't take the 174 MB heap, because the page pool is reserved memory (SEC_RESERVE) that D3D12 won't open. Its stage 2 says not to combine it with the late-wait relay, which this setup uses. So I'm not using it. Creating the page pool as committed memory looks like the way to the biggest share; I'll look at that after ray tracing.

Smaller results:

  • Native builds: recording them on the submitting thread dropped from 8-13 ms to 1-4 ms a frame, once structures come from pooled chunks instead of a buffer each.
  • The phone and photo screens, which were black, draw in the runs with GI and reflections native and the console builder off. I haven't isolated which part fixed them.
  • Of the 225 programs the translator refuses, only one ran in my sessions: 6b82bc7d22016cb5, a wave64 compute program. I haven't looked at what it draws yet.
**@⁠Yorivel** on GitHub · 2026-11-28 19:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7244764855) Follow-up on section 2 (the copy waits) and the stutter, as promised: **The copy waits are gone with two existing switches together.** `VICTORY_FILL_TITLE=1` plus `VICTORY_PLACED_READS=1` (no change of mine needed, so I dropped the idea of doing the refreshes on the card myself). In the setup above (native shadows, console builder off) that gives 0 card-step refusals and 0.1-2 ms of waiting for flights a frame (15-40 ms at the start), and fps mostly 28-31 with occasional dips into the low 20s. I know the switches are off by default because a constant a shader really writes could be read one step stale. I haven't seen anything look wrong in these runs. **What still stutters is the per-frame refresh of title memory**, not ray tracing (the RT-off runs show the same dips): - the submitting thread works 25-33 ms a frame, right at the 33 ms budget; - most of it is refreshing 40-50 MB a frame in play: 14-17 MB in the 174 MB view-memory heap, the rest spread over about 2,500 buffers; - while the world loads it is up to 128 MB a frame plus about 2.2 GB of textures, which is where the worst hitches are. From the `inplace.rs` notes, `VICTORY_INPLACE` can't take the 174 MB heap, because the page pool is reserved memory (`SEC_RESERVE`) that D3D12 won't open. Its stage 2 says not to combine it with the late-wait relay, which this setup uses. So I'm not using it. Creating the page pool as committed memory looks like the way to the biggest share; I'll look at that after ray tracing. **Smaller results:** - Native builds: recording them on the submitting thread dropped from 8-13 ms to 1-4 ms a frame, once structures come from pooled chunks instead of a buffer each. - The phone and photo screens, which were black, draw in the runs with GI and reflections native and the console builder off. I haven't isolated which part fixed them. - Of the 225 programs the translator refuses, only one ran in my sessions: `6b82bc7d22016cb5`, a wave64 compute program. I haven't looked at what it draws yet.
Author
Owner

@⁠adammeftah on GitHub · 2026-11-28 21:05 UTC · original

Nice work on this. We're porting native DXR onto a VIctory-NVIDIA base for a 4090 too. Any chance you could push your branch, even as a WIP? Happy to test on our side and share results.

**@⁠adammeftah** on GitHub · 2026-11-28 21:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7245766204) Nice work on this. We're porting native DXR onto a VIctory-NVIDIA base for a 4090 too. Any chance you could push your branch, even as a WIP? Happy to test on our side and share results.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-28 21:07 UTC · original

Tomorrow after work I'll post it sure!

**@⁠Yorivel** on GitHub · 2026-11-28 21:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7245793666) Tomorrow after work I'll post it sure!
Author
Owner

@⁠POMXARK on GitHub · 2026-11-28 23:12 UTC · original

@⁠Yorivel — quick 20-minute A/B confirmation on your VICTORY_FILL_TITLE=1 + VICTORY_PLACED_READS=1 tip (Windows 11, RTX 5080 16 GB, Ryzen 7 5700X, 32 GB RAM, Series X 1440p, DLSS Quality + MFG 4x, RT off, release build, matched save & switches):

Metric Baseline (both off) VICTORY_FILL_TITLE=1 + VICTORY_PLACED_READS=1 Delta
Errors / Visuals 0 / clean 0 / clean (16/16 shots verified) clean
ALL 3D p50 FPS 14.80 FPS (67.4 ms) 15.30 FPS (65.5 ms) +3.4% (-1.9 ms)
1k–4k draws p50 16.05 FPS (62.3 ms) 18.05 FPS (55.4 ms) +12.5% (-6.9 ms)
planning steps done on the card 4.2 ms 1.4 ms -2.8 ms (-67%)
Copy-back med 13.6 ms 11.0 ms -2.6 ms (-19%)
Frame p95 / >100ms (5s bins) 117.3 ms / 31 116.9 ms / 25 -19.4% >100ms bins

Even without RT enabled, VICTORY_FILL_TITLE=1 + VICTORY_PLACED_READS=1 cut card_steps planning time by 67% (4.2 -> 1.4 ms), shaved -2.6 ms off copy-back, reduced >100ms stutter windows by 19%, and delivered a new 0-error baseline on 5080 with zero stale-constant visual artifacts!

**@⁠POMXARK** on GitHub · 2026-11-28 23:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7247277565) @⁠Yorivel — quick 20-minute A/B confirmation on your `VICTORY_FILL_TITLE=1` + `VICTORY_PLACED_READS=1` tip (Windows 11, RTX 5080 16 GB, Ryzen 7 5700X, 32 GB RAM, Series X 1440p, DLSS Quality + MFG 4x, RT off, release build, matched save & switches): | Metric | Baseline (both off) | `VICTORY_FILL_TITLE=1` + `VICTORY_PLACED_READS=1` | Delta | |---|---:|---:|---:| | Errors / Visuals | 0 / clean | 0 / clean (16/16 shots verified) | clean | | **ALL 3D p50 FPS** | 14.80 FPS (`67.4 ms`) | **15.30 FPS** (`65.5 ms`) | **+3.4% (`-1.9 ms`)** | | **1k–4k draws p50** | 16.05 FPS (`62.3 ms`) | **18.05 FPS** (`55.4 ms`) | **+12.5% (`-6.9 ms`)** | | `planning steps done on the card` | 4.2 ms | **1.4 ms** | **-2.8 ms (-67%)** | | Copy-back med | 13.6 ms | **11.0 ms** | **-2.6 ms (-19%)** | | Frame p95 / `>100ms` (5s bins) | 117.3 ms / 31 | **116.9 ms / 25** | **-19.4% >100ms bins** | Even without RT enabled, `VICTORY_FILL_TITLE=1` + `VICTORY_PLACED_READS=1` cut `card_steps` planning time by 67% (`4.2 -> 1.4 ms`), shaved `-2.6 ms` off copy-back, reduced `>100ms` stutter windows by 19%, and delivered a new 0-error baseline on 5080 with zero stale-constant visual artifacts!
Author
Owner

@⁠Yorivel on GitHub · 2026-11-29 13:18 UTC · original

@⁠adammeftah here it is, as a WIP: https://github.com/Yorivel/VIctory-NVIDIA/tree/native-rt-wip (VIctory-NVIDIA main 63b902f + #57, then the native ray tracing commits).

Switches (with VICTORY_BVH_BUILDER=1 as usual):

  • VICTORY_BVH_NATIVE=1: native DXR builds beside the console builder's (crates/victory-gpu/src/native_rt.rs, the interposer in crates/victory-hle/src/modules/xboxbvh.rs).
  • VICTORY_RT_NATIVE_TRACE=3: the traversal loops of the known programs become ray queries, with no console walk left (crates/victory-shader/src/traversal.rs, list KNOWN). 1 keeps the console's walk where no native structure is found.
  • VICTORY_BVH_CONSOLE=0: skips the console builder's own work. Only right with mode 3.
  • VICTORY_RT_NATIVE_SKIP=<hash>: leaves one program on the console walk.
  • VICTORY_FILL_TITLE=1 + VICTORY_PLACED_READS=1 for the copy waits, as above.

The traversal mode and the masks are part of each program's translation key, so run victory shaders and victory warm with the same switches before playing.

Known problems:

  • GI (f22a76fcb967ee59) and reflections (6d7fe7745ab9c6d8) are very slow right now, around 1 fps with both native. The shadows and the sky probe are fine. My current lead is vertex data: a CPU-side check finds some geometries whose vertices are garbage (coordinates like -1.7e38). They would give bottom structures of world size that only the GI and reflection masks see. I'm checking what the GPU-side copies hold at build time next.
  • The two reflection loops that read the hit triangle's vertices (0xb88, 0x3818) are new and unchecked in game; their normal's orientation may be backwards.
  • Programs are picked by hash (KNOWN), not by a general rule yet, and the diagnostics are still in: VICTORY_PIPE_TIMES, the trace counters, VICTORY_RT_GEOMETRY_CHECK.
  • Tested on an RTX 4090 only.

Results from your side are welcome, especially if your GI and reflections run at normal speed.

**@⁠Yorivel** on GitHub · 2026-11-29 13:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7256445903) @⁠adammeftah here it is, as a WIP: https://github.com/Yorivel/VIctory-NVIDIA/tree/native-rt-wip (VIctory-NVIDIA main `63b902f` + #57, then the native ray tracing commits). **Switches** (with `VICTORY_BVH_BUILDER=1` as usual): - `VICTORY_BVH_NATIVE=1`: native DXR builds beside the console builder's (`crates/victory-gpu/src/native_rt.rs`, the interposer in `crates/victory-hle/src/modules/xboxbvh.rs`). - `VICTORY_RT_NATIVE_TRACE=3`: the traversal loops of the known programs become ray queries, with no console walk left (`crates/victory-shader/src/traversal.rs`, list `KNOWN`). `1` keeps the console's walk where no native structure is found. - `VICTORY_BVH_CONSOLE=0`: skips the console builder's own work. Only right with mode 3. - `VICTORY_RT_NATIVE_SKIP=<hash>`: leaves one program on the console walk. - `VICTORY_FILL_TITLE=1` + `VICTORY_PLACED_READS=1` for the copy waits, as above. The traversal mode and the masks are part of each program's translation key, so run `victory shaders` and `victory warm` with the same switches before playing. **Known problems:** - GI (`f22a76fcb967ee59`) and reflections (`6d7fe7745ab9c6d8`) are very slow right now, around 1 fps with both native. The shadows and the sky probe are fine. My current lead is vertex data: a CPU-side check finds some geometries whose vertices are garbage (coordinates like -1.7e38). They would give bottom structures of world size that only the GI and reflection masks see. I'm checking what the GPU-side copies hold at build time next. - The two reflection loops that read the hit triangle's vertices (0xb88, 0x3818) are new and unchecked in game; their normal's orientation may be backwards. - Programs are picked by hash (`KNOWN`), not by a general rule yet, and the diagnostics are still in: `VICTORY_PIPE_TIMES`, the trace counters, `VICTORY_RT_GEOMETRY_CHECK`. - Tested on an RTX 4090 only. Results from your side are welcome, especially if your GI and reflections run at normal speed.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-29 13:33 UTC · original

Found the slow GI and reflections: it was our bottom structures, not the walks.

The title's vertex format 16 is not what it says. About a fifth of the geometries (15,106 of about 80,000 in one session) are declared DXGI_FORMAT_R32G32_FLOAT (16) with a stride of 8. Their bytes are four 16-bit normalized values. Read as SNORM16 they are box-shaped coordinates in [-1, 1], full of exact thirds like 0x2aaa, 0x5555, 0xd555 and 0x8000 corners. Read as floats they are noise up to ±3e38. The instance transforms then scale them up (scales up to 512). Built as R16G16B16A16_SNORM, every geometry I sampled has sane bounds: 7,634 under 10 units, 92 under 100, 3 under 1,000, none larger, no values that aren't finite. I picked SNORM over UNORM from the values' symmetry. GI and reflections look right so far.

The vertex stride's bit 15 is a flag. (6, 12) and (16, 8) also come as 0x800C and 0x8008 (725 and 455 times in that session). Such a geometry shares its sibling's vertices at the low stride, so I mask the bit off.

Why only GI and reflections were slow: the garbage structures (world-sized triangles) sit under masks only GI (0xDA) and the reflections take, never the shadows (0xA0). With per-dispatch timestamps, GI took 460-510 ms of the card a frame and reflections 120-140 ms. Now they are under 5 ms each.

How I found it: VICTORY_RT_GEOMETRY_CHECK=1 copies each new bottom structure's vertices from its host copy, in the build's own list, and checks their bounds once the card has run it. A CPU-side read of title memory wasn't enough: it fails on guarded pages and can be stale.

Result (RTX 4090, same setup as above): all eight traversal programs native, console builder off. 28-31 fps in play at the 30 fps cap, with the card 86-90 % busy. It plays close to the console. Hitches are left while the world first loads, from the title-memory refreshes in my earlier comment.

Pushed to native-rt-wip as 90585fb. VICTORY_BVH_NATIVE_FORMAT16=<dxgi> picks another reading for comparison. The reflections' vertex reads now decode SNORM16 too, which I haven't checked in game yet.

Does anyone know whether format 16 at a stride of 8 meaning SNORM16 is an Xbox XDXR convention, or this title's own? I only matched it from the data.

**@⁠Yorivel** on GitHub · 2026-11-29 13:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7256628038) Found the slow GI and reflections: it was our bottom structures, not the walks. **The title's vertex format 16 is not what it says.** About a fifth of the geometries (15,106 of about 80,000 in one session) are declared `DXGI_FORMAT_R32G32_FLOAT` (16) with a stride of 8. Their bytes are four 16-bit normalized values. Read as SNORM16 they are box-shaped coordinates in [-1, 1], full of exact thirds like `0x2aaa`, `0x5555`, `0xd555` and `0x8000` corners. Read as floats they are noise up to ±3e38. The instance transforms then scale them up (scales up to 512). Built as `R16G16B16A16_SNORM`, every geometry I sampled has sane bounds: 7,634 under 10 units, 92 under 100, 3 under 1,000, none larger, no values that aren't finite. I picked SNORM over UNORM from the values' symmetry. GI and reflections look right so far. **The vertex stride's bit 15 is a flag.** (6, 12) and (16, 8) also come as `0x800C` and `0x8008` (725 and 455 times in that session). Such a geometry shares its sibling's vertices at the low stride, so I mask the bit off. **Why only GI and reflections were slow:** the garbage structures (world-sized triangles) sit under masks only GI (`0xDA`) and the reflections take, never the shadows (`0xA0`). With per-dispatch timestamps, GI took 460-510 ms of the card a frame and reflections 120-140 ms. Now they are under 5 ms each. **How I found it:** `VICTORY_RT_GEOMETRY_CHECK=1` copies each new bottom structure's vertices from its host copy, in the build's own list, and checks their bounds once the card has run it. A CPU-side read of title memory wasn't enough: it fails on guarded pages and can be stale. **Result** (RTX 4090, same setup as above): all eight traversal programs native, console builder off. 28-31 fps in play at the 30 fps cap, with the card 86-90 % busy. It plays close to the console. Hitches are left while the world first loads, from the title-memory refreshes in my earlier comment. Pushed to [`native-rt-wip`](https://github.com/Yorivel/VIctory-NVIDIA/tree/native-rt-wip) as `90585fb`. `VICTORY_BVH_NATIVE_FORMAT16=<dxgi>` picks another reading for comparison. The reflections' vertex reads now decode SNORM16 too, which I haven't checked in game yet. Does anyone know whether format 16 at a stride of 8 meaning SNORM16 is an Xbox XDXR convention, or this title's own? I only matched it from the data.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-29 15:07 UTC · original

Update: native-rt-wip is now merged onto current main (71a57468, on top of the 1687 commits since 63b902f). The conflicts were small: the shader cache's variants, the user-data words, the upload pool from #57, and registers now being u16. All eight converted programs still translate and validate on main's lowering, and the merged build plays at 28-31 fps with all ray tracing native and the console builder off.

What changed since the last comment:

  • Back-face culling. Every console walk in this title culls back faces unless the instance sets TRIANGLE_CULL_DISABLE. Its culling mode is the instance's flags byte XOR 1 (with FRONT_CCW read as the sign), as v_xor_b32 … src0_sel:BYTE_3 or s_xor_b32 _, flags, 1 + s_bfe_i32 0x20000. The translator reads that off each loop and adds RAY_FLAG_CULL_BACK_FACING_TRIANGLES, which DXR applies per instance the same way.
  • Candidate tests get the candidate's own node-test results. The see-through tests compute barycentrics and the hit side from the walk's image_bvh results (numerators times the reciprocal of the denominator) and from that reciprocal's sign. Those registers are now answered per candidate from CandidateTriangleBarycentrics and CandidateTriangleFrontFace: the side as ±1, the barycentrics and distance times it. Before, they kept their values from before the loop, so alpha tests sampled at the wrong spot. It also fixes the distant shadows' alpha tests.
  • Vertex reads. The reflections' vertex answers decode the SNORM16 vertices too. Two runtime switches in the scenes word let me flip the vertex order and the transform rows without retranslating.
  • A window that showed a flat colour instead of the outside, in CS_RaytraceVBuffer_…_WithFar. I bisected it to the far-ray loops, but it turned out to be translation, not ray tracing: it is fixed by main's translator alone, with the same native ray tracing on top.

Still open:

  • Some visual artifacts remain in the reflections. I'm comparing against the console's walk to find them.
  • Six more programs walk the structures and are compiled in my runs, but they were never dispatched where I played, so they are not converted yet: CS_Alpha_GenerateShaderBins (2 programs), CS_IrradianceCache_ClearShadingChangeSignals, CS_Primary_Clear…, CS_GenerateNormalConesFirstPass and CS_CollisionDepthBased. That is 24 loops in all, and all but one have no see-through test. With the console builder off, they would walk empty structures wherever they do run.
  • Micro-stutters while moving are the same with main as before (about 110 frames a minute over 50 ms). The submitting thread spends 28-35 ms a frame, 11-14 ms of it refreshing 47-75 MB of title memory. That is the memory side from my earlier comment, not ray tracing.
**@⁠Yorivel** on GitHub · 2026-11-29 15:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7257843853) Update: [`native-rt-wip`](https://github.com/Yorivel/VIctory-NVIDIA/tree/native-rt-wip) is now merged onto current main (`71a57468`, on top of the 1687 commits since `63b902f`). The conflicts were small: the shader cache's variants, the user-data words, the upload pool from #57, and registers now being `u16`. All eight converted programs still translate and validate on main's lowering, and the merged build plays at 28-31 fps with all ray tracing native and the console builder off. **What changed since the last comment:** - **Back-face culling.** Every console walk in this title culls back faces unless the instance sets `TRIANGLE_CULL_DISABLE`. Its culling mode is the instance's flags byte XOR 1 (with `FRONT_CCW` read as the sign), as `v_xor_b32 … src0_sel:BYTE_3` or `s_xor_b32 _, flags, 1` + `s_bfe_i32 0x20000`. The translator reads that off each loop and adds `RAY_FLAG_CULL_BACK_FACING_TRIANGLES`, which DXR applies per instance the same way. - **Candidate tests get the candidate's own node-test results.** The see-through tests compute barycentrics and the hit side from the walk's `image_bvh` results (numerators times the reciprocal of the denominator) and from that reciprocal's sign. Those registers are now answered per candidate from `CandidateTriangleBarycentrics` and `CandidateTriangleFrontFace`: the side as ±1, the barycentrics and distance times it. Before, they kept their values from before the loop, so alpha tests sampled at the wrong spot. It also fixes the distant shadows' alpha tests. - **Vertex reads.** The reflections' vertex answers decode the SNORM16 vertices too. Two runtime switches in the scenes word let me flip the vertex order and the transform rows without retranslating. - **A window that showed a flat colour** instead of the outside, in `CS_RaytraceVBuffer_…_WithFar`. I bisected it to the far-ray loops, but it turned out to be translation, not ray tracing: it is fixed by main's translator alone, with the same native ray tracing on top. **Still open:** - Some visual artifacts remain in the reflections. I'm comparing against the console's walk to find them. - Six more programs walk the structures and are compiled in my runs, but they were never dispatched where I played, so they are not converted yet: `CS_Alpha_GenerateShaderBins` (2 programs), `CS_IrradianceCache_ClearShadingChangeSignals`, `CS_Primary_Clear…`, `CS_GenerateNormalConesFirstPass` and `CS_CollisionDepthBased`. That is 24 loops in all, and all but one have no see-through test. With the console builder off, they would walk empty structures wherever they do run. - Micro-stutters while moving are the same with main as before (about 110 frames a minute over 50 ms). The submitting thread spends 28-35 ms a frame, 11-14 ms of it refreshing 47-75 MB of title memory. That is the memory side from my earlier comment, not ray tracing.
Author
Owner

@⁠adammeftah on GitHub · 2026-11-29 17:27 UTC · original

Thanks for pushing it. We read the vertex format differently from your last commit, so here is what we have.

We do not read format 16 at stride 8 as SNORM16. We read it as a quantized position in two dwords d0 d1, three fields of 24, 24 and 16 bits:

  • d0 >> 8
  • (d0 & 0xff) | (d1 & 0xffff) << 8
  • d1 >> 16

The 32 bytes just before the vertex buffer hold a scale and an offset per field and a mode word for the axis order. Position = scale * field + offset. SNORM16 also gives bounded boxes, so a bounds check passes for both readings. A check of face directions against the stored normals separates them.

Bit 15 of the stride is the winding of the index stream: it swaps indices 0 and 2.

Index format 53 is a meshlet stream, not 16-bit indices: a 3-dword header, 16-byte group records, one dword per triangle (three 7-bit local indices and the group), then the u16 vertex references. aleksesipenko/VIctory-RTX measured 81.5% of the bottom levels built from descriptions using it.

The layouts come from kcdev1's decoder. We checked them against the XDXR reference and on 1.8 M triangles from the game's mesh pages: face directions match the stored normals on 99.9% or more.

Our side, RTX 4090, 1440p DLSS Quality, 12 programs native, console builder off: about 19.5 fps on a fixed 285 s walk, where ray tracing off gives about 23. It is not finished: two of our GI programs still differ from the software picture.

**@⁠adammeftah** on GitHub · 2026-11-29 17:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7259712804) Thanks for pushing it. We read the vertex format differently from your last commit, so here is what we have. We do not read format 16 at stride 8 as SNORM16. We read it as a quantized position in two dwords `d0 d1`, three fields of 24, 24 and 16 bits: - `d0 >> 8` - `(d0 & 0xff) | (d1 & 0xffff) << 8` - `d1 >> 16` The 32 bytes just before the vertex buffer hold a scale and an offset per field and a mode word for the axis order. Position = scale * field + offset. SNORM16 also gives bounded boxes, so a bounds check passes for both readings. A check of face directions against the stored normals separates them. Bit 15 of the stride is the winding of the index stream: it swaps indices 0 and 2. Index format 53 is a meshlet stream, not 16-bit indices: a 3-dword header, 16-byte group records, one dword per triangle (three 7-bit local indices and the group), then the u16 vertex references. aleksesipenko/VIctory-RTX measured 81.5% of the bottom levels built from descriptions using it. The layouts come from kcdev1's decoder. We checked them against the XDXR reference and on 1.8 M triangles from the game's mesh pages: face directions match the stored normals on 99.9% or more. Our side, RTX 4090, 1440p DLSS Quality, 12 programs native, console builder off: about 19.5 fps on a fixed 285 s walk, where ray tracing off gives about 23. It is not finished: two of our GI programs still differ from the software picture.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-29 18:14 UTC · original

@⁠adammeftah thank you, that's very useful. Our SNORM16 reading was a guess from bounds alone, and as you say, a bounds check can't tell the two readings apart. I'll switch to your field layout with the scale and offset from the 32 bytes before the vertices. The winding bit matters for us too: we cull back faces as the console does, so masking it off culls those meshes on the wrong side.

Here is what we found since the last comment. None of it is pushed yet; it will be in the next push to native-rt-wip.

Rehydrated meshes, read back from the console's own structures. Our native builds of the rehydrate descriptions (index format 53) used the packed stream as 16-bit indices, so the world's prebuilt meshes had wrong triangles. Instead of decoding the stream, we let the console's rehydrate run and copy its output back. The copy is recorded right behind the rehydrate in the same list, read page by page through the page directory into a readback ring, with a WriteBufferImmediate marker. When the marker shows, we decode the AMD node format on the CPU and build natively from those triangles. That gives the console's exact triangles, in its primitive order and winding, without knowing the packed formats. 99.99% of triangles decode (12.1 M of 12.2 M in a session).

The node format, as read off the title's structures:

  • Header: dword 12 is the root's node pointer. Dword 14 is where the parent pointers are relative to the header: 0x40, or negative when they lie before it. Both forms occur, so don't check it.
  • A pointer p names the node at (p >> 3) << 6, of kind p & 7. Kinds 4 and 5 are 16- and 32-bit boxes, with their four children's pointers first (0xFFFFFFFF for none). Kinds 0-3 are triangle nodes.
  • A triangle node holds four float vertices, then geometry << 8 | flags at +48, two primitive ids at +52 and +56 (0xFFFFFFFF for none), and one order byte per triangle at +60.
  • Triangle 0 is vertices 0, 1, 2 and triangle 1 is vertices 1, 3, 2. Bits 1:0 and 3:2 of the order byte say which of the three came second and third in the title's input. It is always a rotation, so the winding is kept.

About 3% of copies catch a structure the rehydrate hasn't finished: boxes holding 0x4000000 and then a run of plain pointers instead of children and bounds. A second copy a second later is whole in 29 of 30 cases.

This could also check your meshlet decoder: the console's own triangles per primitive, against yours. I have dumps of both the console structures and the descriptions' data, if that helps.

With the console builder off, the title streams differently. It made no compaction copies at all (3,184 in the same time with the builder on), rehydrated three times as much (16,042 against about 5,000), and most rehydrated structures came back half-written (headers 0x81020006 instead of 0x80020006, 41% of triangles decodable). The title seems to wait on what the bottom-level builds write. VICTORY_BVH_CONSOLE=bottom runs the console builder for bottom levels, rehydrates and copies of bottom structures, and skips the top levels. With it, streaming behaves as with the full builder and 99.99% decodes. This only matters for our readback approach; with a direct decoder like yours you don't need the rehydrate output. The changed streaming may still be worth a look on your side.

The reflection walks record transparent layers. In 6d7fe7745ab9c6d8 (CS_RaytraceVBuffer_…_WithFar), the far loop's candidate test has three outcomes, not two. It rejects; or it commits the closest hit (v38, only where v71 == -1 at the test's end); or it records the candidate as a layer and goes on walking. Layers go to v35/v22, v31/v30 or v39/v43: a distance and an id or material, kept only if nearer than the layer so far. After the walk, the code keeps a layer's id only if the layer lies in front of the closest hit. Our translation started each candidate's test from those registers as they were before the loop. So every layer looked nearer than the one so far, and what the region gave back was at best the last candidate's layer, mostly the initial 10000. A sampler in verify mode shows it (native vs console): closest distance 0.021 vs 0.356 and 2.07 vs 5.67; v35 10000 vs 17.5; v39 10000 vs 2128.5. This shows as black, flickering shapes in mirrors and windows. The fix, carrying the test's writes from one candidate to the next and out of the region, is what I'm on now. The other reflection loops (0x2530, 0x62a8, 0x79d8) have the same kind of test.

Smaller things:

  • The two reflection loops that read the hit triangle's vertices (0xb88, 0x3818) now take a rehydrated mesh's vertices from the console's own triangle node: a 4-byte entry per primitive naming the node and the vertex order.
  • Verify mode now samples one differing lane per compared register (native and console value), which is how the layer problem showed up.
  • A "host command list did not close (The parameter is incorrect)" failure ended 5 of today's runs 27-95 s after launch, during the intro movie and decoration bakes, before any ray tracing work. It also happened once with ray tracing off, so I don't think it's ours, but I haven't run the diagnostics build on it yet.
**@⁠Yorivel** on GitHub · 2026-11-29 18:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7260327973) @⁠adammeftah thank you, that's very useful. Our SNORM16 reading was a guess from bounds alone, and as you say, a bounds check can't tell the two readings apart. I'll switch to your field layout with the scale and offset from the 32 bytes before the vertices. The winding bit matters for us too: we cull back faces as the console does, so masking it off culls those meshes on the wrong side. Here is what we found since the last comment. None of it is pushed yet; it will be in the next push to `native-rt-wip`. **Rehydrated meshes, read back from the console's own structures.** Our native builds of the rehydrate descriptions (index format 53) used the packed stream as 16-bit indices, so the world's prebuilt meshes had wrong triangles. Instead of decoding the stream, we let the console's rehydrate run and copy its output back. The copy is recorded right behind the rehydrate in the same list, read page by page through the page directory into a readback ring, with a `WriteBufferImmediate` marker. When the marker shows, we decode the AMD node format on the CPU and build natively from those triangles. That gives the console's exact triangles, in its primitive order and winding, without knowing the packed formats. 99.99% of triangles decode (12.1 M of 12.2 M in a session). The node format, as read off the title's structures: - Header: dword 12 is the root's node pointer. Dword 14 is where the parent pointers are relative to the header: `0x40`, or negative when they lie before it. Both forms occur, so don't check it. - A pointer `p` names the node at `(p >> 3) << 6`, of kind `p & 7`. Kinds 4 and 5 are 16- and 32-bit boxes, with their four children's pointers first (`0xFFFFFFFF` for none). Kinds 0-3 are triangle nodes. - A triangle node holds four float vertices, then `geometry << 8 | flags` at +48, two primitive ids at +52 and +56 (`0xFFFFFFFF` for none), and one order byte per triangle at +60. - Triangle 0 is vertices 0, 1, 2 and triangle 1 is vertices 1, 3, 2. Bits 1:0 and 3:2 of the order byte say which of the three came second and third in the title's input. It is always a rotation, so the winding is kept. About 3% of copies catch a structure the rehydrate hasn't finished: boxes holding `0x4000000` and then a run of plain pointers instead of children and bounds. A second copy a second later is whole in 29 of 30 cases. This could also check your meshlet decoder: the console's own triangles per primitive, against yours. I have dumps of both the console structures and the descriptions' data, if that helps. **With the console builder off, the title streams differently.** It made no compaction copies at all (3,184 in the same time with the builder on), rehydrated three times as much (16,042 against about 5,000), and most rehydrated structures came back half-written (headers `0x81020006` instead of `0x80020006`, 41% of triangles decodable). The title seems to wait on what the bottom-level builds write. `VICTORY_BVH_CONSOLE=bottom` runs the console builder for bottom levels, rehydrates and copies of bottom structures, and skips the top levels. With it, streaming behaves as with the full builder and 99.99% decodes. This only matters for our readback approach; with a direct decoder like yours you don't need the rehydrate output. The changed streaming may still be worth a look on your side. **The reflection walks record transparent layers.** In `6d7fe7745ab9c6d8` (`CS_RaytraceVBuffer_…_WithFar`), the far loop's candidate test has three outcomes, not two. It rejects; or it commits the closest hit (`v38`, only where `v71 == -1` at the test's end); or it records the candidate as a layer and goes on walking. Layers go to `v35`/`v22`, `v31`/`v30` or `v39`/`v43`: a distance and an id or material, kept only if nearer than the layer so far. After the walk, the code keeps a layer's id only if the layer lies in front of the closest hit. Our translation started each candidate's test from those registers as they were before the loop. So every layer looked nearer than the one so far, and what the region gave back was at best the last candidate's layer, mostly the initial 10000. A sampler in verify mode shows it (native vs console): closest distance 0.021 vs 0.356 and 2.07 vs 5.67; `v35` 10000 vs 17.5; `v39` 10000 vs 2128.5. This shows as black, flickering shapes in mirrors and windows. The fix, carrying the test's writes from one candidate to the next and out of the region, is what I'm on now. The other reflection loops (`0x2530`, `0x62a8`, `0x79d8`) have the same kind of test. **Smaller things:** - The two reflection loops that read the hit triangle's vertices (`0xb88`, `0x3818`) now take a rehydrated mesh's vertices from the console's own triangle node: a 4-byte entry per primitive naming the node and the vertex order. - Verify mode now samples one differing lane per compared register (native and console value), which is how the layer problem showed up. - A "host command list did not close (The parameter is incorrect)" failure ended 5 of today's runs 27-95 s after launch, during the intro movie and decoration bakes, before any ray tracing work. It also happened once with ray tracing off, so I don't think it's ours, but I haven't run the diagnostics build on it yet.
Author
Owner

@⁠adammeftah on GitHub · 2026-11-29 18:37 UTC · original

Glad it helped. Yes please on the dumps. The console's own triangles per primitive against our meshlet decode is a check we haven't been able to run.

**@⁠adammeftah** on GitHub · 2026-11-29 18:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7260624151) Glad it helped. Yes please on the dumps. The console's own triangles per primitive against our meshlet decode is a check we haven't been able to run.
Author
Owner

@⁠adammeftah on GitHub · 2026-11-29 19:37 UTC · original

One thing on the back-face cull, from disassembling the walks here: the XOR isn't the whole story. Each walk then multiplies the cull mode by a constant built into that walk, 1, 0 or -1:

v_xor_b32 v47, v42, v47 src0_sel:BYTE_3
v_bfe_i32 v47, v47, 0, 2
v_mul_i32_i24 v47, v47, v48
v_mul_i32_i24 v47, 0, v47

The scalar form is the same (s_xor_b32 s24, s2, 1, s_bfe_i32 ... 0x20000, then v_mul_i32_i24 v41, 1, v41). With 0 the walk doesn't cull at all, and -1 culls front faces. Some walks with 0: two of the five in ScreenProbes_TraceRays (f22a76fcb967ee59), one in RaytraceShadows_Mixed (0873f80dd84a3c5c), and three in GatherAlphaVBuffer_WithFar (36f04a4ed0ad1d9b). IrradianceCache_ShadowTrace (f607780aa8e502d0) has one with -1 and one with 0.

If culls_back adds CULL_BACK on the XOR alone, those walks get culled where the console doesn't, or with the wrong side. We map the constant to the flag (1 back, -1 front, 0 none) and leave TRIANGLE_CULL_DISABLE to the instance flags.

**@⁠adammeftah** on GitHub · 2026-11-29 19:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7261420225) One thing on the back-face cull, from disassembling the walks here: the XOR isn't the whole story. Each walk then multiplies the cull mode by a constant built into that walk, 1, 0 or -1: ``` v_xor_b32 v47, v42, v47 src0_sel:BYTE_3 v_bfe_i32 v47, v47, 0, 2 v_mul_i32_i24 v47, v47, v48 v_mul_i32_i24 v47, 0, v47 ``` The scalar form is the same (`s_xor_b32 s24, s2, 1`, `s_bfe_i32 ... 0x20000`, then `v_mul_i32_i24 v41, 1, v41`). With 0 the walk doesn't cull at all, and -1 culls front faces. Some walks with 0: two of the five in ScreenProbes_TraceRays (f22a76fcb967ee59), one in RaytraceShadows_Mixed (0873f80dd84a3c5c), and three in GatherAlphaVBuffer_WithFar (36f04a4ed0ad1d9b). IrradianceCache_ShadowTrace (f607780aa8e502d0) has one with -1 and one with 0. If `culls_back` adds CULL_BACK on the XOR alone, those walks get culled where the console doesn't, or with the wrong side. We map the constant to the flag (1 back, -1 front, 0 none) and leave TRIANGLE_CULL_DISABLE to the instance flags.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-29 19:50 UTC · original

@⁠adammeftah thanks for the cull constant. I'll map it as you do (1 back, -1 front, 0 none, TRIANGLE_CULL_DISABLE left to the instance flags). Our reflection walks have 1, but GI and the sky probe have 0 in places, so we were culling those wrongly.

On the dumps: I'd rather not post data extracted from the game. Instead, here is how to make the same dumps from your own copy, plus two things I got wrong or left out, which matter for the comparison.

Correction to my last comment. The reflection walks' layer state was not the problem. Our translation does carry the test's register writes from one candidate to the next (the splice renames registers through the new loop). The near hits came from the next point.

The console's triangle coordinates are not in object space. Header dword 15 holds a per-axis scale exponent in bytes 0-2 (x, y, z): the triangle nodes' floats are the real coordinates times 2^(byte - 127). 0x7f means 1, but most rehydrated structures have 0x8b-0x95, so scales of 2^12 to 2^22. Header dwords 4-9 are the bounds in real units. The console folds the scale into its top-level instance nodes (the walks have no ldexp; they transform the ray with the instance node's matrix). On top of that, LeafRehydration takes a LeafRehydrationParams with a translation, a scale and three rotation rows, so a rehydrated mesh's leaves can be in a rotated frame too. For a per-primitive comparison against your decode, unscale by dword 15 and compare up to that transform, or compare against the header bounds first.

The builder's own code confirms your layouts. XboxBvhBuilder.dll's 52 programs carry DXIL with debug names and full cbuffer structures. Extract the DXBC containers (each starts with DXBC; the total size is the dword at byte 24) and disassemble them with dxc -dumpbin. They are named LoadTriangles, LeafRehydration, DecompressHeader, Box16Rehydration, Box32Rehydration and so on. Both LoadTriangles and LeafRehydration decode format 16 exactly as you described. The mode switch is: mode 0 gives the fields as (z, y, x), mode 1 as (y, z, x), and any other value as (x, y, z). The meshlet decode matches yours too, with the stride's bit 15 swapping indices 0 and 2 for index format 53 only. Against the console's header bounds, our decode of those formats comes out exactly equal.

Making the console-side dumps. Our next push has VICTORY_RT_REHYDRATE_READBACK=1 (the readback path) with VICTORY_RT_BLAS_DUMP=<folder>: <dest>.rh is the console's structure, <dest>.rh.txt the geometry descriptions. The node walk is as in my last comment, plus the dword 15 unscale.

One more for your decoder: many streamed meshes' bytes (vertices, the 32-byte header, the meshlet stream) are not there yet when their build is called. They arrive a little later. Under VIctory the console's own builder then builds them from zeros. That shows as structures whose triangle nodes have their ids but all-zero vertices. We now flag a build whose format-16 header or meshlet header is still empty and build it again in the next list until the bytes are there.

**@⁠Yorivel** on GitHub · 2026-11-29 19:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7261597325) @⁠adammeftah thanks for the cull constant. I'll map it as you do (1 back, -1 front, 0 none, `TRIANGLE_CULL_DISABLE` left to the instance flags). Our reflection walks have 1, but GI and the sky probe have 0 in places, so we were culling those wrongly. On the dumps: I'd rather not post data extracted from the game. Instead, here is how to make the same dumps from your own copy, plus two things I got wrong or left out, which matter for the comparison. **Correction to my last comment.** The reflection walks' layer state was not the problem. Our translation does carry the test's register writes from one candidate to the next (the splice renames registers through the new loop). The near hits came from the next point. **The console's triangle coordinates are not in object space.** Header dword 15 holds a per-axis scale exponent in bytes 0-2 (x, y, z): the triangle nodes' floats are the real coordinates times `2^(byte - 127)`. `0x7f` means 1, but most rehydrated structures have `0x8b`-`0x95`, so scales of 2^12 to 2^22. Header dwords 4-9 are the bounds in real units. The console folds the scale into its top-level instance nodes (the walks have no `ldexp`; they transform the ray with the instance node's matrix). On top of that, `LeafRehydration` takes a `LeafRehydrationParams` with a translation, a scale and three rotation rows, so a rehydrated mesh's leaves can be in a rotated frame too. For a per-primitive comparison against your decode, unscale by dword 15 and compare up to that transform, or compare against the header bounds first. **The builder's own code confirms your layouts.** `XboxBvhBuilder.dll`'s 52 programs carry DXIL with debug names and full cbuffer structures. Extract the `DXBC` containers (each starts with `DXBC`; the total size is the dword at byte 24) and disassemble them with `dxc -dumpbin`. They are named `LoadTriangles`, `LeafRehydration`, `DecompressHeader`, `Box16Rehydration`, `Box32Rehydration` and so on. Both `LoadTriangles` and `LeafRehydration` decode format 16 exactly as you described. The mode switch is: mode 0 gives the fields as (z, y, x), mode 1 as (y, z, x), and any other value as (x, y, z). The meshlet decode matches yours too, with the stride's bit 15 swapping indices 0 and 2 for index format 53 only. Against the console's header bounds, our decode of those formats comes out exactly equal. **Making the console-side dumps.** Our next push has `VICTORY_RT_REHYDRATE_READBACK=1` (the readback path) with `VICTORY_RT_BLAS_DUMP=<folder>`: `<dest>.rh` is the console's structure, `<dest>.rh.txt` the geometry descriptions. The node walk is as in my last comment, plus the dword 15 unscale. **One more for your decoder:** many streamed meshes' bytes (vertices, the 32-byte header, the meshlet stream) are not there yet when their build is called. They arrive a little later. Under VIctory the console's own builder then builds them from zeros. That shows as structures whose triangle nodes have their ids but all-zero vertices. We now flag a build whose format-16 header or meshlet header is still empty and build it again in the next list until the bytes are there.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-30 01:41 UTC · original

Update from tonight, mostly about which native walks still differ from the console's and why. Everything below was measured or read from the program code; nothing here is extracted game data.

1. A trap for anyone writing a compute pass that reads by raw address (FXC, cs_5_1). Our geometry decode pass hung the device (DXGI_ERROR_DEVICE_HUNG) within a minute or two in game, never in unit tests. Bounds checks written as ok ? V.Load(at) : 0 don't protect anything: FXC evaluates both sides of ?: and flattens small ifs, so the compiled code does ld_raw at the unchecked address and only masks the result afterwards (fxc -Fc shows it). Root views have no bounds, so a meshlet stream the title hasn't written yet (garbage offsets) made it read gigabytes past the buffer. On NVIDIA that's a hang with no DRED page-fault address. The fix is to clamp the address itself: V.Load(ok ? at : 0). A test with garbage offsets lost the device with the old shader and passes with the clamp.

2. The per-walk cull factor, read from the code. @⁠adammeftah's pattern holds everywhere we trace: mode = bfe_i32(flags ^ 1, 0, 2), then mode * (mode & 1) (which zeroes the cull-disable modes), then times the walk's own constant. We now take that constant from each walk's code. Factor 0 in f22a76fcb967ee59 @⁠0x2ff0 and @⁠0x39f8, 0873f80dd84a3c5c @⁠0x6e0 (as you found), and also in afeea48bbb9913ad @⁠0x978, e8c962358d862e3f @⁠0x908 and 6d7fe7745ab9c6d8 @⁠0xa338. We found no -1 among the walks we replace.

3. The console's walk culls back faces of instances whose description has TRIANGLE_CULL_DISABLE; DXR doesn't. About 36-46% of the instances in the two big top levels have flag 1 or 9. We verified this with a switch flipped live in one session, against the same console structures. With our top level clearing bit 0 of the instance flags, native hits where the console's walk finds nothing went from 42% to 10% of GI rays, and back to 41% when switched off. The walk reads its cull bits from byte 3 of the instance node's second dword (global_load_dwordx4 at the node's start). In the builder's DXIL, that node is filled from an InstanceWriteCommand record prepared by the builder DLL's CPU code, so where the bit goes is decided in x64 code, not in a shader. This didn't change the picture visibly for us, but it's a real difference to keep in mind when comparing hits.

4. Which walks break the picture (visual bisect). Our runs with the title's own walks over the console's structures give a correct mirror and no ghost trails, at 7-16 fps. With VICTORY_RT_NATIVE_SKIP=<hash>@<header> we handed single walks back to the title's code:

  • the ghost trails behind anything moving come from f22a76fcb967ee59 @⁠0x1738 alone (GI);
  • the broken mirror comes from 6d7fe7745ab9c6d8 @⁠0x50c8 alone (the reflections' far rays). That walk costs little to keep on the title's code (27 fps with it skipped), unlike 0x1738.

The two walks look alike. 0x1738's candidate test reads the hit's material record (instance +52 hit group, +60 the bottom level's pointer, then the triangle node's +48 geometry) and records a see-through surface before the hit: its distance and its instance id (& 0x3ff), whether or not it commits that candidate. After the loop the code keeps that record only when it lies before the final hit (v_cmp_le_f32 vcc, v15, v37, then v_cndmask_b32 v15, 31, v27, vcc). The code after 0x50c8 does the same with two such pairs (v39/v43, v35/v22); I haven't read 0x50c8's test itself yet. The code after 0x50c8 also uses bit 2 of the hit word (v_and_b32 v41, 4, v33), and 0x1738's commit writes its hit word as (instance id & 0x3ff) + 1. So a native walk that answers "hit" with a plain 1, or that runs the test only on the candidates DXR hands it (non-opaque ones, in its own order), gives the code after a different record from the console's. That's our next fix.

5. Ruled out tonight (measured), in case it saves someone time: where both walks hit the same triangle, hit kind and barycentrics agree. The eight reads of the committed hit after GI's main walk (f22a76fcb967ee59 @⁠0x8b0) are answered correctly (the code masks away the bits our answers leave out). Building plain meshes from the page directory's copy instead of the buffer's own host copy changed nothing: they were the same copy in every one of 96k ranges.

Tools, if useful: VICTORY_RT_VERIFY now compares what the native walk gives back (distance, hit word, hit kind, barycentrics), checks every read of the committed hit after the walk, and samples which instance and mesh a "native hit, console miss" lane hit. There are also three live switch files in %LOCALAPPDATA%\victory (rt-cull-all, rt-plain-page, rt-keep-on), checked as the game runs, so an A/B happens in one session. That mattered: the console's own walk under emulation is missing different amounts of geometry from session to session, so comparisons across sessions misled us more than once. I'll push the branch once the record fix is in.

**@⁠Yorivel** on GitHub · 2026-11-30 01:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7266359937) Update from tonight, mostly about which native walks still differ from the console's and why. Everything below was measured or read from the program code; nothing here is extracted game data. **1. A trap for anyone writing a compute pass that reads by raw address (FXC, `cs_5_1`).** Our geometry decode pass hung the device (`DXGI_ERROR_DEVICE_HUNG`) within a minute or two in game, never in unit tests. Bounds checks written as `ok ? V.Load(at) : 0` don't protect anything: FXC evaluates both sides of `?:` and flattens small `if`s, so the compiled code does `ld_raw` at the unchecked address and only masks the result afterwards (`fxc -Fc` shows it). Root views have no bounds, so a meshlet stream the title hasn't written yet (garbage offsets) made it read gigabytes past the buffer. On NVIDIA that's a hang with no DRED page-fault address. The fix is to clamp the address itself: `V.Load(ok ? at : 0)`. A test with garbage offsets lost the device with the old shader and passes with the clamp. **2. The per-walk cull factor, read from the code.** @⁠adammeftah's pattern holds everywhere we trace: `mode = bfe_i32(flags ^ 1, 0, 2)`, then `mode * (mode & 1)` (which zeroes the cull-disable modes), then times the walk's own constant. We now take that constant from each walk's code. Factor 0 in `f22a76fcb967ee59` @⁠0x2ff0 and @⁠0x39f8, `0873f80dd84a3c5c` @⁠0x6e0 (as you found), and also in `afeea48bbb9913ad` @⁠0x978, `e8c962358d862e3f` @⁠0x908 and `6d7fe7745ab9c6d8` @⁠0xa338. We found no -1 among the walks we replace. **3. The console's walk culls back faces of instances whose description has `TRIANGLE_CULL_DISABLE`; DXR doesn't.** About 36-46% of the instances in the two big top levels have flag 1 or 9. We verified this with a switch flipped live in one session, against the same console structures. With our top level clearing bit 0 of the instance flags, native hits where the console's walk finds nothing went from 42% to 10% of GI rays, and back to 41% when switched off. The walk reads its cull bits from byte 3 of the instance node's second dword (`global_load_dwordx4` at the node's start). In the builder's DXIL, that node is filled from an `InstanceWriteCommand` record prepared by the builder DLL's CPU code, so where the bit goes is decided in x64 code, not in a shader. This didn't change the picture visibly for us, but it's a real difference to keep in mind when comparing hits. **4. Which walks break the picture (visual bisect).** Our runs with the title's own walks over the console's structures give a correct mirror and no ghost trails, at 7-16 fps. With `VICTORY_RT_NATIVE_SKIP=<hash>@<header>` we handed single walks back to the title's code: - the **ghost trails** behind anything moving come from `f22a76fcb967ee59` @⁠0x1738 alone (GI); - the **broken mirror** comes from `6d7fe7745ab9c6d8` @⁠0x50c8 alone (the reflections' far rays). That walk costs little to keep on the title's code (27 fps with it skipped), unlike 0x1738. The two walks look alike. 0x1738's candidate test reads the hit's material record (instance +52 hit group, +60 the bottom level's pointer, then the triangle node's +48 geometry) and **records a see-through surface before the hit: its distance and its instance id (`& 0x3ff`)**, whether or not it commits that candidate. After the loop the code keeps that record only when it lies before the final hit (`v_cmp_le_f32 vcc, v15, v37`, then `v_cndmask_b32 v15, 31, v27, vcc`). The code after 0x50c8 does the same with two such pairs (`v39`/`v43`, `v35`/`v22`); I haven't read 0x50c8's test itself yet. The code after 0x50c8 also uses **bit 2 of the hit word** (`v_and_b32 v41, 4, v33`), and 0x1738's commit writes its hit word as `(instance id & 0x3ff) + 1`. So a native walk that answers "hit" with a plain 1, or that runs the test only on the candidates DXR hands it (non-opaque ones, in its own order), gives the code after a different record from the console's. That's our next fix. **5. Ruled out tonight (measured), in case it saves someone time:** where both walks hit the same triangle, hit kind and barycentrics agree. The eight reads of the committed hit after GI's main walk (`f22a76fcb967ee59` @⁠0x8b0) are answered correctly (the code masks away the bits our answers leave out). Building plain meshes from the page directory's copy instead of the buffer's own host copy changed nothing: they were the same copy in every one of 96k ranges. **Tools, if useful:** `VICTORY_RT_VERIFY` now compares what the native walk gives back (distance, hit word, hit kind, barycentrics), checks every read of the committed hit after the walk, and samples which instance and mesh a "native hit, console miss" lane hit. There are also three live switch files in `%LOCALAPPDATA%\victory` (`rt-cull-all`, `rt-plain-page`, `rt-keep-on`), checked as the game runs, so an A/B happens in one session. That mattered: the console's own walk under emulation is missing different amounts of geometry from session to session, so comparisons across sessions misled us more than once. I'll push the branch once the record fix is in.
Author
Owner

@⁠Yorivel on GitHub · 2026-11-30 08:13 UTC · original

Second update, on why native ray tracing still looked wrong after the walks themselves were right. Three causes, all measured; nothing here is extracted game data.

1. Structure copies have to be copies (the big one). The title builds each streamed mesh at one scratch address, compacts it into an address of its own, then builds the next mesh at the same scratch address. Our native side treated a copy as an alias of its source (dst → src). So every compacted mesh turned into whatever was last built at the scratch address. One scratch address in our per-address log: five different meshes built and compacted there within 13 seconds. Instances then walked the wrong mesh with the right hit group. The results were wrong materials and a texture-atlas mosaic on reflective surfaces, hits where nothing is (dark GI), and flicker on characters.
Fix: record the copy at its place in the title's list and clone ours (CopyRaytracingAccelerationStructure, CLONE) into a structure of its own at dst, with the geometry record copied. If our source build is still pending (put off, or a rehydrate in flight), the copy waits for it. If the source is built again because its bytes weren't written the first time, the copies taken from it are cloned again. In one run: 2.5k copies cloned, none had to wait. GI walk b58eb3ca6ee46427 @⁠0xd80: native hit / console miss went from 19-34% to ~10%, and console hit / native miss is ~1%.

2. Walks whose hit lanes merge. In f22a76fcb967ee59 the hit lanes of 0x1738 and of 0x22e8 (which takes 0x1738's misses) meet at 0x2c5c. The code there reads the hit through merged registers: hit kind, barycentrics, and the instance node pointer v36 (never written natively, so the hit group came from instance 0). It also reads the hit group, geometry and primitive from the structure. The same happens in 6d7fe7745ab9c6d8 for 0x2530/0x62a8 and 0x50c8/0x79d8. We now follow those merges. The second walk is found by the == 0 test of the first's hit word before it, and the pair shares one ray query (a lane that hit the first never takes the second). The walk's step counter (s_add_i32 sN, sN, 1 then v_mov vX, sN, compared with the step limit after) is given back as 0.

3. Six traversal programs were never replaced. With VICTORY_BVH_CONSOLE=bottom they walked console top levels that were never built again: we saw an orange cast, flickering shadows and a black phone screen. These were 32ed072b9f845048, 3592426e3e9142d8, b58eb3ca6ee46427, 36f04a4ed0ad1d9b and f607780aa8e502d0 (23 regions: closest-hit pairs as above, plus first-hit walks; f607780a@⁠0xc30 is the first walk we've seen with cull factor -1). They now replace and validate. caf96a3229145fa6 (CollisionDepthBased) is wave64, which our replacement doesn't take yet. If anyone sees a black phone screen with the console builder's top levels off, this may be the reason.

On using the emulated console walk as the reference. For the remaining native-only hits we copied the console's own bottom structure at the address the instance names and walked it on the CPU. In every sampled case the fault was on the console side:

  • Triangle present, walk misses it: the console structure is whole and holds the exact triangle. With its scale undone (header dword 15, bytes 0-2 as exponents) and placed by the instance transform, it meets the sampled ray at our distance to a millimetre (for example 3.8237 vs 3.8237), but the emulated walk misses it. Every such case was a scaled structure (dword 15 bit 31). The console top level's instance node is correct, including the folded inverse transform. So the emulated image_bvh_intersect_ray on scaled bottom structures may be worth a look.
  • Collapsed triangle: the console's triangle is collapsed to a point (built before its data arrived; it isn't built again).
  • Garbage compacted copy: the console's compacted copy is garbage (cf. Marvisak/VIctory#3750, the compacted-size copy).

So a verify against the emulated walk overstates differences, and the native result is the right one there. One more trap for anyone sampling lanes: the title's top level changes its instance order between frames, so a CommittedInstanceIndex sampled in one frame doesn't name the same instance in the next frame's list.

Instance node as we read it (64 + 64 bytes, a few nodes checked):

  • +0..47: the title's object-to-world transform;
  • +48: id | mask << 24;
  • +52: hit group (24 bits) | flags;
  • +56: the bottom structure's root pointer, with 0x40 in the top byte;
  • +60: the bottom structure's address >> 8;
  • +64..111: world-to-object with the bottom structure's per-axis scale (2^(e-127)) folded in: the translation first, then the 3x3 rows.

The code after the reflection walk also reads header dword 15 bits 24-29 as an index into a table of 3x3 matrices that it applies to the hit's normal (6d7fe7745ab9c6d8 0x8de4).

Unrelated, but it cost us crashes: Windows charges every allocation in the card's memory to the PC's commit limit, mapped or not. We measured 4600 card buffers of 1.8 MB: +8.4 GB of commit with 10 MB in RAM. VIctory peaked at ~51 GB private here. With a small system-managed page file, pipelines start failing with 0x8007000E and the device gets suspended, while RAM still has 14 GB free. A fixed larger page file fixed it for us. Separately, "a host command list did not close (0x80070057)" also happened once without any memory pressure, so that's a different bug.

**@⁠Yorivel** on GitHub · 2026-11-30 08:13 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7272629236) Second update, on why native ray tracing still looked wrong after the walks themselves were right. Three causes, all measured; nothing here is extracted game data. **1. Structure copies have to be copies (the big one).** The title builds each streamed mesh at one scratch address, compacts it into an address of its own, then builds the next mesh at the same scratch address. Our native side treated a copy as an alias of its source (`dst` → `src`). So every compacted mesh turned into whatever was last built at the scratch address. One scratch address in our per-address log: five different meshes built and compacted there within 13 seconds. Instances then walked the wrong mesh with the right hit group. The results were wrong materials and a texture-atlas mosaic on reflective surfaces, hits where nothing is (dark GI), and flicker on characters. Fix: record the copy at its place in the title's list and clone ours (`CopyRaytracingAccelerationStructure`, CLONE) into a structure of its own at `dst`, with the geometry record copied. If our source build is still pending (put off, or a rehydrate in flight), the copy waits for it. If the source is built again because its bytes weren't written the first time, the copies taken from it are cloned again. In one run: 2.5k copies cloned, none had to wait. GI walk `b58eb3ca6ee46427` @⁠0xd80: native hit / console miss went from 19-34% to ~10%, and console hit / native miss is ~1%. **2. Walks whose hit lanes merge.** In `f22a76fcb967ee59` the hit lanes of 0x1738 and of 0x22e8 (which takes 0x1738's misses) meet at 0x2c5c. The code there reads the hit through merged registers: hit kind, barycentrics, and the instance node pointer `v36` (never written natively, so the hit group came from instance 0). It also reads the hit group, geometry and primitive from the structure. The same happens in `6d7fe7745ab9c6d8` for 0x2530/0x62a8 and 0x50c8/0x79d8. We now follow those merges. The second walk is found by the `== 0` test of the first's hit word before it, and the pair shares one ray query (a lane that hit the first never takes the second). The walk's step counter (`s_add_i32 sN, sN, 1` then `v_mov vX, sN`, compared with the step limit after) is given back as 0. **3. Six traversal programs were never replaced.** With `VICTORY_BVH_CONSOLE=bottom` they walked console top levels that were never built again: we saw an orange cast, flickering shadows and a black phone screen. These were `32ed072b9f845048`, `3592426e3e9142d8`, `b58eb3ca6ee46427`, `36f04a4ed0ad1d9b` and `f607780aa8e502d0` (23 regions: closest-hit pairs as above, plus first-hit walks; `f607780a`@⁠0xc30 is the first walk we've seen with cull factor -1). They now replace and validate. `caf96a3229145fa6` (CollisionDepthBased) is wave64, which our replacement doesn't take yet. If anyone sees a black phone screen with the console builder's top levels off, this may be the reason. **On using the emulated console walk as the reference.** For the remaining native-only hits we copied the console's own bottom structure at the address the instance names and walked it on the CPU. In every sampled case the fault was on the console side: - **Triangle present, walk misses it:** the console structure is whole and holds the exact triangle. With its scale undone (header dword 15, bytes 0-2 as exponents) and placed by the instance transform, it meets the sampled ray at our distance to a millimetre (for example 3.8237 vs 3.8237), but the emulated walk misses it. Every such case was a scaled structure (dword 15 bit 31). The console top level's instance node is correct, including the folded inverse transform. So the emulated `image_bvh_intersect_ray` on scaled bottom structures may be worth a look. - **Collapsed triangle:** the console's triangle is collapsed to a point (built before its data arrived; it isn't built again). - **Garbage compacted copy:** the console's compacted copy is garbage (cf. Marvisak/VIctory#3750, the compacted-size copy). So a verify against the emulated walk overstates differences, and the native result is the right one there. One more trap for anyone sampling lanes: the title's top level changes its instance order between frames, so a `CommittedInstanceIndex` sampled in one frame doesn't name the same instance in the next frame's list. **Instance node as we read it** (64 + 64 bytes, a few nodes checked): - +0..47: the title's object-to-world transform; - +48: id | mask << 24; - +52: hit group (24 bits) | flags; - +56: the bottom structure's root pointer, with 0x40 in the top byte; - +60: the bottom structure's address >> 8; - +64..111: world-to-object with the bottom structure's per-axis scale (2^(e-127)) folded in: the translation first, then the 3x3 rows. The code after the reflection walk also reads header dword 15 bits 24-29 as an index into a table of 3x3 matrices that it applies to the hit's normal (`6d7fe7745ab9c6d8` 0x8de4). **Unrelated, but it cost us crashes:** Windows charges every allocation in the card's memory to the PC's commit limit, mapped or not. We measured 4600 card buffers of 1.8 MB: +8.4 GB of commit with 10 MB in RAM. VIctory peaked at ~51 GB private here. With a small system-managed page file, pipelines start failing with `0x8007000E` and the device gets suspended, while RAM still has 14 GB free. A fixed larger page file fixed it for us. Separately, "a host command list did not close (0x80070057)" also happened once without any memory pressure, so that's a different bug.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-30 15:44 UTC · original

Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is v2026.11.30.01.

If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run:

  1. The play log: the newest victory-nvidia-play-<date>-<time>-<number>.log in %LOCALAPPDATA%\victory\logs\.
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, plus the newest .crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\ if there is one from that run.
**@⁠trustno1-coder** on GitHub · 2026-11-30 15:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/1370#issuecomment-7283499940) Closing this because it was opened before v2026.11.29.01, and a great deal has changed since then. The latest release is [v2026.11.30.01](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.30.01). If this still happens, or still applies, on the latest release, please open a new issue. For a bug, attach both logs from that run: 1. The play log: the newest `victory-nvidia-play-<date>-<time>-<number>.log` in `%LOCALAPPDATA%\victory\logs\`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, plus the newest `.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\` if there is one from that run.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA#1370
No description provided.