• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 310 es
2
3// Check name mangling of functions with parameters that are multi-dimensional arrays.
4
5#define NX 2
6#define NY 3
7#define NZ 4
8void f(bool a, float b, uint[4] c, int[NY][NX] d) {
9}
10
11void main() {
12  int[NY][NX] d;
13  f(false, 12.1, uint[NZ](uint(0),uint(1),uint(1),uint(2)), d);
14}
15
16buffer b {
17    float u[];  // ERROR
18    vec4 v[];
19} name[3];
20
21uniform ub {
22    float u;
23    vec4 v[];   // ERROR
24} uname[3];
25
26buffer b2 {
27    float u;
28    vec4 v[][];  // ERROR
29} name2[3];
30
31buffer b3 {
32    float u;
33    vec4 v[][7];
34} name3[3];
35
36// General arrays of arrays
37
38float[4][5][6] many[1][2][3];
39
40float gu[][7];     // ERROR, size required
41float g4[4][7];
42float g5[5][7];
43
44float[4][7] foo(float a[5][7])
45{
46    float r[7];
47    r = a[2];
48    float[](a[0], a[1], r, a[3]);              // ERROR, too few dims
49    float[4][7][4](a[0], a[1], r, a[3]);       // ERROR, too many dims
50    return float[4][7](a[0], a[1], r, a[3]);
51    return float[][](a[0], a[1], r, a[3]);
52    return float[][7](a[0], a[1], a[2], a[3]);
53}
54
55void bar(float[5][7]) {}
56
57void foo2()
58{
59    {
60        float gu[3][4][2];
61
62        gu[2][4][1] = 4.0;                     // ERROR, overflow
63    }
64    vec4 ca4[3][2] = vec4[][](vec4[2](vec4(0.0), vec4(1.0)),
65                              vec4[2](vec4(0.0), vec4(1.0)),
66                              vec4[2](vec4(0.0), vec4(1.0)));
67    vec4 caim[][2] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
68                              vec4[2](vec4(4.0), vec4(2.0)),
69                              vec4[2](vec4(4.0), vec4(2.0)));
70    vec4 caim2[][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
71                              vec4[2](vec4(4.0), vec4(2.0)),
72                              vec4[2](vec4(4.0), vec4(2.0)));
73    vec4 caim3[3][] = vec4[][](vec4[2](vec4(4.0), vec4(2.0)),
74                               vec4[2](vec4(4.0), vec4(2.0)),
75                               vec4[2](vec4(4.0), vec4(2.0)));
76
77    g4 = foo(g5);
78    g5 = g4;           // ERROR, wrong types
79    gu = g4;           // ERROR, not yet sized
80
81    foo(gu);           // ERROR, not yet sized
82    bar(g5);
83
84    if (foo(g5) == g4)
85        ;
86    if (foo(g5) == g5)  // ERROR, different types
87        ;
88
89    float u[5][7];
90    u[5][2] = 5.0;      // ERROR
91    foo(u);
92
93    vec4 badAss[3];
94    name[1].v[-1];     // ERROR
95    name[1].v[1] = vec4(4.3);
96    name[1].v = badAss;  // ERROR, bad assignemnt
97
98    name3[0].v[1].length();  // 7
99    name3[0].v.length();     // run time
100}
101
102struct badS {
103    int sa[];     // ERROR
104    int a[][];    // ERROR
105    int b[][2];   // ERROR
106    int c[2][];   // ERROR
107    int d[][4];   // ERROR
108};
109
110in float inArray[2][3];    // ERROR
111out float outArray[2][3];  // ERROR
112
113uniform ubaa {
114    int a;
115} ubaaname[2][3];  // ERROR
116
117vec3 func(in mat3[2] x[3])
118{
119	mat3 a0 = x[2][1];
120    return a0[2];
121}
122