Skip to content

Commit acd7b06

Browse files
M3RT1N99claude
andcommitted
Cap hull-cull output at 127 to prevent stencil overflow
The engine's range ring pipeline uses a 7-bit GPU stencil counter that increments per overlapping ring fill. At 128+ rings the counter wraps, breaking the stencil-based outline merge (individual broken circles instead of a unified shape). This hard cap guarantees correct visuals even for pathological formations. Makes PR FAForever#149 fully obsolete. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d29d932 commit acd7b06

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

section/RangeRingCluster.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ extern "C" int ClusterRingPositions(float *data, int count)
136136
}
137137
}
138138

139+
// Hard cap at 127: the engine's range ring pipeline uses a 7-bit GPU
140+
// stencil counter that increments per overlapping ring fill. At 128+
141+
// rings the counter wraps around, breaking the stencil-based outline
142+
// merge and producing individual broken circle outlines instead of a
143+
// unified shape. Capping here guarantees correct visuals even for
144+
// pathological formations where the hull-cull keeps many boundary units.
145+
if (writeIdx > 127) writeIdx = 127;
139146
return writeIdx;
140147
}
141148

0 commit comments

Comments
 (0)