Fix black sand and terrain in indirect mesh dispatches #45
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!45
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-45"
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?
@PedroRBC on GitHub · 2026-11-30 22:02 UTC · original
fix-mesh-one-dim→main· +34 −6 · 2 files · 1 commits · closed without mergingFix black sand and terrain in indirect mesh dispatches
Problem
Sand and some terrain render black. The terrain tessellation draws are
indirect mesh dispatches, and they run with zero groups.
Cause
The terrain tessellation shader writes mesh records as
(n, 0, 0, 0)using the console's
DISPATCH_MESH_Xlayout (a count, two reservedwords, and the payload address). Both indirect clamps, the
per-execution one (
crates/victory-gpu/src/indirect.rs) and the batchedpass (
crates/victory-gpu/src/indirect/batch.rs), clamp y and z withmin(…, 1u). That keeps the zeros, son * 0 * 0runs no groups and thosedraws come out empty.
Fix
The title's mesh programs are one-dimensional, and a direct mesh dispatch
already runs as
(x, 1, 1). Both clamps now treat a record with a nonzerofirst count as
(n, 1, 1). A record(0, y, z)stays empty. The 65,535limit and the unfilled-slot check are unchanged.
VICTORY_MESH_ONE_DIM=0restores the old behaviour. The switch is readonce.
Origin
Written by zeex64 for ReVIctory (
f165475). The same fix is in VKtory.This branch is a cherry-pick onto
main, with zeex64's authorship anddate preserved. The port applies the one-dimensional dispatch handling
to both upstream clamps.
Testing
CONSOLE=series-x, 1920x1080, headless gamescope,diagprofile withdiagnosticsstopped during pipeline preparation with 79,231 native pipelines missing.
reached the world and completed the capture window. The screenshot shows
shaded terrain in a waterfront scene. Beach sand still needs a visual
check. The game log showed no device removal, unhandled exception, or panic.
@YaBulochka on GitHub · 2026-12-01 16:44 UTC · original
Confirmed on RDNA3: the sand is no longer black. Thank you.
Setup. RX 7600 XT 8 GB (RDNA3), Ryzen 5 9600X, 30 GB, RADV 26.3.1, GE-Proton11-16,
series-s,VICTORY_FSR_HOST=1,VICTORY_OUTPUT=1920x1080,VICTORY_BVH_HARDWARE=0, ray tracing otherwise on. Merged on top of our branch (4cea493+ #67 + our local switchesVICTORY_SHADER_OPT=0xffffffff,VICTORY_LOW_MEMORY=0,VICTORY_PROCESS_PRIORITY=high).Before: on the beach the sand read as a flat black surface, and the same happened to stretches of terrain further out; it looked like a missing texture rather than lighting. After merging this: sand is sand, terrain is there, no black patches in the same spot.
How it was checked: same save, same beach, on foot and in the boat, one run before and one after, switching only this merge (the rest of the tree unchanged). No other switch involved.
For the record, the two things that did not change with it here: the blocky band that appears under a distant boat on the water, and the confetti on clothes. Those are separate in our tree.
No game files, screenshots or captures included.
@YaBulochka on GitHub · 2026-12-01 17:28 UTC · original
The sand fix works here, but it takes character meshes with it — a controlled revert points straight at this change.
Setup. RX 7600 XT 8 GB (RDNA3), Ryzen 5 9600X, 30 GB, RADV 26.3.1, GE-Proton11-16,
series-s,VICTORY_FSR_HOST=1,VICTORY_OUTPUT=1920x1080,VICTORY_BVH_HARDWARE=0, ray tracing otherwise on. Tree: our branch with #67 and #31 merged, plusVICTORY_SHADER_OPT=0xffffffff,VICTORY_LOW_MEMORY=0,VICTORY_PROCESS_PRIORITY=high.With this merged. The sand and terrain are correct — no more black beach, which is what the PR is for. But characters' meshes explode: triangles shoot out of arms, torso and legs into spikes, on pedestrians in a crowd scene and on the player character close up. It is geometry, not interpolation: visible standing still, no frame generation involved.
With this reverted (
git revert -m 1of the merge, same build, same save, same spot, everything else untouched): meshes are intact again and the sand is black again. Two runs each way.So on this card the two effects are the same switch, and the mesh explosion is worse than the black sand.
Guess, not measured. Both indirect clamps now keep a one-dimensional count instead of clamping y and z to 1, which is right for the terrain's
(n, 0, 0, 0)records. If another of the title's mesh programs writes a genuinely two- or three-dimensional record, that change would now let its y and z through as written, and a wrong group count in a tessellated mesh program is exactly what turns a character into spikes.If you want more, I can run with
VICL-style frame counters — say which switch to watch and I will capture the group counts for the meshes that break.No game files, screenshots or captures included.
Pull request closed