Merge pull request #2908 from Biswa96/cmake-spirv-remap
[platform/upstream/glslang.git] / Test / runtimeArray.vert
1 #version 450 core\r
2 \r
3 buffer bn {\r
4     int a[];\r
5     float b[];\r
6 } buf;\r
7 \r
8 uniform un {\r
9     int a[];\r
10     float b[];\r
11 } ubuf;\r
12 \r
13 buffer bna {\r
14     int a[];\r
15     float b[];\r
16 } bufa[4];\r
17 \r
18 uniform una {\r
19     int a[];\r
20     float b[];\r
21 } ubufa[4];\r
22 \r
23 buffer abn {\r
24     int aba[];\r
25     float abb[];\r
26 };\r
27 \r
28 uniform aun {\r
29     int aua[];\r
30     float aub[];\r
31 };\r
32 \r
33 layout(binding=1)                             uniform samplerBuffer       uniformTexelBufferDyn[];\r
34 layout(binding=2, r32f)                       uniform imageBuffer         storageTexelBufferDyn[];\r
35 layout(binding=3)                             uniform uname { float a; }  uniformBuffer[];\r
36 layout(binding=4)                             buffer  bname { float b; }  storageBuffer[];\r
37 layout(binding=5)                             uniform sampler2D           sampledImage[];\r
38 layout(binding=6, r32f)                       uniform image2D             storageImage[];\r
39 layout(binding=8)                             uniform samplerBuffer       uniformTexelBuffer[];\r
40 layout(binding=9, r32f)                       uniform imageBuffer         storageTexelBuffer[];\r
41 \r
42 int i;\r
43 \r
44 void main()\r
45 {\r
46     ubuf.a[3];\r
47     ubuf.b[3];\r
48     buf.a[3];\r
49     buf.b[3];\r
50 \r
51     ubufa[3].a[3];\r
52     ubufa[3].b[3];\r
53     bufa[3].a[3];\r
54     bufa[3].b[3];\r
55 \r
56     aua[3];\r
57     aub[3];\r
58     aba[3];\r
59     abb[3];\r
60 \r
61     ubuf.a[i];             // ERROR\r
62     ubuf.b[i];             // ERROR\r
63     buf.a[i];              // ERROR\r
64     buf.b[i];\r
65 \r
66     ubuf.a.length();       // ERROR\r
67     ubuf.b.length();       // ERROR\r
68     buf.a.length();        // ERROR\r
69     buf.b.length();\r
70 \r
71     ubufa[1].a[i];         // ERROR\r
72     ubufa[1].b[i];         // ERROR\r
73     bufa[1].a[i];          // ERROR\r
74     bufa[1].b[i];\r
75 \r
76     ubufa[1].a.length();   // ERROR\r
77     ubufa[1].b.length();   // ERROR\r
78     bufa[1].a.length();    // ERROR\r
79     bufa[1].b.length();\r
80 \r
81     aua[i];                // ERROR\r
82     aub[i];                // ERROR\r
83     aba[i];                // ERROR\r
84     abb[i];\r
85 \r
86     aua.length();          // ERROR\r
87     aub.length();          // ERROR\r
88     aba.length();          // ERROR\r
89     abb.length();\r
90 \r
91     uniformTexelBufferDyn[1];\r
92     storageTexelBufferDyn[1];\r
93     uniformBuffer[1];\r
94     storageBuffer[1];\r
95     sampledImage[1];\r
96     storageImage[1];\r
97     uniformTexelBuffer[1];\r
98     storageTexelBuffer[1];\r
99 \r
100     uniformTexelBufferDyn[i];  // ERROR, need extension\r
101     storageTexelBufferDyn[i];  // ERROR, need extension\r
102     uniformBuffer[i];          // ERROR, need extension\r
103     storageBuffer[i];          // ERROR, need extension\r
104     sampledImage[i];           // ERROR, need extension\r
105     storageImage[i];           // ERROR, need extension\r
106     uniformTexelBuffer[i];     // ERROR, need extension\r
107     storageTexelBuffer[i];     // ERROR, need extension\r
108 \r
109     float local[] = ubuf.b;    // ERROR, can initialize with runtime-sized array\r
110 }\r