Will the follwing GLSL code work?

#version 330

uniform int size;
uniform float[size];

void main() {
  //do something

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.