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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-28T18:15:10Z.
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
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) and28918b7150a7aad5together were over half of the card's frame. The traversal programs (f22a76fcb967ee59GI,6d7fe7745ab9c6d8reflections, 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 astitle memory read, ~50 ms a frame in the bad stretches.A local log of the refused submissions shows the same four copies every time:
0x3e2f3f20… (in a 174 MB rangefdd56d97a806bccadeclares written)0xd5d19eea00xd5d19eea0..and of the 64 KiB block around it0xd9079f6000xd5f8ed3500xd4940fad0fdd56d97a806bcca(compute),ab619d0b7b7684d2anded8559670386bfe1also 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=1the fills are taken on the card from the copy's source as designed, and the refusal becomesa 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=1did 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_fordoes 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:
XboxBvhBuilder.dllis 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.image_bvh_intersect_rayand replaces it:RayQuerywith the loop's ray. Opaque loops become oneTraceRayInline+Proceed.Proceed()loop. Each candidate runs a copy of the console's own any-hit code, and its four reads of the structure are answered byCandidateTriangleRayT,CandidateInstanceID,CandidateInstanceContributionToHitGroupIndexandCandidateGeometryIndex. The candidate is committed where that code accepts.559d9f0184e15fe3TraceShadowRays_Checkerboard,e8c962358d862e3f,afeea48bbb9913ad,a1b20bc47e3c9597and17829ac71aab4e8d(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):
Still to do before a PR:
0873f80dd84a3c5c(sky probe),f22a76fcb967ee59(GI) and6d7fe7745ab9c6d8(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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-11-28T18:15:18Z.
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.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-28T18:44:51Z.
@Yorivel Sharing NVIDIA RTX 5080 (Blackwell) testing results on
maren-halv/VIctory-Fast@2472db1(which implements Native DXR 1.1RayQuery+XboxBvhBuildersuppression + Mode-2 tripwired copyback + Relaxed Format Casting), in case these NVIDIA-specific driver findings help anyone porting Native DXR 1.1 intoVIctory-NVIDIA:Setup
tier=20), 32 GB RAM, Windows 11.--release, separate clean shader cache.Findings on NVIDIA (Blackwell)
VICTORY_RELAXED_CAST=1triggers immediateDXGI_ERROR_INVALID_CALL(0x887A0001) on NVIDIA:width=1280 height=720 written_as=42 [R32_UINT] read_as=67 [R9G9B9E5_SHAREDEXP]),relay fence reported device removalfires with0x887A0001(DXGI_ERROR_INVALID_CALL).VICTORY_RELAXED_CAST=0eliminates this completely (0D3D12 errors). Worth gatingR32_UINT <-> R9G9B9E5_SHAREDEXPcasting (or checkingCastableFormatslist compatibility strictly) on NVIDIA drivers.VICTORY_NATIVE_RT=1crashes inside NVIDIA's RT driver (nvrtum64.dll) upon entering 3D: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: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_RTunset) enters 3D cleanly with0errors and0crashes, confirming the fault is specific to the DXR 1.1 path on NVIDIA drivers (likely an assumption validated on AMD RDNA 4 that NVIDIA'snvrtum64.dllrejects).Xbox GDKX / D3D12X contract hint for DXR 1.1 portability:
D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESCon NVIDIA, verify that:ScratchAccelerationStructureDataandDestAccelerationStructureDatastrictly respectD3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT(256 B) andGetRaytracingAccelerationStructurePrebuildInfosizes queried from the host device (never reusing console prebuild byte sizes directly),D3D12_RAYTRACING_INSTANCE_DESCarrays are 16-byte aligned and never contain stale/unpatched console GPU VAs inAccelerationStructure, andD3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESCvertex/index strides and counts are bounds-checked against the underlying host resource size beforeBuildRaytracingAccelerationStructure(NVIDIA'snvrtum64.dllis much less forgiving of out-of-bounds/zero-stride or unaligned inputs than AMD).Non-RT memory win observed on the same build (
RT-Off):VICTORY_GPU_ONLY_COPYBACK=2with tripwire + whole-section heaps) kept 3D Shared GPU memory around~2.5 GB(VRAM ~8.4 GB,RAM private ~19.8 GB,0errors) vs~8.9 GBShared /~29.5 GBCommit on standardVIctory-NVIDIA— very promising candidate ideas to evaluate individually on NVIDIA.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-28T19:40:08Z.
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 toRayQuerytoo. 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:
Instance masks. The console walks test the instance mask in software: the instance node's dword at +48 (
InstanceID | mask << 24) ANDed withmask << 24, then!= 0. The mask differs per program:0xA0for the distant shadows' see-through rays,0xDAfor 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 with0xFFwalks both. The translator now reads the mask off each loop's test and passes it toTraceRayInline.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 noTriangleObjectPositions, so: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
CommittedInstanceIndexkeeps 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 thenvrtum64.dllcrash on the 4090.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-28T19:44:01Z.
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=1plusVICTORY_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):
From the
inplace.rsnotes,VICTORY_INPLACEcan'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:
6b82bc7d22016cb5, a wave64 compute program. I haven't looked at what it draws yet.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by adammeftah on 2026-11-28T21:05:35Z.
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-28T21:07:52Z.
Tomorrow after work I'll post it sure!
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by POMXARK on 2026-11-28T23:12:55Z.
@Yorivel — quick 20-minute A/B confirmation on your
VICTORY_FILL_TITLE=1+VICTORY_PLACED_READS=1tip (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):VICTORY_FILL_TITLE=1+VICTORY_PLACED_READS=167.4 ms)65.5 ms)-1.9 ms)62.3 ms)55.4 ms)-6.9 ms)planning steps done on the card>100ms(5s bins)Even without RT enabled,
VICTORY_FILL_TITLE=1+VICTORY_PLACED_READS=1cutcard_stepsplanning time by 67% (4.2 -> 1.4 ms), shaved-2.6 msoff copy-back, reduced>100msstutter windows by 19%, and delivered a new 0-error baseline on 5080 with zero stale-constant visual artifacts!Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-29T13:18:52Z.
@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=1as usual):VICTORY_BVH_NATIVE=1: native DXR builds beside the console builder's (crates/victory-gpu/src/native_rt.rs, the interposer incrates/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, listKNOWN).1keeps 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=1for the copy waits, as above.The traversal mode and the masks are part of each program's translation key, so run
victory shadersandvictory warmwith the same switches before playing.Known problems:
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.KNOWN), not by a general rule yet, and the diagnostics are still in:VICTORY_PIPE_TIMES, the trace counters,VICTORY_RT_GEOMETRY_CHECK.Results from your side are welcome, especially if your GI and reflections run at normal speed.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-29T13:33:29Z.
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 like0x2aaa,0x5555,0xd555and0x8000corners. Read as floats they are noise up to ±3e38. The instance transforms then scale them up (scales up to 512). Built asR16G16B16A16_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
0x800Cand0x8008(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=1copies 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-wipas90585fb.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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-29T15:07:51Z.
Update:
native-rt-wipis now merged onto current main (71a57468, on top of the 1687 commits since63b902f). The conflicts were small: the shader cache's variants, the user-data words, the upload pool from #57, and registers now beingu16. 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:
TRIANGLE_CULL_DISABLE. Its culling mode is the instance's flags byte XOR 1 (withFRONT_CCWread as the sign), asv_xor_b32 … src0_sel:BYTE_3ors_xor_b32 _, flags, 1+s_bfe_i32 0x20000. The translator reads that off each loop and addsRAY_FLAG_CULL_BACK_FACING_TRIANGLES, which DXR applies per instance the same way.image_bvhresults (numerators times the reciprocal of the denominator) and from that reciprocal's sign. Those registers are now answered per candidate fromCandidateTriangleBarycentricsandCandidateTriangleFrontFace: 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.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:
CS_Alpha_GenerateShaderBins(2 programs),CS_IrradianceCache_ClearShadingChangeSignals,CS_Primary_Clear…,CS_GenerateNormalConesFirstPassandCS_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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by adammeftah on 2026-11-29T17:27:58Z.
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) << 8d1 >> 16The 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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-29T18:14:40Z.
@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
WriteBufferImmediatemarker. 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:
0x40, or negative when they lie before it. Both forms occur, so don't check it.pnames the node at(p >> 3) << 6, of kindp & 7. Kinds 4 and 5 are 16- and 32-bit boxes, with their four children's pointers first (0xFFFFFFFFfor none). Kinds 0-3 are triangle nodes.geometry << 8 | flagsat +48, two primitive ids at +52 and +56 (0xFFFFFFFFfor none), and one order byte per triangle at +60.About 3% of copies catch a structure the rehydrate hasn't finished: boxes holding
0x4000000and 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
0x81020006instead of0x80020006, 41% of triangles decodable). The title seems to wait on what the bottom-level builds write.VICTORY_BVH_CONSOLE=bottomruns 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 wherev71 == -1at the test's end); or it records the candidate as a layer and goes on walking. Layers go tov35/v22,v31/v30orv39/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;v3510000 vs 17.5;v3910000 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:
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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by adammeftah on 2026-11-29T18:37:06Z.
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by adammeftah on 2026-11-29T19:37:00Z.
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:
The scalar form is the same (
s_xor_b32 s24, s2, 1,s_bfe_i32 ... 0x20000, thenv_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_backadds 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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-29T19:50:19Z.
@adammeftah thanks for the cull constant. I'll map it as you do (1 back, -1 front, 0 none,
TRIANGLE_CULL_DISABLEleft 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).0x7fmeans 1, but most rehydrated structures have0x8b-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 noldexp; they transform the ray with the instance node's matrix). On top of that,LeafRehydrationtakes aLeafRehydrationParamswith 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 theDXBCcontainers (each starts withDXBC; the total size is the dword at byte 24) and disassemble them withdxc -dumpbin. They are namedLoadTriangles,LeafRehydration,DecompressHeader,Box16Rehydration,Box32Rehydrationand so on. BothLoadTrianglesandLeafRehydrationdecode 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) withVICTORY_RT_BLAS_DUMP=<folder>:<dest>.rhis the console's structure,<dest>.rh.txtthe 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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-30T01:41:39Z.
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 asok ? V.Load(at) : 0don't protect anything: FXC evaluates both sides of?:and flattens smallifs, so the compiled code doesld_rawat the unchecked address and only masks the result afterwards (fxc -Fcshows 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), thenmode * (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 inf22a76fcb967ee59@0x2ff0 and @0x39f8,0873f80dd84a3c5c@0x6e0 (as you found), and also inafeea48bbb9913ad@0x978,e8c962358d862e3f@0x908 and6d7fe7745ab9c6d8@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_dwordx4at the node's start). In the builder's DXIL, that node is filled from anInstanceWriteCommandrecord 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:f22a76fcb967ee59@0x1738 alone (GI);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, thenv_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_VERIFYnow 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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-30T08:13:09Z.
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 atdst, 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 walkb58eb3ca6ee46427@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
f22a76fcb967ee59the 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 pointerv36(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 in6d7fe7745ab9c6d8for 0x2530/0x62a8 and 0x50c8/0x79d8. We now follow those merges. The second walk is found by the== 0test 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, 1thenv_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=bottomthey walked console top levels that were never built again: we saw an orange cast, flickering shadows and a black phone screen. These were32ed072b9f845048,3592426e3e9142d8,b58eb3ca6ee46427,36f04a4ed0ad1d9bandf607780aa8e502d0(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:
image_bvh_intersect_rayon scaled bottom structures may be worth a look.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
CommittedInstanceIndexsampled 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):
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 (
6d7fe7745ab9c6d80x8de4).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
0x8007000Eand 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.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-30T15:44:24Z.
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:
victory-nvidia-play-<date>-<time>-<number>.login%LOCALAPPDATA%\victory\logs\.%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, plus the newest.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\if there is one from that run.