This PR implements recursive type flattening. For example, an array of structs of other structs can be flattened to individual member variables at the shader interface. This is sufficient for many purposes, e.g, uniforms containing opaque types, but is not sufficient for geometry shader arrayed inputs. That will be handled separately with structure splitting, which is not implemented by this PR. In the meantime, that case is detected and triggers an error. The recursive flattening extends the following three aspects of single-level flattening: - Flattening of structures to individual members with names such as "foo[0].samp[1]"; - Turning constant references to the nested composite type into a reference to a particular flattened member. - Shadow copies between arrays of flattened members and the nested composite type. Previous single-level flattening only flattened at the shader interface, and that is unchanged by this PR. Internally, shadow copies are, such as if the type is passed to a function. Also, the reasons for flattening are unchanged. Uniforms containing opaque types, and interface struct types are flattened. (The latter will change with structure splitting). One existing test changes: hlsl.structin.vert, which did in fact contain a nested composite type to be flattened. Two new tests are added: hlsl.structarray.flatten.frag, and hlsl.structarray.flatten.geom (currently issues an error until type splitting is online). The process of arriving at the individual member from chained postfix expressions is more complex than it was with one level. See large-ish comment above HlslParseContext::flatten() for details.
101 lines
6.5 KiB
Plaintext
101 lines
6.5 KiB
Plaintext
hlsl.structarray.flatten.geom
|
|
ERROR: 0:10: 'vin' : recursive type not yet supported in GS input
|
|
ERROR: 1 compilation errors. No code generated.
|
|
|
|
|
|
Shader version: 450
|
|
invocations = -1
|
|
max_vertices = 4
|
|
input primitive = lines
|
|
output primitive = triangle_strip
|
|
ERROR: node is still EOpNull!
|
|
0:10 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-VertexData-vf4-vf4-vf21; (temp void)
|
|
0:10 Function Parameters:
|
|
0:10 'vin' (in 2-element array of structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:10 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:? Sequence
|
|
0:13 move second child to first child (temp 4-component vector of float)
|
|
0:13 color: direct index for structure (temp 4-component vector of float)
|
|
0:13 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:13 Constant:
|
|
0:13 1 (const int)
|
|
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
|
|
0:14 move second child to first child (temp 2-component vector of float)
|
|
0:14 uv: direct index for structure (temp 2-component vector of float)
|
|
0:14 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:14 Constant:
|
|
0:14 2 (const int)
|
|
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
|
|
0:15 move second child to first child (temp 4-component vector of float)
|
|
0:15 position: direct index for structure (temp 4-component vector of float)
|
|
0:15 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:15 Constant:
|
|
0:15 0 (const int)
|
|
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
|
|
0:16 Sequence
|
|
0:16 move second child to first child (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:16 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:16 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:16 EmitVertex (temp void)
|
|
0:? Linker Objects
|
|
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
|
|
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
|
|
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
|
|
0:? 'vin[1].position' (layout(location=3 ) in 4-component vector of float)
|
|
0:? 'vin[1].color' (layout(location=4 ) in 4-component vector of float)
|
|
0:? 'vin[1].uv' (layout(location=5 ) in 2-component vector of float)
|
|
0:? 'position' (layout(location=0 ) out 4-component vector of float)
|
|
0:? 'color' (layout(location=1 ) out 4-component vector of float)
|
|
0:? 'uv' (layout(location=2 ) out 2-component vector of float)
|
|
|
|
|
|
Linked geometry stage:
|
|
|
|
|
|
Shader version: 450
|
|
invocations = 1
|
|
max_vertices = 4
|
|
input primitive = lines
|
|
output primitive = triangle_strip
|
|
ERROR: node is still EOpNull!
|
|
0:10 Function Definition: main(struct-VertexData-vf4-vf4-vf21[2];struct-VertexData-vf4-vf4-vf21; (temp void)
|
|
0:10 Function Parameters:
|
|
0:10 'vin' (in 2-element array of structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:10 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:? Sequence
|
|
0:13 move second child to first child (temp 4-component vector of float)
|
|
0:13 color: direct index for structure (temp 4-component vector of float)
|
|
0:13 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:13 Constant:
|
|
0:13 1 (const int)
|
|
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
|
|
0:14 move second child to first child (temp 2-component vector of float)
|
|
0:14 uv: direct index for structure (temp 2-component vector of float)
|
|
0:14 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:14 Constant:
|
|
0:14 2 (const int)
|
|
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
|
|
0:15 move second child to first child (temp 4-component vector of float)
|
|
0:15 position: direct index for structure (temp 4-component vector of float)
|
|
0:15 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:15 Constant:
|
|
0:15 0 (const int)
|
|
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
|
|
0:16 Sequence
|
|
0:16 move second child to first child (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:16 'outStream' (out structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:16 'vout' (temp structure{temp 4-component vector of float position, temp 4-component vector of float color, temp 2-component vector of float uv})
|
|
0:16 EmitVertex (temp void)
|
|
0:? Linker Objects
|
|
0:? 'vin[0].position' (layout(location=0 ) in 4-component vector of float)
|
|
0:? 'vin[0].color' (layout(location=1 ) in 4-component vector of float)
|
|
0:? 'vin[0].uv' (layout(location=2 ) in 2-component vector of float)
|
|
0:? 'vin[1].position' (layout(location=3 ) in 4-component vector of float)
|
|
0:? 'vin[1].color' (layout(location=4 ) in 4-component vector of float)
|
|
0:? 'vin[1].uv' (layout(location=5 ) in 2-component vector of float)
|
|
0:? 'position' (layout(location=0 ) out 4-component vector of float)
|
|
0:? 'color' (layout(location=1 ) out 4-component vector of float)
|
|
0:? 'uv' (layout(location=2 ) out 2-component vector of float)
|
|
|
|
SPIR-V is not generated for failed compile or link
|