• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 420 core
2
3const mat2x2 a = mat2( vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) );
4mat2x2 b = { vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) };
5const mat2x2 c = { { 1.0, 0.0, }, { 0.0, 1.0 } };
6
7float a2[2] = { 3.4, 4.2, 5.0 }; // illegal
8vec2 b2 = { 1.0, 2.0, 3.0 }; // illegal
9mat3x3 c2 = { vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0) }; // illegal
10mat2x2 d = { 1.0, 0.0, 0.0, 1.0 }; // illegal, can't flatten nesting
11
12struct {
13    float a;
14    int b;
15} e = { 1.2, 2, };
16
17struct {
18    float a;
19    int b;
20} e2 = { 1, 3 }; // legal, first initializer is converted
21
22struct {
23    float a;
24    int b;
25} e3 = { 1.2, 2, 3 }; // illegal
26
27int a3 = true; // illegal
28vec4 b3[2] = { vec4(0.0), 1.0 }; // illegal
29vec4 b4[2] = vec4[2](vec4(0.0), mat2x2(1.0)); // illegal
30mat4x2 c3 = { vec3(0.0), vec3(1.0) }; // illegal
31
32struct S1 {
33    vec4 a;
34    vec4 b;
35};
36
37struct {
38    float s;
39    float t;
40} d2[] = { S1(vec4(0.0), vec4(1.1)) }; // illegal
41
42float b5[] = { 3.4, 4.2, 5.0, 5.2, 1.1 };
43
44struct S3 {
45    float f;
46    mat2x3 m23;
47};
48
49struct S4 {
50    uvec2 uv2;
51    S3 s[2];
52};
53
54struct Single1 { int f; };
55Single1 single1 = { 10 };
56
57struct Single2 { uvec2 v; };
58Single2 single2 = { { 1, 2 } };
59
60struct Single3 { Single1 s1; };
61Single3 single3 = { { 3 } };
62
63struct Single4 { Single2 s1; };
64Single4 single4 = { { { 4u, 5u } } };
65
66const S4 constructed = S4(uvec2(1, 2),
67                          S3[2](S3(3.0, mat2x3(4.0)),
68                                S3(5.0, mat2x3(6.0))));
69
70const S4 curlybad1 = { {1, 2},
71                       { {3,   {4.0, 0, 0.0}, {0.0, 4.0, 0.0 } },       // ERROR, the mat2x3 isn't isolated
72                         {5.0, {6, 0.0, 0.0}, {0.0, 6.0, 0.0 } } } };
73
74const S4 curlyInit = { {1, 2},
75                       { {3,   { {4.0, 0, 0.0}, {0.0, 4.0, 0.0 } } },
76                         {5.0, { {6, 0.0, 0.0}, {0.0, 6.0, 0.0 } } } } };
77
78float vc1, vc2, vc3;
79vec3 av3 = vec3(vc1, vc2, vc3);
80vec3 bv3 = { vc1, vc2, vc3 };
81
82void main()
83{
84    memoryBarrier();
85
86    if (constructed == curlybad1)
87        ;
88    if (constructed == curlyInit)
89        ;
90}
91