Trees and palms no longer drop out: raw twins of buffer views not on 16 bytes begin at the view's own dword (VICTORY_TWIN_EXACT, on) #437
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!437
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-437"
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?
@LloydNicholson on GitHub · 2026-11-27 07:00 UTC · original
LloydNicholson:fix/raw-twin-exact→main· +42 −4 · 2 files · 1 commits · openFixes the outdoor tree and palm flicker tracked in #122: whole trees appearing and disappearing for single frames while the camera moves, with the title asking for the same draws every frame.
Cause
descriptor/host.rsgives every table buffer view a raw twin that translated shaders read for byte-addressed loads. A raw view has to begin on 16 bytes, sotwin_windowbegins the twin up to 12 bytes early (by). Whenby > 0the twin is only kept ifmove_rawcan move a staged slot; otherwise it is made a null view (buffer_srvandbuffer_uav). The frame line already counts these: in play, 200 to 1,000 twins a frame are null ("raw twins of buffer views made per frame … N that do not begin on 16 bytes (N null)").InstanceCulling:CS_Tree_BatchCull(55679a0547649d0b) runs in two dispatches a frame. The CPU splits the frame's tree batches between them differently every frame, and the second dispatch's batch list (4-byte entries, a table SRV) begins right after the first one's. Whenever the first dispatch's batch count is not a multiple of 4, the second list begins off 16 bytes, its twin is null, the second dispatch reads a batch list of zeros, and none of its trees are drawn that frame. Which trees drop out depends on that frame's split, so they flicker.The change
When
by > 0, the twin begins at the view's own dword (FirstElement + by / 4,NumElements - by / 4) instead of being nulled. AMD's hardware and RADV read raw buffers from any dword. On by default;VICTORY_TWIN_EXACT=0restores the null views. The frame line gains a count of twins made this way. Two files, +42/−4.Proof
All runs: RX 9060 XT 16 GB (RDNA 4), Linux, Proton (vkd3d-proton), Series X, the "Just Like Paradise" title shot in the boat mission (repeatable: about 2.5 minutes into a new game, holding A through the cutscenes).
1. On this repository's own code. Upstream
014d52deplus only the Linux page-mapping patch needed to run under Wine at all,scripts/play.ps1default switches, stock RADV. Same binary, one switch apart:Left (
VICTORY_TWIN_EXACT=0): the mangroves and palms drop out to a bare dead tree in some frames. Right (this PR): full in every title frame. The frame line with=0: 782 twins a frame not on 16 bytes, all 782 null. With the fix: 399 a frame, 0 null.2. On a full build (≈8 fps), 10 consecutive game frames each. Before: 42% of the shot's frames flicker (an A-B-A detector on de-duplicated frames). After: 0 of 20 distinct frames, every one full:
3. How it was traced (frame recorder, 3 consecutive frames of the shot; frames 0 and 1 full, frame 2 sparse).
VICTORY_INDIRECT_BATCH=1+INDIRECT_WINDOW=0, renderer ports (port 1 and 2 off here), the CPU occlusion pyramid (copied back, and forced to constants), GPU timestamps,lodScale, a fixed simulation step.Not tested: Windows, and NVIDIA. If a host refuses raw views that are not on 16 bytes,
VICTORY_TWIN_EXACT=0is the old behaviour;move_rawstays as it was for staged slots.AI-assisted (Claude Code).
🤖 Generated with Claude Code
@UwUCammie on GitHub · 2026-11-27 07:19 UTC · original
The exact offsets work on my RX 7900 XT too. With RADV 26.3.1, Wine 11.22 and vkd3d-proton
cae8353ed7959c4, a compute shader read and wrote the expected words through the runtime's raw SRV/UAV twins at 4, 8 and 12 bytes. The surrounding words stayed intact.I opened the Linux AMD backport with the exact path opt-in and the existing byte relocation for sub-dword views. Foliage still needs a matched in-game run on this card.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.