1
\$\begingroup\$

Will the follwing GLSL code work?

#version 330

uniform int size;
uniform float[size];

void main() {
  //do something
}
\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

No. The size of the array has to be a constant.

Specifically from the GLSL specification:

4.1.9 Arrays

...

When an array size is specified in a declaration, it must be an integral constant expression (see Section 4.3.3 “Constant Expressions” ) greater than zero.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .