Repository navigation
A loop limit for compute programs alone (hair strands no longer scatter with VICTORY_SHADER_LOOP_LIMIT=32) - #683
Open
Danigamer05 wants to merge 1 commit into
Open
Danigamer05 wants to merge 1 commit into
Danigamer05 wants to merge 1 commit into
Conversation
This was referenced Nov 25, 2026
…er with VICTORY_SHADER_LOOP_LIMIT=32) A lane that reaches the translated loop limit leaves the program without its writes. The low limit NVIDIA Turing cards run with (VICTORY_SHADER_LOOP_LIMIT=32; fxceless#5 loses the device without it) also cuts genuine compute loops short: the hair simulation's per-vertex constraint pass (smh_sim_*:CS_SolvePerVertConstraint) loops once per vertex of a strand, more than 32 times, so its lanes never stored and the strands drawn from the simulation buffers scattered around the head, different every frame. VICTORY_SHADER_LOOP_LIMIT_CS=<n> (diagnostics builds) sets the limit for compute programs only; unset, they follow VICTORY_SHADER_LOOP_LIMIT as before. The shader cache keys on it. Measured on an RTX 2080 SUPER (prologue world, 25-30 min runs, no device loss in any): - c96b4f2 + this, VICTORY_SHADER_LOOP_LIMIT=32 only: strands scattered (unchanged), 0.98 fps. - + VICTORY_SHADER_LOOP_LIMIT_CS=128: hair in place in every sampled world frame (a single stray strand in two), 1.02 fps. - + VICTORY_SHADER_LOOP_LIMIT_CS=1024: hair in place, 0.85 fps, and a smeared copy of the character along the bottom of the screen (another compute loop that now runs to its end). Before that, on 2119b0e: with the eight SolvePerVertConstraint variants skipped the scattered strands were gone (hair hung loose instead), and with the general limit at 1024 the hair was in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Danigamer05
force-pushed
the
fix/compute-loop-limit
branch
from
November 25, 2026 09:12
3de8598 to
d7bb22d
Compare
Author
|
Rebased onto AI-assisted (Claude Code). |
Author
|
In-game check on 9376fd6 + this PR, RTX 2080 SUPER, AI-assisted (Claude Code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
VICTORY_SHADER_LOOP_LIMIT=32, which NVIDIA Turing cards run with (#5: without it the device is lost), character hair renders as scattered strands around the head that change every frame.A lane that reaches the translated loop limit leaves the program without its writes (
count_iteration/abort_blockinlower.rs). The hair simulation's per-vertex constraint pass (smh_sim_*:CS_SolvePerVertConstraint, 8 variants) has a uniform loop with one iteration per strand vertex, more than 32 of them. So its lanes never stored, and the strands drawn from the simulation buffers came from stale or never-written positions.How it was narrowed down (RTX 2080 SUPER, 2119b0e):
smh_sim_*programs skipped → no scattered strands (posing and interpolation are fine)CS_WavePerSplineConstraint_32skipped → still scatteredCS_SolvePerVertConstraintvariants skipped → scattered strands gone (hair hangs loose, since nothing constrains it)0xa20→0x1b4c,n-1iterations)Change
VICTORY_SHADER_LOOP_LIMIT_CS=<n>(diagnostics builds) sets the loop limit for compute programs only. If it is unset, compute followsVICTORY_SHADER_LOOP_LIMITexactly as before. The shader cache keys on it. The README documents it, and there is a unit test for the parsing (the two limit parsers now share one helper).Measurements (RTX 2080 SUPER, c96b4f2 + this change, prologue world, 25–30 min each, no device loss in any run)
LOOP_LIMIT=32onlyLOOP_LIMIT=32+LOOP_LIMIT_CS=128LOOP_LIMIT=32+LOOP_LIMIT_CS=1024With 1024 a smeared copy of the character also appears along the bottom of the screen: some other compute loop now runs to its end. 128 does not show it, so the README recommends
VICTORY_SHADER_LOOP_LIMIT=32 VICTORY_SHADER_LOOP_LIMIT_CS=128.Not tested on AMD or on cards that run without a loop limit; for them nothing changes unless the new variable is set.
🤖 Generated with Claude Code