Performance is poor when Loop a uniform


clip_polygonCount is a uniform, I found the performance of this shader is very poor,.
if I change this to a constant, such as 10, the performance is quite good.
I know the use of constants will be optimized, but this clip_polygon is possible to modify. The constant doesn’t satisfy the condition, so what do I do

How about:

for (int i = 0; i < 65536; i++) {
  if (i >= clip_polygonCount) {

  // NOTE Rest of the code...
1 Like