HLSL: struct splitting: assignments of hierarchical split types

This commit adds support for copying nested hierarchical types of split
types.  E.g, a struct of a struct containing both user and builtin interstage
IO variables.

When copying split types, if any subtree does NOT contain builtin interstage
IO, we can copy the whole subtree with one assignment, which saves a bunch
of AST verbosity for memberwise copies of that subtree.
This commit is contained in:
steve-lunarg
2016-12-19 15:48:01 -07:00
parent a2e7531057
commit 132d331870
19 changed files with 1113 additions and 234 deletions

View File

@@ -28,36 +28,15 @@ Shader version: 450
0:11 'e' (layout(location=5 ) in 4-component vector of float)
0:13 Sequence
0:13 Sequence
0:13 move second child to first child (temp 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child (temp 2-element array of 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child (temp 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 move second child to first child (temp 2-component vector of uint)
0:13 coord: direct index for structure (temp 2-component vector of uint)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
@@ -68,7 +47,7 @@ Shader version: 450
0:13 Constant:
0:13 1 (const int)
0:13 move second child to first child (temp 4-component vector of float)
0:13 b: direct index for structure (temp 4-component vector of float)
0:13 b: direct index for structure (smooth temp 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 2 (const int)
@@ -121,36 +100,15 @@ Shader version: 450
0:11 'e' (layout(location=5 ) in 4-component vector of float)
0:13 Sequence
0:13 Sequence
0:13 move second child to first child (temp 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child (temp 2-element array of 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 move second child to first child (temp 4-component vector of float)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 direct index (temp 4-component vector of float)
0:13 m: direct index for structure (temp 2-element array of 4-component vector of float)
0:13 'local' (temp structure{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, temp 4-component vector of float b})
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 move second child to first child (temp 2-component vector of uint)
0:13 coord: direct index for structure (temp 2-component vector of uint)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
@@ -161,7 +119,7 @@ Shader version: 450
0:13 Constant:
0:13 1 (const int)
0:13 move second child to first child (temp 4-component vector of float)
0:13 b: direct index for structure (temp 4-component vector of float)
0:13 b: direct index for structure (smooth temp 4-component vector of float)
0:13 '@entryPointOutput' (out structure Position{temp 2-element array of 4-component vector of float m, temp 2-component vector of uint coord, smooth temp 4-component vector of float b})
0:13 Constant:
0:13 2 (const int)
@@ -183,12 +141,12 @@ Shader version: 450
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 62
// Id's are bound by 61
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 18 20 24 32 35 42 61
EntryPoint Vertex 4 "main" 18 20 24 32 35 42 60
Name 4 "main"
Name 12 "VI"
MemberName 12(VI) 0 "m"
@@ -205,14 +163,14 @@ Shader version: 450
MemberName 40(VI) 1 "coord"
MemberName 40(VI) 2 "b"
Name 42 "@entryPointOutput"
Name 61 "b"
Name 60 "b"
Decorate 18(m[1]) Location 2
Decorate 20(m[0]) Location 1
Decorate 24(coord) Location 3
Decorate 32(d) Location 0
Decorate 35(e) Location 5
Decorate 42(@entryPointOutput) BuiltIn Position
Decorate 61(b) Location 4
Decorate 60(b) Location 4
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -239,11 +197,13 @@ Shader version: 450
41: TypePointer Output 40(VI)
42(@entryPointOutput): 41(ptr) Variable Output
43: 15(int) Constant 0
46: TypePointer Output 7(fvec4)
48: 15(int) Constant 1
52: TypePointer Function 11(ivec2)
55: TypePointer Output 11(ivec2)
61(b): 17(ptr) Variable Input
44: TypePointer Function 10
47: TypePointer Output 10
49: 15(int) Constant 1
50: TypePointer Function 11(ivec2)
53: TypePointer Output 11(ivec2)
57: TypePointer Output 7(fvec4)
60(b): 17(ptr) Variable Input
4(main): 2 Function None 3
5: Label
14(local): 13(ptr) Variable Function
@@ -261,21 +221,17 @@ Shader version: 450
37: 7(fvec4) FAdd 34 36
39: 38(ptr) AccessChain 14(local) 16
Store 39 37
44: 38(ptr) AccessChain 14(local) 43 43
45: 7(fvec4) Load 44
47: 46(ptr) AccessChain 42(@entryPointOutput) 43 43
Store 47 45
49: 38(ptr) AccessChain 14(local) 43 48
50: 7(fvec4) Load 49
51: 46(ptr) AccessChain 42(@entryPointOutput) 43 48
Store 51 50
53: 52(ptr) AccessChain 14(local) 48
54: 11(ivec2) Load 53
56: 55(ptr) AccessChain 42(@entryPointOutput) 48
Store 56 54
57: 38(ptr) AccessChain 14(local) 16
58: 7(fvec4) Load 57
59: 46(ptr) AccessChain 42(@entryPointOutput) 16
Store 59 58
45: 44(ptr) AccessChain 14(local) 43
46: 10 Load 45
48: 47(ptr) AccessChain 42(@entryPointOutput) 43
Store 48 46
51: 50(ptr) AccessChain 14(local) 49
52: 11(ivec2) Load 51
54: 53(ptr) AccessChain 42(@entryPointOutput) 49
Store 54 52
55: 38(ptr) AccessChain 14(local) 16
56: 7(fvec4) Load 55
58: 57(ptr) AccessChain 42(@entryPointOutput) 16
Store 58 56
Return
FunctionEnd