HLSL: Flatten more I/O: non-arrayed user-only structures.

The goal is to flatten all I/O, but there are multiple categories and
steps to complete, likely including a final unification of splitting
and flattening.
This commit is contained in:
John Kessenich
2017-08-04 12:04:44 -06:00
parent cca42a8ea6
commit b6be80f44e
12 changed files with 693 additions and 374 deletions

View File

@@ -42,14 +42,34 @@ output primitive = line_strip
0:20 Constant:
0:20 0 (const int)
0:22 Sequence
0:22 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:22 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 Sequence
0:22 move second child to first child ( temp float)
0:? 'myfloat' (layout( location=0) out float)
0:22 myfloat: direct index for structure ( temp float)
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 Constant:
0:22 0 (const int)
0:22 move second child to first child ( temp int)
0:? 'something' (layout( location=1) out int)
0:22 something: direct index for structure ( temp int)
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 Constant:
0:22 1 (const int)
0:22 EmitVertex ( temp void)
0:23 Sequence
0:23 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:23 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 Sequence
0:23 move second child to first child ( temp float)
0:? 'myfloat' (layout( location=0) out float)
0:23 myfloat: direct index for structure ( temp float)
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 Constant:
0:23 0 (const int)
0:23 move second child to first child ( temp int)
0:? 'something' (layout( location=1) out int)
0:23 something: direct index for structure ( temp int)
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 Constant:
0:23 1 (const int)
0:23 EmitVertex ( temp void)
0:24 EndPrimitive ( temp void)
0:16 Function Definition: main( ( temp void)
@@ -68,7 +88,8 @@ output primitive = line_strip
0:? Linker Objects
0:? 'VertexID' (layout( location=0) in 3-element array of uint)
0:? 'test' (layout( location=1) in 3-element array of uint)
0:? 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:? 'myfloat' (layout( location=0) out float)
0:? 'something' (layout( location=1) out int)
Linked geometry stage:
@@ -117,14 +138,34 @@ output primitive = line_strip
0:20 Constant:
0:20 0 (const int)
0:22 Sequence
0:22 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:22 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 Sequence
0:22 move second child to first child ( temp float)
0:? 'myfloat' (layout( location=0) out float)
0:22 myfloat: direct index for structure ( temp float)
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 Constant:
0:22 0 (const int)
0:22 move second child to first child ( temp int)
0:? 'something' (layout( location=1) out int)
0:22 something: direct index for structure ( temp int)
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 Constant:
0:22 1 (const int)
0:22 EmitVertex ( temp void)
0:23 Sequence
0:23 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:23 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 Sequence
0:23 move second child to first child ( temp float)
0:? 'myfloat' (layout( location=0) out float)
0:23 myfloat: direct index for structure ( temp float)
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 Constant:
0:23 0 (const int)
0:23 move second child to first child ( temp int)
0:? 'something' (layout( location=1) out int)
0:23 something: direct index for structure ( temp int)
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 Constant:
0:23 1 (const int)
0:23 EmitVertex ( temp void)
0:24 EndPrimitive ( temp void)
0:16 Function Definition: main( ( temp void)
@@ -143,16 +184,17 @@ output primitive = line_strip
0:? Linker Objects
0:? 'VertexID' (layout( location=0) in 3-element array of uint)
0:? 'test' (layout( location=1) in 3-element array of uint)
0:? 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:? 'myfloat' (layout( location=0) out float)
0:? 'something' (layout( location=1) out int)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 60
// Id's are bound by 68
Capability Geometry
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 42 47 50
EntryPoint Geometry 4 "main" 42 46 55 58
ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputLineStrip
@@ -167,18 +209,20 @@ output primitive = line_strip
Name 16 "test"
Name 17 "OutputStream"
Name 20 "Vert"
Name 42 "OutputStream"
Name 45 "VertexID"
Name 47 "VertexID"
Name 49 "test"
Name 50 "test"
Name 52 "OutputStream"
Name 53 "param"
Name 55 "param"
Name 57 "param"
Decorate 42(OutputStream) Location 0
Decorate 47(VertexID) Location 0
Decorate 50(test) Location 1
Name 42 "myfloat"
Name 46 "something"
Name 53 "VertexID"
Name 55 "VertexID"
Name 57 "test"
Name 58 "test"
Name 60 "OutputStream"
Name 61 "param"
Name 63 "param"
Name 65 "param"
Decorate 42(myfloat) Location 0
Decorate 46(something) Location 1
Decorate 55(VertexID) Location 0
Decorate 58(test) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@@ -196,30 +240,32 @@ output primitive = line_strip
29: 11(int) Constant 2
34: TypePointer Function 10(float)
39: TypePointer Function 11(int)
41: TypePointer Output 12(PSInput)
42(OutputStream): 41(ptr) Variable Output
46: TypePointer Input 8
47(VertexID): 46(ptr) Variable Input
50(test): 46(ptr) Variable Input
41: TypePointer Output 10(float)
42(myfloat): 41(ptr) Variable Output
45: TypePointer Output 11(int)
46(something): 45(ptr) Variable Output
54: TypePointer Input 8
55(VertexID): 54(ptr) Variable Input
58(test): 54(ptr) Variable Input
4(main): 2 Function None 3
5: Label
45(VertexID): 9(ptr) Variable Function
49(test): 9(ptr) Variable Function
52(OutputStream): 13(ptr) Variable Function
53(param): 9(ptr) Variable Function
55(param): 9(ptr) Variable Function
57(param): 13(ptr) Variable Function
48: 8 Load 47(VertexID)
Store 45(VertexID) 48
51: 8 Load 50(test)
Store 49(test) 51
54: 8 Load 45(VertexID)
Store 53(param) 54
56: 8 Load 49(test)
Store 55(param) 56
58: 2 FunctionCall 18(@main(u1[3];u1[3];struct-PSInput-f1-i11;) 53(param) 55(param) 57(param)
59: 12(PSInput) Load 57(param)
Store 52(OutputStream) 59
53(VertexID): 9(ptr) Variable Function
57(test): 9(ptr) Variable Function
60(OutputStream): 13(ptr) Variable Function
61(param): 9(ptr) Variable Function
63(param): 9(ptr) Variable Function
65(param): 13(ptr) Variable Function
56: 8 Load 55(VertexID)
Store 53(VertexID) 56
59: 8 Load 58(test)
Store 57(test) 59
62: 8 Load 53(VertexID)
Store 61(param) 62
64: 8 Load 57(test)
Store 63(param) 64
66: 2 FunctionCall 18(@main(u1[3];u1[3];struct-PSInput-f1-i11;) 61(param) 63(param) 65(param)
67: 12(PSInput) Load 65(param)
Store 60(OutputStream) 67
Return
FunctionEnd
18(@main(u1[3];u1[3];struct-PSInput-f1-i11;): 2 Function None 14
@@ -244,11 +290,19 @@ output primitive = line_strip
38: 11(int) Bitcast 37
40: 39(ptr) AccessChain 20(Vert) 25
Store 40 38
43: 12(PSInput) Load 20(Vert)
Store 42(OutputStream) 43
43: 34(ptr) AccessChain 20(Vert) 21
44: 10(float) Load 43
Store 42(myfloat) 44
47: 39(ptr) AccessChain 20(Vert) 25
48: 11(int) Load 47
Store 46(something) 48
EmitVertex
44: 12(PSInput) Load 20(Vert)
Store 42(OutputStream) 44
49: 34(ptr) AccessChain 20(Vert) 21
50: 10(float) Load 49
Store 42(myfloat) 50
51: 39(ptr) AccessChain 20(Vert) 25
52: 11(int) Load 51
Store 46(something) 52
EmitVertex
EndPrimitive
Return