Prison cell bounce light dark in most launches: probe-ray hits rejected by material shader-ID check (diagnosis, not yet fixed) #3750
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 Marvisak/VIctory. Originally posted by gtport646 on 2026-11-28T14:48:27Z.
The opening's prison cell (gameplay after the PROLOGUE card, Lucia at the window) loses its bounce light in most launches. The walls go grey, the area under the bunk turns black, and the pink/red cast seen on console is missing. On our builds it is dark in about 9 of 10 launches. It can also flip from dark to bright, or bright to dark, mid-run. KyleS98/VIctory-Neo documents the same dark patch on the left wall with the RT builder off (7 of ~55 runs), so the cause may not be RT-specific.
We have narrowed it down but not fixed it, and we are posting the diagnosis in case it helps anyone seeing the same thing.
Setup:
VICTORY_BVH_BUILDER=1, ambient stand-ins off.What happens
Hit shading returns zero. The dark state starts at the screen-probe hit shading (
CS_RaytracingResolvevariants, e.g.a5dcdb5ab74beaeb). About half the probe-ray hits on the cell's own geometry return radiance exactly 0. FinalGather, Inject and TemporalResolve only pass that on.The hits take an early store path. The hit shader takes the material record of the wave's first lane: instance desc
+52masked to 24 bits, plus the geometry index. It shades only if both checks pass:word0 >> 22, in the 0x74-byte table ats4+0x480) equals the dispatch's shader ID;Otherwise it stores zero and exits (around
0x9a0–0xb08). In dark frames the shader-ID check fails; the stamp check holds.Two sides name different materials for the same hit.
f22a76fcb967ee59 @0x2d88uses the instance node's contribution plus the leaf geometry.0xd0while the resolve computed0xc1–0xc4.The instance tables are a two-frame ring. There are two tables per build (A and B), each double-buffered by frame. The TLAS stage (
190fbf0ebe040169) reads them by address.CS_InstanceRotationFixup(969c1cef8b783b39) rotates them in place after the build is recorded in the same list.The outcome is decided at the camera cut into the cell (around frame 1500). Dark runs start bright and decay within 20–30 frames. Runs with multi-second frames near the cut come out bright more often (5/14 vs 0/9).
Ruled out, each with data
THIN=0.Current leading hypothesis
A parity slip: the TLAS used by a frame's traces was built from one half of the instance ring, while the resolve's buffer views read the other half. That would give exactly the small contribution mismatches we see. Whether it happens would depend on how the layer's record/submit timing lines up with the ring at the cut. We are measuring this now.
Questions
CS_InstanceRotationFixupor the instance-table ring?Diagnostic switches we added for this (off by default) are available if useful:
VICTORY_HEAP_PEEK,VICTORY_DESC_TRACE,VICTORY_ORDER_TRACEandVICTORY_PEEK_ATextensions.Co-authored with Claude (Anthropic).
Imported from Marvisak/VIctory. Originally posted by gtport646 on 2026-11-28T16:15:08Z.
Update: fixed on our side, with two causes. The cell now comes out lit in 5 of 5 launches through frame 3000+, about 61-63 under the bunk against about 60 on the console (RTX 4090, Series S,
VICTORY_BVH_BUILDER=1, no ambient stand-ins).Cause 1: shader-bin offsets computed as two 32-lane halves
CS_GenerateShaderBinOffsets(8dd8d739047fe557) is one 64-lane console wave doing a prefix sum over all 64 lanes, with lane 63 adding the total. Our translator had no exact form for it on a 32-lane host, so it ran each 32-lane half as its own wave, each summing alone. Bin offsets then overlapped wherever bins fell in both halves. That happens when the set of hit shaders in view changes, which is exactly the camera cut into the cell. Whole waves of probe-ray hits were binned under the wrong shader, and the hit shader (a5dcdb5ab74beaeb) rejected them on its shader-ID check and stored zero.Fix: give that program the exact wave-wide form (one branch taken by the whole wave). The rejection burst at the cut disappears. If your tree runs wave64 programs as two host waves, check which form this program gets. With
VICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_WHY=1 victory translate --list <dir>, any "local waves" or "approximate" form here is the bug.Cause 2: compacted-size copy taken before the builder ran (port of Iweisc/leopard
6ab839ebdc)The title asks the BVH builder for a structure's compacted size, then copies it out of the builder's small result buffer in the same command list. We made that copy on the CPU at submission, before the list's own dispatches ran, so it read the old size. The title then gave the structure room for the wrong size, and the copy into that room overwrote neighbouring structures. Hits that walk a corrupted structure stay dark without tripping the shader-ID check, which matched the runs that were dark with zero rejections.
Fix: a copy whose source is a builder result page is recorded on the card at its place in the list, into a read-back buffer that lands with the list. That's about 4,100 such copies per run in the opening. With it off, the cell drops back to 52-55.
Things that did not help
THIN=0.@KyleS98: your dark left wall with the builder off might be cause 1, or another inexact wave64 translation. We can share the patches if useful.
Co-authored with Claude (Anthropic).
Imported from Marvisak/VIctory. Originally posted by gtport646 on 2026-11-29T03:38:41Z.
Update: a third cause, fixed. It may affect anyone running with
VICTORY_BVH_BUILDER=1on a 32-lane GPU (NVIDIA).The title's streamed ray-tracing structures were unpacked with a garbage root in ~41% of cases on 32-lane hosts.
XboxBvhBuilder'sBox16Rehydration(caa78b8ca62bc3d6) andBox32Rehydration(28918b7150a7aad5) unpack one level of a streamed structure's boxes in place. Each group is one 64-lane console wave, dispatched counted in threads, so the last group of each level is partial (the root's level is always a single node). Both programs takes_bcnt1 execon entry as the level's node count and use it to find each lane's children. Our translator only honoured the thread count for wave64 programs on 64-lane hosts. On a 32-lane host all 64 lanes ran, every partial group read children from the wrong place, and the root came out as garbage. Rays then make one box test at the root and never reach a triangle. Walls, floors and fixtures are mostly these streamed structures, so close-range rays miss them.What it fixed for us (RTX 4090, Series S, builder on, 4 launches plus a control run with the switch off on the same exe):
The fix is a port of Mangrove
75e590bac2's partial-active handling, plus one case it missed. Lanes past the dispatch count stay alive, because the split wave's barriers need them. They are excluded from memory accesses, from EXEC ballots and reductions, and from selects by EXEC lanes. The last part is the addition: these programs zero inactive lanes withs_or_saveexec+v_cndmaskbefore their DPP prefix sums. Offline, exactly 4 programs change (Box16, Box32, PrefixSum256, PrefixSum512), all 52 builder programs validate, and none of the title's 2,996 own programs change.VICTORY_COUNTED_HALVES=0restores the old behaviour, and the switch is part of the translation-cache key.diff (2 files, +86 / -16)
About 1.3% of roots are still broken. They are the same structures in every run, so we're still investigating. The cell's bounce light is still about 0.5–0.7× the console's in its darkest corners, and that's what we're chasing next.
Co-authored with Claude (Anthropic).
Imported from Marvisak/VIctory. Originally posted by gtport646 on 2026-11-29T13:45:26Z.
Another cause of dark indirect light, and it may affect every tree that inherited the pixel-loop cap.
Our translator cut translated loops at 128 iterations in pixel shaders (256 vertex/mesh, 4,096 compute), as a GPU-hang safety net.
PS_IntegrateEnvBRDF(a467d848…here) runs three sample loops of 1,024. Every pixel hit the cut and was discarded, so the environment-BRDF lookup table was never written. It runs once at load and kept whatever memory it started with. Everything that reads it got garbage, which shows up as ambient and indirect light at about 0.5–0.7×, mostly in shadowed areas. Directly lit surfaces look right. Because the table held uninitialised memory, the result can also vary from launch to launch.Credit to fixafail (
44010e8ae8), who measured title loops above these caps.Measured on our side (RTX 4090, Series S, builder on, cell-only, against the console capture):
PS_IntegrateEnvBRDFreproduces the whole change, so it is that one program.Quick check for your tree: if your pixel-loop cap is below 1,024, try
PS_IntegrateEnvBRDF(or every pixel loop) at 4,096 and compare shadowed areas against the console.The change on our side is one line in the loop-limit lowering: the per-stage defaults become a single 4,096.
Co-authored with Claude (Anthropic).