• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 330
2
3in vec4 inVar;
4out vec4 outVar;
5
6const int constInt = 3;
7
8uniform int uniformInt;
9
10void main()
11{
12    const int a1 = 2;          // okay
13    const int a2 = constInt;   // okay
14    const int a3 = uniformInt; // error
15
16    vec4 c[constInt];              // okay
17    vec4 d[uniformInt];            // error
18    vec4 e[constInt + uniformInt]; // error
19    vec4 f[uniformInt + constInt]; // error
20
21    vec4 g[int(sin(0.3)) + 1];     // okay
22}
23
24const struct S {
25    vec3 v3;
26    ivec2 iv2;
27} s = S(vec3(3.0), ivec2(3, constInt + uniformInt));  // ERROR, non-const y componenent
28
29const struct S2 {
30    vec3 v3;
31    ivec2 iv2;
32    mat2x4 m;
33} s2 = S2(vec3(3.0), ivec2(3, constInt), mat2x4(1.0, 2.0, 3.0, inVar.x, 5.0, 6.0, 7.0, 8.0));  // ERROR, non-constant matrix
34
35const float f = 3; // okay, type conversion
36