HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.

This needs some render testing, but is destined to be part of master.

This also leads to a variety of other simplifications.
 - IO are global symbols, so only need one list of linkage nodes (deferred)
 - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
 - several parts of splitting/flattening are now localized
This commit is contained in:
John Kessenich
2017-01-19 15:41:47 -07:00
parent 18adbdbbb8
commit 02467d8d94
171 changed files with 37604 additions and 32679 deletions

View File

@@ -10,20 +10,27 @@ Shader version: 450
0:5 'Position' (layout(rgba32f ) uniform samplerBuffer)
0:5 Convert uint to int (temp int)
0:5 'Index' (in uint)
0:9 Function Definition: RealEntrypoint(u1; (temp 4-component vector of float Position)
0:9 Function Definition: @RealEntrypoint(u1; (temp 4-component vector of float Position)
0:9 Function Parameters:
0:9 'Index' (in uint VertexIndex)
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float Position)
0:10 Function Call: FakeEntrypoint(u1; (temp 4-component vector of float)
0:10 'Index' (in uint VertexIndex)
0:10 Branch: Return
0:10 Branch: Return with expression
0:10 Function Call: FakeEntrypoint(u1; (temp 4-component vector of float)
0:10 'Index' (in uint VertexIndex)
0:9 Function Definition: RealEntrypoint( (temp void)
0:9 Function Parameters:
0:? Sequence
0:9 move second child to first child (temp uint)
0:? 'Index' (temp uint)
0:? 'Index' (in uint VertexIndex)
0:9 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float Position)
0:9 Function Call: @RealEntrypoint(u1; (temp 4-component vector of float Position)
0:? 'Index' (temp uint)
0:? Linker Objects
0:? 'Position' (layout(rgba32f ) uniform samplerBuffer)
0:? '@entryPointOutput' (out 4-component vector of float Position)
0:? 'Index' (in uint VertexIndex)
0:? 'Position' (layout(rgba32f ) uniform samplerBuffer)
Linked vertex stage:
@@ -40,40 +47,51 @@ Shader version: 450
0:5 'Position' (layout(rgba32f ) uniform samplerBuffer)
0:5 Convert uint to int (temp int)
0:5 'Index' (in uint)
0:9 Function Definition: RealEntrypoint(u1; (temp 4-component vector of float Position)
0:9 Function Definition: @RealEntrypoint(u1; (temp 4-component vector of float Position)
0:9 Function Parameters:
0:9 'Index' (in uint VertexIndex)
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float Position)
0:10 Function Call: FakeEntrypoint(u1; (temp 4-component vector of float)
0:10 'Index' (in uint VertexIndex)
0:10 Branch: Return
0:10 Branch: Return with expression
0:10 Function Call: FakeEntrypoint(u1; (temp 4-component vector of float)
0:10 'Index' (in uint VertexIndex)
0:9 Function Definition: RealEntrypoint( (temp void)
0:9 Function Parameters:
0:? Sequence
0:9 move second child to first child (temp uint)
0:? 'Index' (temp uint)
0:? 'Index' (in uint VertexIndex)
0:9 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float Position)
0:9 Function Call: @RealEntrypoint(u1; (temp 4-component vector of float Position)
0:? 'Index' (temp uint)
0:? Linker Objects
0:? 'Position' (layout(rgba32f ) uniform samplerBuffer)
0:? '@entryPointOutput' (out 4-component vector of float Position)
0:? 'Index' (in uint VertexIndex)
0:? 'Position' (layout(rgba32f ) uniform samplerBuffer)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 34
// Id's are bound by 43
Capability Shader
Capability SampledBuffer
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "RealEntrypoint" 27 29
EntryPoint Vertex 4 "RealEntrypoint" 36 39
Name 4 "RealEntrypoint"
Name 12 "FakeEntrypoint(u1;"
Name 11 "Index"
Name 17 "Position"
Name 27 "@entryPointOutput"
Name 29 "Index"
Name 30 "param"
Decorate 17(Position) DescriptorSet 0
Decorate 27(@entryPointOutput) BuiltIn Position
Decorate 29(Index) BuiltIn VertexIndex
Name 15 "@RealEntrypoint(u1;"
Name 14 "Index"
Name 20 "Position"
Name 29 "param"
Name 34 "Index"
Name 36 "Index"
Name 39 "@entryPointOutput"
Name 40 "param"
Decorate 20(Position) DescriptorSet 0
Decorate 36(Index) BuiltIn VertexIndex
Decorate 39(@entryPointOutput) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@@ -81,31 +99,43 @@ Shader version: 450
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeImage 8(float) Buffer sampled format:Rgba32f
15: TypeSampledImage 14
16: TypePointer UniformConstant 15
17(Position): 16(ptr) Variable UniformConstant
20: TypeInt 32 1
26: TypePointer Output 9(fvec4)
27(@entryPointOutput): 26(ptr) Variable Output
28: TypePointer Input 6(int)
29(Index): 28(ptr) Variable Input
17: TypeImage 8(float) Buffer sampled format:Rgba32f
18: TypeSampledImage 17
19: TypePointer UniformConstant 18
20(Position): 19(ptr) Variable UniformConstant
23: TypeInt 32 1
35: TypePointer Input 6(int)
36(Index): 35(ptr) Variable Input
38: TypePointer Output 9(fvec4)
39(@entryPointOutput): 38(ptr) Variable Output
4(RealEntrypoint): 2 Function None 3
5: Label
30(param): 7(ptr) Variable Function
31: 6(int) Load 29(Index)
Store 30(param) 31
32: 9(fvec4) FunctionCall 12(FakeEntrypoint(u1;) 30(param)
Store 27(@entryPointOutput) 32
34(Index): 7(ptr) Variable Function
40(param): 7(ptr) Variable Function
37: 6(int) Load 36(Index)
Store 34(Index) 37
41: 6(int) Load 34(Index)
Store 40(param) 41
42: 9(fvec4) FunctionCall 15(@RealEntrypoint(u1;) 40(param)
Store 39(@entryPointOutput) 42
Return
FunctionEnd
12(FakeEntrypoint(u1;): 9(fvec4) Function None 10
11(Index): 7(ptr) FunctionParameter
13: Label
18: 15 Load 17(Position)
19: 6(int) Load 11(Index)
21: 20(int) Bitcast 19
22: 14 Image 18
23: 9(fvec4) ImageFetch 22 21
ReturnValue 23
21: 18 Load 20(Position)
22: 6(int) Load 11(Index)
24: 23(int) Bitcast 22
25: 17 Image 21
26: 9(fvec4) ImageFetch 25 24
ReturnValue 26
FunctionEnd
15(@RealEntrypoint(u1;): 9(fvec4) Function None 10
14(Index): 7(ptr) FunctionParameter
16: Label
29(param): 7(ptr) Variable Function
30: 6(int) Load 14(Index)
Store 29(param) 30
31: 9(fvec4) FunctionCall 12(FakeEntrypoint(u1;) 29(param)
ReturnValue 31
FunctionEnd