Front-ends GLSL/HLSL: Fix initializer lists for structs of one member.

Single member structs initialized with an initializer list had
an incorrect argument for constructor emulation.
This commit is contained in:
John Kessenich 2016-07-29 18:22:22 -06:00
parent 96e9f47cbb
commit ff13213547
8 changed files with 567 additions and 331 deletions

View File

@ -51,6 +51,18 @@ struct S4 {
S3 s[2];
};
struct Single1 { int f; };
Single1 single1 = { 10 };
struct Single2 { uvec2 v; };
Single2 single2 = { { 1, 2 } };
struct Single3 { Single1 s1; };
Single3 single3 = { { 3 } };
struct Single4 { Single2 s1; };
Single4 single4 = { { { 4u, 5u } } };
const S4 constructed = S4(uvec2(1, 2),
S3[2](S3(3.0, mat2x3(4.0)),
S3(5.0, mat2x3(6.0))));

View File

@ -732,7 +732,7 @@ ERROR: 0:29: 'const 2-element array of 4-component vector of float' : cannot con
ERROR: 0:29: '=' : cannot convert from 'const float' to 'global 2-element array of 4-component vector of float'
ERROR: 0:30: 'initializer list' : wrong number of matrix columns: temp 4X2 matrix of float
ERROR: 0:40: 'constructor' : cannot convert parameter 1 from 'temp float' to 'temp structure{global float s, global float t}'
ERROR: 0:58: 'initializer list' : wrong number of structure members
ERROR: 0:70: 'initializer list' : wrong number of structure members
ERROR: 13 compilation errors. No code generated.
@ -770,51 +770,73 @@ ERROR: node is still EOpNull!
0:42 5.000000
0:42 5.200000
0:42 1.100000
0:67 Sequence
0:67 move second child to first child (temp 3-component vector of float)
0:67 'av3' (global 3-component vector of float)
0:67 Construct vec3 (global 3-component vector of float)
0:67 'vc1' (global float)
0:67 'vc2' (global float)
0:67 'vc3' (global float)
0:68 Sequence
0:68 move second child to first child (temp 3-component vector of float)
0:68 'bv3' (global 3-component vector of float)
0:68 Construct vec3 (temp 3-component vector of float)
0:68 'vc1' (global float)
0:68 'vc2' (global float)
0:68 'vc3' (global float)
0:70 Function Definition: main( (global void)
0:70 Function Parameters:
0:72 Sequence
0:72 MemoryBarrier (global void)
0:74 Test condition and select (temp void)
0:74 Condition
0:74 Compare Equal (temp bool)
0:74 Constant:
0:74 1 (const uint)
0:74 2 (const uint)
0:74 3.000000
0:74 4.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 4.000000
0:74 0.000000
0:74 5.000000
0:74 6.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 6.000000
0:74 0.000000
0:74 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:74 true case is null
0:76 Test condition and select (temp void)
0:76 Condition
0:76 Constant:
0:76 true (const bool)
0:76 true case is null
0:55 Sequence
0:55 move second child to first child (temp structure{global int f})
0:55 'single1' (global structure{global int f})
0:55 Constant:
0:55 10 (const int)
0:58 Sequence
0:58 move second child to first child (temp structure{global 2-component vector of uint v})
0:58 'single2' (global structure{global 2-component vector of uint v})
0:58 Constant:
0:58 1 (const uint)
0:58 2 (const uint)
0:61 Sequence
0:61 move second child to first child (temp structure{global structure{global int f} s1})
0:61 'single3' (global structure{global structure{global int f} s1})
0:61 Constant:
0:61 3 (const int)
0:64 Sequence
0:64 move second child to first child (temp structure{global structure{global 2-component vector of uint v} s1})
0:64 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:64 Constant:
0:64 4 (const uint)
0:64 5 (const uint)
0:79 Sequence
0:79 move second child to first child (temp 3-component vector of float)
0:79 'av3' (global 3-component vector of float)
0:79 Construct vec3 (global 3-component vector of float)
0:79 'vc1' (global float)
0:79 'vc2' (global float)
0:79 'vc3' (global float)
0:80 Sequence
0:80 move second child to first child (temp 3-component vector of float)
0:80 'bv3' (global 3-component vector of float)
0:80 Construct vec3 (temp 3-component vector of float)
0:80 'vc1' (global float)
0:80 'vc2' (global float)
0:80 'vc3' (global float)
0:82 Function Definition: main( (global void)
0:82 Function Parameters:
0:84 Sequence
0:84 MemoryBarrier (global void)
0:86 Test condition and select (temp void)
0:86 Condition
0:86 Compare Equal (temp bool)
0:86 Constant:
0:86 1 (const uint)
0:86 2 (const uint)
0:86 3.000000
0:86 4.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 4.000000
0:86 0.000000
0:86 5.000000
0:86 6.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 6.000000
0:86 0.000000
0:86 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:86 true case is null
0:88 Test condition and select (temp void)
0:88 Condition
0:88 Constant:
0:88 true (const bool)
0:88 true case is null
0:? Linker Objects
0:? 'a' (const 2X2 matrix of float)
0:? 1.000000
@ -840,6 +862,10 @@ ERROR: node is still EOpNull!
0:? 'c3' (global 4X2 matrix of float)
0:? 'd2' (global implicitly-sized array of structure{global float s, global float t})
0:? 'b5' (global 5-element array of float)
0:? 'single1' (global structure{global int f})
0:? 'single2' (global structure{global 2-component vector of uint v})
0:? 'single3' (global structure{global structure{global int f} s1})
0:? 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:? 'constructed' (const structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:? 1 (const uint)
0:? 2 (const uint)
@ -1524,51 +1550,73 @@ ERROR: node is still EOpNull!
0:42 5.000000
0:42 5.200000
0:42 1.100000
0:67 Sequence
0:67 move second child to first child (temp 3-component vector of float)
0:67 'av3' (global 3-component vector of float)
0:67 Construct vec3 (global 3-component vector of float)
0:67 'vc1' (global float)
0:67 'vc2' (global float)
0:67 'vc3' (global float)
0:68 Sequence
0:68 move second child to first child (temp 3-component vector of float)
0:68 'bv3' (global 3-component vector of float)
0:68 Construct vec3 (temp 3-component vector of float)
0:68 'vc1' (global float)
0:68 'vc2' (global float)
0:68 'vc3' (global float)
0:70 Function Definition: main( (global void)
0:70 Function Parameters:
0:72 Sequence
0:72 MemoryBarrier (global void)
0:74 Test condition and select (temp void)
0:74 Condition
0:74 Compare Equal (temp bool)
0:74 Constant:
0:74 1 (const uint)
0:74 2 (const uint)
0:74 3.000000
0:74 4.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 4.000000
0:74 0.000000
0:74 5.000000
0:74 6.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 6.000000
0:74 0.000000
0:74 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:74 true case is null
0:76 Test condition and select (temp void)
0:76 Condition
0:76 Constant:
0:76 true (const bool)
0:76 true case is null
0:55 Sequence
0:55 move second child to first child (temp structure{global int f})
0:55 'single1' (global structure{global int f})
0:55 Constant:
0:55 10 (const int)
0:58 Sequence
0:58 move second child to first child (temp structure{global 2-component vector of uint v})
0:58 'single2' (global structure{global 2-component vector of uint v})
0:58 Constant:
0:58 1 (const uint)
0:58 2 (const uint)
0:61 Sequence
0:61 move second child to first child (temp structure{global structure{global int f} s1})
0:61 'single3' (global structure{global structure{global int f} s1})
0:61 Constant:
0:61 3 (const int)
0:64 Sequence
0:64 move second child to first child (temp structure{global structure{global 2-component vector of uint v} s1})
0:64 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:64 Constant:
0:64 4 (const uint)
0:64 5 (const uint)
0:79 Sequence
0:79 move second child to first child (temp 3-component vector of float)
0:79 'av3' (global 3-component vector of float)
0:79 Construct vec3 (global 3-component vector of float)
0:79 'vc1' (global float)
0:79 'vc2' (global float)
0:79 'vc3' (global float)
0:80 Sequence
0:80 move second child to first child (temp 3-component vector of float)
0:80 'bv3' (global 3-component vector of float)
0:80 Construct vec3 (temp 3-component vector of float)
0:80 'vc1' (global float)
0:80 'vc2' (global float)
0:80 'vc3' (global float)
0:82 Function Definition: main( (global void)
0:82 Function Parameters:
0:84 Sequence
0:84 MemoryBarrier (global void)
0:86 Test condition and select (temp void)
0:86 Condition
0:86 Compare Equal (temp bool)
0:86 Constant:
0:86 1 (const uint)
0:86 2 (const uint)
0:86 3.000000
0:86 4.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 4.000000
0:86 0.000000
0:86 5.000000
0:86 6.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 6.000000
0:86 0.000000
0:86 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:86 true case is null
0:88 Test condition and select (temp void)
0:88 Condition
0:88 Constant:
0:88 true (const bool)
0:88 true case is null
0:? Linker Objects
0:? 'patchIn' (patch in 4-component vector of float)
0:? 'anon@0' (out block{gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 3-element array of float ClipDistance gl_ClipDistance})
@ -1616,6 +1664,10 @@ ERROR: node is still EOpNull!
0:? 'c3' (global 4X2 matrix of float)
0:? 'd2' (global 1-element array of structure{global float s, global float t})
0:? 'b5' (global 5-element array of float)
0:? 'single1' (global structure{global int f})
0:? 'single2' (global structure{global 2-component vector of uint v})
0:? 'single3' (global structure{global structure{global int f} s1})
0:? 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:? 'constructed' (const structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:? 1 (const uint)
0:? 2 (const uint)

View File

@ -12,7 +12,7 @@ ERROR: 0:29: 'const 2-element array of 4-component vector of float' : cannot con
ERROR: 0:29: '=' : cannot convert from 'const float' to 'global 2-element array of 4-component vector of float'
ERROR: 0:30: 'initializer list' : wrong number of matrix columns: temp 4X2 matrix of float
ERROR: 0:40: 'constructor' : cannot convert parameter 1 from 'temp float' to 'temp structure{global float s, global float t}'
ERROR: 0:58: 'initializer list' : wrong number of structure members
ERROR: 0:70: 'initializer list' : wrong number of structure members
ERROR: 13 compilation errors. No code generated.
@ -50,51 +50,73 @@ ERROR: node is still EOpNull!
0:42 5.000000
0:42 5.200000
0:42 1.100000
0:67 Sequence
0:67 move second child to first child (temp 3-component vector of float)
0:67 'av3' (global 3-component vector of float)
0:67 Construct vec3 (global 3-component vector of float)
0:67 'vc1' (global float)
0:67 'vc2' (global float)
0:67 'vc3' (global float)
0:68 Sequence
0:68 move second child to first child (temp 3-component vector of float)
0:68 'bv3' (global 3-component vector of float)
0:68 Construct vec3 (temp 3-component vector of float)
0:68 'vc1' (global float)
0:68 'vc2' (global float)
0:68 'vc3' (global float)
0:70 Function Definition: main( (global void)
0:70 Function Parameters:
0:72 Sequence
0:72 MemoryBarrier (global void)
0:74 Test condition and select (temp void)
0:74 Condition
0:74 Compare Equal (temp bool)
0:74 Constant:
0:74 1 (const uint)
0:74 2 (const uint)
0:74 3.000000
0:74 4.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 4.000000
0:74 0.000000
0:74 5.000000
0:74 6.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 6.000000
0:74 0.000000
0:74 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:74 true case is null
0:76 Test condition and select (temp void)
0:76 Condition
0:76 Constant:
0:76 true (const bool)
0:76 true case is null
0:55 Sequence
0:55 move second child to first child (temp structure{global int f})
0:55 'single1' (global structure{global int f})
0:55 Constant:
0:55 10 (const int)
0:58 Sequence
0:58 move second child to first child (temp structure{global 2-component vector of uint v})
0:58 'single2' (global structure{global 2-component vector of uint v})
0:58 Constant:
0:58 1 (const uint)
0:58 2 (const uint)
0:61 Sequence
0:61 move second child to first child (temp structure{global structure{global int f} s1})
0:61 'single3' (global structure{global structure{global int f} s1})
0:61 Constant:
0:61 3 (const int)
0:64 Sequence
0:64 move second child to first child (temp structure{global structure{global 2-component vector of uint v} s1})
0:64 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:64 Constant:
0:64 4 (const uint)
0:64 5 (const uint)
0:79 Sequence
0:79 move second child to first child (temp 3-component vector of float)
0:79 'av3' (global 3-component vector of float)
0:79 Construct vec3 (global 3-component vector of float)
0:79 'vc1' (global float)
0:79 'vc2' (global float)
0:79 'vc3' (global float)
0:80 Sequence
0:80 move second child to first child (temp 3-component vector of float)
0:80 'bv3' (global 3-component vector of float)
0:80 Construct vec3 (temp 3-component vector of float)
0:80 'vc1' (global float)
0:80 'vc2' (global float)
0:80 'vc3' (global float)
0:82 Function Definition: main( (global void)
0:82 Function Parameters:
0:84 Sequence
0:84 MemoryBarrier (global void)
0:86 Test condition and select (temp void)
0:86 Condition
0:86 Compare Equal (temp bool)
0:86 Constant:
0:86 1 (const uint)
0:86 2 (const uint)
0:86 3.000000
0:86 4.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 4.000000
0:86 0.000000
0:86 5.000000
0:86 6.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 6.000000
0:86 0.000000
0:86 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:86 true case is null
0:88 Test condition and select (temp void)
0:88 Condition
0:88 Constant:
0:88 true (const bool)
0:88 true case is null
0:? Linker Objects
0:? 'a' (const 2X2 matrix of float)
0:? 1.000000
@ -120,6 +142,10 @@ ERROR: node is still EOpNull!
0:? 'c3' (global 4X2 matrix of float)
0:? 'd2' (global implicitly-sized array of structure{global float s, global float t})
0:? 'b5' (global 5-element array of float)
0:? 'single1' (global structure{global int f})
0:? 'single2' (global structure{global 2-component vector of uint v})
0:? 'single3' (global structure{global structure{global int f} s1})
0:? 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:? 'constructed' (const structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:? 1 (const uint)
0:? 2 (const uint)
@ -200,51 +226,73 @@ ERROR: node is still EOpNull!
0:42 5.000000
0:42 5.200000
0:42 1.100000
0:67 Sequence
0:67 move second child to first child (temp 3-component vector of float)
0:67 'av3' (global 3-component vector of float)
0:67 Construct vec3 (global 3-component vector of float)
0:67 'vc1' (global float)
0:67 'vc2' (global float)
0:67 'vc3' (global float)
0:68 Sequence
0:68 move second child to first child (temp 3-component vector of float)
0:68 'bv3' (global 3-component vector of float)
0:68 Construct vec3 (temp 3-component vector of float)
0:68 'vc1' (global float)
0:68 'vc2' (global float)
0:68 'vc3' (global float)
0:70 Function Definition: main( (global void)
0:70 Function Parameters:
0:72 Sequence
0:72 MemoryBarrier (global void)
0:74 Test condition and select (temp void)
0:74 Condition
0:74 Compare Equal (temp bool)
0:74 Constant:
0:74 1 (const uint)
0:74 2 (const uint)
0:74 3.000000
0:74 4.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 4.000000
0:74 0.000000
0:74 5.000000
0:74 6.000000
0:74 0.000000
0:74 0.000000
0:74 0.000000
0:74 6.000000
0:74 0.000000
0:74 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:74 true case is null
0:76 Test condition and select (temp void)
0:76 Condition
0:76 Constant:
0:76 true (const bool)
0:76 true case is null
0:55 Sequence
0:55 move second child to first child (temp structure{global int f})
0:55 'single1' (global structure{global int f})
0:55 Constant:
0:55 10 (const int)
0:58 Sequence
0:58 move second child to first child (temp structure{global 2-component vector of uint v})
0:58 'single2' (global structure{global 2-component vector of uint v})
0:58 Constant:
0:58 1 (const uint)
0:58 2 (const uint)
0:61 Sequence
0:61 move second child to first child (temp structure{global structure{global int f} s1})
0:61 'single3' (global structure{global structure{global int f} s1})
0:61 Constant:
0:61 3 (const int)
0:64 Sequence
0:64 move second child to first child (temp structure{global structure{global 2-component vector of uint v} s1})
0:64 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:64 Constant:
0:64 4 (const uint)
0:64 5 (const uint)
0:79 Sequence
0:79 move second child to first child (temp 3-component vector of float)
0:79 'av3' (global 3-component vector of float)
0:79 Construct vec3 (global 3-component vector of float)
0:79 'vc1' (global float)
0:79 'vc2' (global float)
0:79 'vc3' (global float)
0:80 Sequence
0:80 move second child to first child (temp 3-component vector of float)
0:80 'bv3' (global 3-component vector of float)
0:80 Construct vec3 (temp 3-component vector of float)
0:80 'vc1' (global float)
0:80 'vc2' (global float)
0:80 'vc3' (global float)
0:82 Function Definition: main( (global void)
0:82 Function Parameters:
0:84 Sequence
0:84 MemoryBarrier (global void)
0:86 Test condition and select (temp void)
0:86 Condition
0:86 Compare Equal (temp bool)
0:86 Constant:
0:86 1 (const uint)
0:86 2 (const uint)
0:86 3.000000
0:86 4.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 4.000000
0:86 0.000000
0:86 5.000000
0:86 6.000000
0:86 0.000000
0:86 0.000000
0:86 0.000000
0:86 6.000000
0:86 0.000000
0:86 'curlybad1' (temp structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:86 true case is null
0:88 Test condition and select (temp void)
0:88 Condition
0:88 Constant:
0:88 true (const bool)
0:88 true case is null
0:? Linker Objects
0:? 'a' (const 2X2 matrix of float)
0:? 1.000000
@ -270,6 +318,10 @@ ERROR: node is still EOpNull!
0:? 'c3' (global 4X2 matrix of float)
0:? 'd2' (global 1-element array of structure{global float s, global float t})
0:? 'b5' (global 5-element array of float)
0:? 'single1' (global structure{global int f})
0:? 'single2' (global structure{global 2-component vector of uint v})
0:? 'single3' (global structure{global structure{global int f} s1})
0:? 'single4' (global structure{global structure{global 2-component vector of uint v} s1})
0:? 'constructed' (const structure{global 2-component vector of uint uv2, global 2-element array of structure{global float f, global 2X3 matrix of float m23} s})
0:? 1 (const uint)
0:? 2 (const uint)

View File

@ -56,56 +56,78 @@ gl_FragCoord origin is upper left
0:6 'c5' (global float)
0:6 Constant:
0:6 1.500000
0:25 Function Definition: ShaderFunction(vf4; (global 4-component vector of float)
0:9 Function Parameters:
0:9 'input' (in 4-component vector of float)
0:9 Sequence
0:9 move second child to first child (temp structure{temp int f})
0:9 'single1' (global structure{temp int f})
0:9 Constant:
0:9 10 (const int)
0:12 Sequence
0:12 move second child to first child (temp structure{temp 2-component vector of uint v})
0:12 'single2' (global structure{temp 2-component vector of uint v})
0:12 Constant:
0:12 1 (const uint)
0:12 2 (const uint)
0:15 Sequence
0:15 move second child to first child (temp structure{temp structure{temp int f} s1})
0:15 'single3' (global structure{temp structure{temp int f} s1})
0:15 Constant:
0:15 3 (const int)
0:18 Sequence
0:18 move second child to first child (temp structure{temp structure{temp 2-component vector of uint v} s1})
0:18 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1})
0:18 Constant:
0:18 4 (const uint)
0:18 5 (const uint)
0:37 Function Definition: ShaderFunction(vf4; (global 4-component vector of float)
0:21 Function Parameters:
0:21 'input' (in 4-component vector of float)
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:10 'a2' (temp 4-component vector of float)
0:22 Sequence
0:22 move second child to first child (temp 4-component vector of float)
0:22 'a2' (temp 4-component vector of float)
0:? Constant:
0:? 0.200000
0:? 0.300000
0:? 0.400000
0:? 0.500000
0:20 Sequence
0:20 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 's2i' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 Construct structure (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 Constant:
0:20 9 (const int)
0:20 'a5' (global float)
0:20 Construct structure (temp structure{temp float f, temp int i})
0:20 Comma (temp float)
0:20 'a3' (global float)
0:20 'a4' (global float)
0:20 Constant:
0:20 12 (const int)
0:20 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 's2' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 Sequence
0:32 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 's2i' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 Construct structure (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 Constant:
0:32 9 (const int)
0:32 'a5' (global float)
0:32 Construct structure (temp structure{temp float f, temp int i})
0:32 Comma (temp float)
0:32 'a3' (global float)
0:32 'a4' (global float)
0:32 Constant:
0:32 12 (const int)
0:32 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 's2' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:? Construct structure (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 Constant:
0:20 9 (const int)
0:20 'a5' (global float)
0:32 Constant:
0:32 9 (const int)
0:32 'a5' (global float)
0:? Construct structure (temp structure{temp float f, temp int i})
0:20 Comma (temp float)
0:20 'a3' (global float)
0:20 'a4' (global float)
0:20 Constant:
0:20 12 (const int)
0:21 Sequence
0:21 move second child to first child (temp float)
0:21 'a8' (temp float)
0:21 Comma (temp float)
0:21 'a2' (temp 4-component vector of float)
0:21 'b2' (global float)
0:21 move second child to first child (temp float)
0:21 'a9' (temp float)
0:21 'a5' (global float)
0:23 Branch: Return with expression
0:23 component-wise multiply (temp 4-component vector of float)
0:23 'input' (in 4-component vector of float)
0:23 'a1' (global 4-component vector of float)
0:32 Comma (temp float)
0:32 'a3' (global float)
0:32 'a4' (global float)
0:32 Constant:
0:32 12 (const int)
0:33 Sequence
0:33 move second child to first child (temp float)
0:33 'a8' (temp float)
0:33 Comma (temp float)
0:33 'a2' (temp 4-component vector of float)
0:33 'b2' (global float)
0:33 move second child to first child (temp float)
0:33 'a9' (temp float)
0:33 'a5' (global float)
0:35 Branch: Return with expression
0:35 component-wise multiply (temp 4-component vector of float)
0:35 'input' (in 4-component vector of float)
0:35 'a1' (global 4-component vector of float)
0:? Linker Objects
0:? 'a1' (global 4-component vector of float)
0:? 'b1' (global 4-component vector of float)
@ -121,6 +143,10 @@ gl_FragCoord origin is upper left
0:? 'a5' (global float)
0:? 'b5' (global float)
0:? 'c5' (global float)
0:? 'single1' (global structure{temp int f})
0:? 'single2' (global structure{temp 2-component vector of uint v})
0:? 'single3' (global structure{temp structure{temp int f} s1})
0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1})
Linked fragment stage:
@ -183,56 +209,78 @@ gl_FragCoord origin is upper left
0:6 'c5' (global float)
0:6 Constant:
0:6 1.500000
0:25 Function Definition: ShaderFunction(vf4; (global 4-component vector of float)
0:9 Function Parameters:
0:9 'input' (in 4-component vector of float)
0:9 Sequence
0:9 move second child to first child (temp structure{temp int f})
0:9 'single1' (global structure{temp int f})
0:9 Constant:
0:9 10 (const int)
0:12 Sequence
0:12 move second child to first child (temp structure{temp 2-component vector of uint v})
0:12 'single2' (global structure{temp 2-component vector of uint v})
0:12 Constant:
0:12 1 (const uint)
0:12 2 (const uint)
0:15 Sequence
0:15 move second child to first child (temp structure{temp structure{temp int f} s1})
0:15 'single3' (global structure{temp structure{temp int f} s1})
0:15 Constant:
0:15 3 (const int)
0:18 Sequence
0:18 move second child to first child (temp structure{temp structure{temp 2-component vector of uint v} s1})
0:18 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1})
0:18 Constant:
0:18 4 (const uint)
0:18 5 (const uint)
0:37 Function Definition: ShaderFunction(vf4; (global 4-component vector of float)
0:21 Function Parameters:
0:21 'input' (in 4-component vector of float)
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:10 'a2' (temp 4-component vector of float)
0:22 Sequence
0:22 move second child to first child (temp 4-component vector of float)
0:22 'a2' (temp 4-component vector of float)
0:? Constant:
0:? 0.200000
0:? 0.300000
0:? 0.400000
0:? 0.500000
0:20 Sequence
0:20 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 's2i' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 Construct structure (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 Constant:
0:20 9 (const int)
0:20 'a5' (global float)
0:20 Construct structure (temp structure{temp float f, temp int i})
0:20 Comma (temp float)
0:20 'a3' (global float)
0:20 'a4' (global float)
0:20 Constant:
0:20 12 (const int)
0:20 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 's2' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 Sequence
0:32 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 's2i' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 Construct structure (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 Constant:
0:32 9 (const int)
0:32 'a5' (global float)
0:32 Construct structure (temp structure{temp float f, temp int i})
0:32 Comma (temp float)
0:32 'a3' (global float)
0:32 'a4' (global float)
0:32 Constant:
0:32 12 (const int)
0:32 move second child to first child (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:32 's2' (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:? Construct structure (temp structure{temp int j, temp float g, temp structure{temp float f, temp int i} s1})
0:20 Constant:
0:20 9 (const int)
0:20 'a5' (global float)
0:32 Constant:
0:32 9 (const int)
0:32 'a5' (global float)
0:? Construct structure (temp structure{temp float f, temp int i})
0:20 Comma (temp float)
0:20 'a3' (global float)
0:20 'a4' (global float)
0:20 Constant:
0:20 12 (const int)
0:21 Sequence
0:21 move second child to first child (temp float)
0:21 'a8' (temp float)
0:21 Comma (temp float)
0:21 'a2' (temp 4-component vector of float)
0:21 'b2' (global float)
0:21 move second child to first child (temp float)
0:21 'a9' (temp float)
0:21 'a5' (global float)
0:23 Branch: Return with expression
0:23 component-wise multiply (temp 4-component vector of float)
0:23 'input' (in 4-component vector of float)
0:23 'a1' (global 4-component vector of float)
0:32 Comma (temp float)
0:32 'a3' (global float)
0:32 'a4' (global float)
0:32 Constant:
0:32 12 (const int)
0:33 Sequence
0:33 move second child to first child (temp float)
0:33 'a8' (temp float)
0:33 Comma (temp float)
0:33 'a2' (temp 4-component vector of float)
0:33 'b2' (global float)
0:33 move second child to first child (temp float)
0:33 'a9' (temp float)
0:33 'a5' (global float)
0:35 Branch: Return with expression
0:35 component-wise multiply (temp 4-component vector of float)
0:35 'input' (in 4-component vector of float)
0:35 'a1' (global 4-component vector of float)
0:? Linker Objects
0:? 'a1' (global 4-component vector of float)
0:? 'b1' (global 4-component vector of float)
@ -248,15 +296,19 @@ gl_FragCoord origin is upper left
0:? 'a5' (global float)
0:? 'b5' (global float)
0:? 'c5' (global float)
0:? 'single1' (global structure{temp int f})
0:? 'single2' (global structure{temp 2-component vector of uint v})
0:? 'single3' (global structure{temp structure{temp int f} s1})
0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 67
// Id's are bound by 95
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "ShaderFunction" 60
EntryPoint Fragment 4 "ShaderFunction" 88
ExecutionMode 4 OriginUpperLeft
Source HLSL 450
Name 4 "ShaderFunction"
@ -269,24 +321,36 @@ gl_FragCoord origin is upper left
Name 27 "b4"
Name 29 "a5"
Name 30 "c5"
Name 33 "a2"
Name 36 "S1"
MemberName 36(S1) 0 "f"
MemberName 36(S1) 1 "i"
Name 37 "S2"
MemberName 37(S2) 0 "j"
MemberName 37(S2) 1 "g"
MemberName 37(S2) 2 "s1"
Name 39 "s2i"
Name 42 "a3"
Name 43 "a4"
Name 48 "s2"
Name 54 "a8"
Name 55 "b2"
Name 57 "a9"
Name 60 "input"
Name 65 "c4"
Name 66 "b5"
Name 33 "Single1"
MemberName 33(Single1) 0 "f"
Name 35 "single1"
Name 40 "Single2"
MemberName 40(Single2) 0 "v"
Name 42 "single2"
Name 47 "Single3"
MemberName 47(Single3) 0 "s1"
Name 49 "single3"
Name 53 "Single4"
MemberName 53(Single4) 0 "s1"
Name 55 "single4"
Name 62 "a2"
Name 64 "S1"
MemberName 64(S1) 0 "f"
MemberName 64(S1) 1 "i"
Name 65 "S2"
MemberName 65(S2) 0 "j"
MemberName 65(S2) 1 "g"
MemberName 65(S2) 2 "s1"
Name 67 "s2i"
Name 70 "a3"
Name 71 "a4"
Name 76 "s2"
Name 82 "a8"
Name 83 "b2"
Name 85 "a9"
Name 88 "input"
Name 93 "c4"
Name 94 "b5"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -315,29 +379,57 @@ gl_FragCoord origin is upper left
29(a5): 22(ptr) Variable Private
30(c5): 22(ptr) Variable Private
31: 6(float) Constant 1069547520
32: TypePointer Function 7(fvec4)
34: 7(fvec4) ConstantComposite 24 26 28 11
35: TypeInt 32 1
36(S1): TypeStruct 6(float) 35(int)
37(S2): TypeStruct 35(int) 6(float) 36(S1)
38: TypePointer Function 37(S2)
40: 35(int) Constant 9
42(a3): 22(ptr) Variable Private
43(a4): 22(ptr) Variable Private
45: 35(int) Constant 12
53: TypePointer Function 6(float)
55(b2): 22(ptr) Variable Private
59: TypePointer Input 7(fvec4)
60(input): 59(ptr) Variable Input
65(c4): 22(ptr) Variable Private
66(b5): 22(ptr) Variable Private
32: TypeInt 32 1
33(Single1): TypeStruct 32(int)
34: TypePointer Private 33(Single1)
35(single1): 34(ptr) Variable Private
36: 32(int) Constant 10
37: 33(Single1) ConstantComposite 36
38: TypeInt 32 0
39: TypeVector 38(int) 2
40(Single2): TypeStruct 39(ivec2)
41: TypePointer Private 40(Single2)
42(single2): 41(ptr) Variable Private
43: 38(int) Constant 1
44: 38(int) Constant 2
45: 39(ivec2) ConstantComposite 43 44
46: 40(Single2) ConstantComposite 45
47(Single3): TypeStruct 33(Single1)
48: TypePointer Private 47(Single3)
49(single3): 48(ptr) Variable Private
50: 32(int) Constant 3
51: 33(Single1) ConstantComposite 50
52: 47(Single3) ConstantComposite 51
53(Single4): TypeStruct 40(Single2)
54: TypePointer Private 53(Single4)
55(single4): 54(ptr) Variable Private
56: 38(int) Constant 4
57: 38(int) Constant 5
58: 39(ivec2) ConstantComposite 56 57
59: 40(Single2) ConstantComposite 58
60: 53(Single4) ConstantComposite 59
61: TypePointer Function 7(fvec4)
63: 7(fvec4) ConstantComposite 24 26 28 11
64(S1): TypeStruct 6(float) 32(int)
65(S2): TypeStruct 32(int) 6(float) 64(S1)
66: TypePointer Function 65(S2)
68: 32(int) Constant 9
70(a3): 22(ptr) Variable Private
71(a4): 22(ptr) Variable Private
73: 32(int) Constant 12
81: TypePointer Function 6(float)
83(b2): 22(ptr) Variable Private
87: TypePointer Input 7(fvec4)
88(input): 87(ptr) Variable Input
93(c4): 22(ptr) Variable Private
94(b5): 22(ptr) Variable Private
4(ShaderFunction): 2 Function None 3
5: Label
33(a2): 32(ptr) Variable Function
39(s2i): 38(ptr) Variable Function
48(s2): 38(ptr) Variable Function
54(a8): 53(ptr) Variable Function
57(a9): 53(ptr) Variable Function
62(a2): 61(ptr) Variable Function
67(s2i): 66(ptr) Variable Function
76(s2): 66(ptr) Variable Function
82(a8): 81(ptr) Variable Function
85(a9): 81(ptr) Variable Function
Store 9(a1) 13
Store 14(b1) 19
Store 20(a1i) 13
@ -347,23 +439,27 @@ gl_FragCoord origin is upper left
Store 27(b4) 28
Store 29(a5) 11
Store 30(c5) 31
Store 33(a2) 34
41: 6(float) Load 29(a5)
44: 6(float) Load 43(a4)
46: 36(S1) CompositeConstruct 44 45
47: 37(S2) CompositeConstruct 40 41 46
Store 39(s2i) 47
49: 6(float) Load 29(a5)
50: 6(float) Load 43(a4)
51: 36(S1) CompositeConstruct 50 45
52: 37(S2) CompositeConstruct 40 49 51
Store 48(s2) 52
56: 6(float) Load 55(b2)
Store 54(a8) 56
58: 6(float) Load 29(a5)
Store 57(a9) 58
61: 7(fvec4) Load 60(input)
62: 7(fvec4) Load 9(a1)
63: 7(fvec4) FMul 61 62
ReturnValue 63
Store 35(single1) 37
Store 42(single2) 46
Store 49(single3) 52
Store 55(single4) 60
Store 62(a2) 63
69: 6(float) Load 29(a5)
72: 6(float) Load 71(a4)
74: 64(S1) CompositeConstruct 72 73
75: 65(S2) CompositeConstruct 68 69 74
Store 67(s2i) 75
77: 6(float) Load 29(a5)
78: 6(float) Load 71(a4)
79: 64(S1) CompositeConstruct 78 73
80: 65(S2) CompositeConstruct 68 77 79
Store 76(s2) 80
84: 6(float) Load 83(b2)
Store 82(a8) 84
86: 6(float) Load 29(a5)
Store 85(a9) 86
89: 7(fvec4) Load 88(input)
90: 7(fvec4) Load 9(a1)
91: 7(fvec4) FMul 89 90
ReturnValue 91
FunctionEnd

View File

@ -4,6 +4,18 @@ float a2 = 0.2, b2;
float a3, b3 = 0.3;
float a4, b4 = 0.4, c4;
float a5 = 0.5, b5, c5 = 1.5;
struct Single1 { int f; };
Single1 single1 = { 10 };
struct Single2 { uint2 v; };
Single2 single2 = { { 1, 2 } };
struct Single3 { Single1 s1; };
Single3 single3 = { { 3 } };
struct Single4 { Single2 s1; };
Single4 single4 = { { { 4u, 5u } } };
float4 ShaderFunction(float4 input) : COLOR0
{

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.1365"
#define GLSLANG_REVISION "SPIRV99.1367"
#define GLSLANG_DATE "29-Jul-2016"

View File

@ -5145,8 +5145,14 @@ TIntermTyped* TParseContext::convertInitializerList(const TSourceLoc& loc, const
return nullptr;
}
// now that the subtree is processed, process this node
return addConstructor(loc, initList, type);
// Now that the subtree is processed, process this node as if the
// initializer list is a set of arguments to a constructor.
TIntermNode* emulatedConstructorArguments;
if (initList->getSequence().size() == 1)
emulatedConstructorArguments = initList->getSequence()[0];
else
emulatedConstructorArguments = initList;
return addConstructor(loc, emulatedConstructorArguments, type);
}
//

View File

@ -3725,8 +3725,14 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
return nullptr;
}
// now that the subtree is processed, process this node
return addConstructor(loc, initList, type);
// Now that the subtree is processed, process this node as if the
// initializer list is a set of arguments to a constructor.
TIntermNode* emulatedConstructorArguments;
if (initList->getSequence().size() == 1)
emulatedConstructorArguments = initList->getSequence()[0];
else
emulatedConstructorArguments = initList;
return addConstructor(loc, emulatedConstructorArguments, type);
}
//