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

@ -2,31 +2,34 @@ hlsl.intrinsics.d3dcolortoubyte4.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: main( (temp 4-component vector of int)
0:5 Function Definition: @main( (temp 4-component vector of int)
0:5 Function Parameters:
0:? Sequence
0:6 Sequence
0:6 move second child to first child (temp 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:6 Convert float to int (temp 4-component vector of int)
0:6 vector-scale (temp 4-component vector of float)
0:6 Constant:
0:6 255.001953
0:6 vector swizzle (temp 4-component vector of float)
0:6 col4: direct index for structure (layout(offset=0 ) uniform 4-component vector of float)
0:6 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
0:6 Constant:
0:6 0 (const uint)
0:6 Sequence
0:6 Constant:
0:6 2 (const int)
0:6 Constant:
0:6 1 (const int)
0:6 Constant:
0:6 0 (const int)
0:6 Constant:
0:6 3 (const int)
0:6 Branch: Return
0:6 Branch: Return with expression
0:6 Convert float to int (temp 4-component vector of int)
0:6 vector-scale (temp 4-component vector of float)
0:6 Constant:
0:6 255.001953
0:6 vector swizzle (temp 4-component vector of float)
0:6 col4: direct index for structure (layout(offset=0 ) uniform 4-component vector of float)
0:6 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
0:6 Constant:
0:6 0 (const uint)
0:6 Sequence
0:6 Constant:
0:6 2 (const int)
0:6 Constant:
0:6 1 (const int)
0:6 Constant:
0:6 0 (const int)
0:6 Constant:
0:6 3 (const int)
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 move second child to first child (temp 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:5 Function Call: @main( (temp 4-component vector of int)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
@ -38,74 +41,84 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: main( (temp 4-component vector of int)
0:5 Function Definition: @main( (temp 4-component vector of int)
0:5 Function Parameters:
0:? Sequence
0:6 Sequence
0:6 move second child to first child (temp 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:6 Convert float to int (temp 4-component vector of int)
0:6 vector-scale (temp 4-component vector of float)
0:6 Constant:
0:6 255.001953
0:6 vector swizzle (temp 4-component vector of float)
0:6 col4: direct index for structure (layout(offset=0 ) uniform 4-component vector of float)
0:6 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
0:6 Constant:
0:6 0 (const uint)
0:6 Sequence
0:6 Constant:
0:6 2 (const int)
0:6 Constant:
0:6 1 (const int)
0:6 Constant:
0:6 0 (const int)
0:6 Constant:
0:6 3 (const int)
0:6 Branch: Return
0:6 Branch: Return with expression
0:6 Convert float to int (temp 4-component vector of int)
0:6 vector-scale (temp 4-component vector of float)
0:6 Constant:
0:6 255.001953
0:6 vector swizzle (temp 4-component vector of float)
0:6 col4: direct index for structure (layout(offset=0 ) uniform 4-component vector of float)
0:6 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
0:6 Constant:
0:6 0 (const uint)
0:6 Sequence
0:6 Constant:
0:6 2 (const int)
0:6 Constant:
0:6 1 (const int)
0:6 Constant:
0:6 0 (const int)
0:6 Constant:
0:6 3 (const int)
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 move second child to first child (temp 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:5 Function Call: @main( (temp 4-component vector of int)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of int)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of float col4})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 24
// Id's are bound by 29
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
EntryPoint Fragment 4 "main" 27
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "@entryPointOutput"
Name 13 "$Global"
MemberName 13($Global) 0 "col4"
Name 15 ""
Decorate 9(@entryPointOutput) Location 0
MemberDecorate 13($Global) 0 Offset 0
Decorate 13($Global) Block
Decorate 15 DescriptorSet 0
Name 9 "@main("
Name 14 "$Global"
MemberName 14($Global) 0 "col4"
Name 16 ""
Name 27 "@entryPointOutput"
MemberDecorate 14($Global) 0 Offset 0
Decorate 14($Global) Block
Decorate 16 DescriptorSet 0
Decorate 27(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeVector 6(int) 4
8: TypePointer Output 7(ivec4)
9(@entryPointOutput): 8(ptr) Variable Output
10: TypeFloat 32
11: 10(float) Constant 1132396672
12: TypeVector 10(float) 4
13($Global): TypeStruct 12(fvec4)
14: TypePointer Uniform 13($Global)
15: 14(ptr) Variable Uniform
16: 6(int) Constant 0
17: TypePointer Uniform 12(fvec4)
8: TypeFunction 7(ivec4)
11: TypeFloat 32
12: 11(float) Constant 1132396672
13: TypeVector 11(float) 4
14($Global): TypeStruct 13(fvec4)
15: TypePointer Uniform 14($Global)
16: 15(ptr) Variable Uniform
17: 6(int) Constant 0
18: TypePointer Uniform 13(fvec4)
26: TypePointer Output 7(ivec4)
27(@entryPointOutput): 26(ptr) Variable Output
4(main): 2 Function None 3
5: Label
18: 17(ptr) AccessChain 15 16
19: 12(fvec4) Load 18
20: 12(fvec4) VectorShuffle 19 19 2 1 0 3
21: 12(fvec4) VectorTimesScalar 20 11
22: 7(ivec4) ConvertFToS 21
Store 9(@entryPointOutput) 22
28: 7(ivec4) FunctionCall 9(@main()
Store 27(@entryPointOutput) 28
Return
FunctionEnd
9(@main(): 7(ivec4) Function None 8
10: Label
19: 18(ptr) AccessChain 16 17
20: 13(fvec4) Load 19
21: 13(fvec4) VectorShuffle 20 20 2 1 0 3
22: 13(fvec4) VectorTimesScalar 21 12
23: 7(ivec4) ConvertFToS 22
ReturnValue 23
FunctionEnd