HLSL: implement [unroll] and [loop] attributes
This adds infrastructure suitable for any front end to create SPIR-V loop control flags. The only current front end doing so is HLSL. [unroll] turns into spv::LoopControlUnrollMask [loop] turns into spv::LoopControlDontUnrollMask no specification means spv::LoopControlMaskNone
This commit is contained in:
233
Test/baseResults/hlsl.loopattr.frag.out
Normal file
233
Test/baseResults/hlsl.loopattr.frag.out
Normal file
@@ -0,0 +1,233 @@
|
||||
hlsl.loopattr.frag
|
||||
Shader version: 500
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:3 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:3 Function Parameters:
|
||||
0:? Sequence
|
||||
0:5 Sequence
|
||||
0:5 move second child to first child ( temp int)
|
||||
0:5 'x' ( temp int)
|
||||
0:5 Constant:
|
||||
0:5 0 (const int)
|
||||
0:5 Loop with condition tested first
|
||||
0:5 Loop Condition
|
||||
0:5 Compare Less Than ( temp bool)
|
||||
0:5 'x' ( temp int)
|
||||
0:5 Constant:
|
||||
0:5 5 (const int)
|
||||
0:5 No loop body
|
||||
0:5 Loop Terminal Expression
|
||||
0:5 Pre-Increment ( temp int)
|
||||
0:5 'x' ( temp int)
|
||||
0:8 Sequence
|
||||
0:8 move second child to first child ( temp int)
|
||||
0:8 'y' ( temp int)
|
||||
0:8 Constant:
|
||||
0:8 0 (const int)
|
||||
0:8 Loop with condition tested first
|
||||
0:8 Loop Condition
|
||||
0:8 Compare Less Than ( temp bool)
|
||||
0:8 'y' ( temp int)
|
||||
0:8 Constant:
|
||||
0:8 5 (const int)
|
||||
0:8 No loop body
|
||||
0:8 Loop Terminal Expression
|
||||
0:8 Pre-Increment ( temp int)
|
||||
0:8 'y' ( temp int)
|
||||
0:11 Sequence
|
||||
0:11 move second child to first child ( temp int)
|
||||
0:11 'z' ( temp int)
|
||||
0:11 Constant:
|
||||
0:11 0 (const int)
|
||||
0:11 Loop with condition tested first
|
||||
0:11 Loop Condition
|
||||
0:11 Compare Less Than ( temp bool)
|
||||
0:11 'z' ( temp int)
|
||||
0:11 Constant:
|
||||
0:11 5 (const int)
|
||||
0:11 No loop body
|
||||
0:11 Loop Terminal Expression
|
||||
0:11 Pre-Increment ( temp int)
|
||||
0:11 'z' ( temp int)
|
||||
0:13 Branch: Return with expression
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:3 Function Definition: main( ( temp void)
|
||||
0:3 Function Parameters:
|
||||
0:? Sequence
|
||||
0:3 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:3 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 500
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:3 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:3 Function Parameters:
|
||||
0:? Sequence
|
||||
0:5 Sequence
|
||||
0:5 move second child to first child ( temp int)
|
||||
0:5 'x' ( temp int)
|
||||
0:5 Constant:
|
||||
0:5 0 (const int)
|
||||
0:5 Loop with condition tested first
|
||||
0:5 Loop Condition
|
||||
0:5 Compare Less Than ( temp bool)
|
||||
0:5 'x' ( temp int)
|
||||
0:5 Constant:
|
||||
0:5 5 (const int)
|
||||
0:5 No loop body
|
||||
0:5 Loop Terminal Expression
|
||||
0:5 Pre-Increment ( temp int)
|
||||
0:5 'x' ( temp int)
|
||||
0:8 Sequence
|
||||
0:8 move second child to first child ( temp int)
|
||||
0:8 'y' ( temp int)
|
||||
0:8 Constant:
|
||||
0:8 0 (const int)
|
||||
0:8 Loop with condition tested first
|
||||
0:8 Loop Condition
|
||||
0:8 Compare Less Than ( temp bool)
|
||||
0:8 'y' ( temp int)
|
||||
0:8 Constant:
|
||||
0:8 5 (const int)
|
||||
0:8 No loop body
|
||||
0:8 Loop Terminal Expression
|
||||
0:8 Pre-Increment ( temp int)
|
||||
0:8 'y' ( temp int)
|
||||
0:11 Sequence
|
||||
0:11 move second child to first child ( temp int)
|
||||
0:11 'z' ( temp int)
|
||||
0:11 Constant:
|
||||
0:11 0 (const int)
|
||||
0:11 Loop with condition tested first
|
||||
0:11 Loop Condition
|
||||
0:11 Compare Less Than ( temp bool)
|
||||
0:11 'z' ( temp int)
|
||||
0:11 Constant:
|
||||
0:11 5 (const int)
|
||||
0:11 No loop body
|
||||
0:11 Loop Terminal Expression
|
||||
0:11 Pre-Increment ( temp int)
|
||||
0:11 'z' ( temp int)
|
||||
0:13 Branch: Return with expression
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:3 Function Definition: main( ( temp void)
|
||||
0:3 Function Parameters:
|
||||
0:? Sequence
|
||||
0:3 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:3 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 54
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 52
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 9 "@main("
|
||||
Name 13 "x"
|
||||
Name 27 "y"
|
||||
Name 37 "z"
|
||||
Name 52 "@entryPointOutput"
|
||||
Decorate 52(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeFunction 7(fvec4)
|
||||
11: TypeInt 32 1
|
||||
12: TypePointer Function 11(int)
|
||||
14: 11(int) Constant 0
|
||||
21: 11(int) Constant 5
|
||||
22: TypeBool
|
||||
25: 11(int) Constant 1
|
||||
47: 6(float) Constant 0
|
||||
48: 7(fvec4) ConstantComposite 47 47 47 47
|
||||
51: TypePointer Output 7(fvec4)
|
||||
52(@entryPointOutput): 51(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
53: 7(fvec4) FunctionCall 9(@main()
|
||||
Store 52(@entryPointOutput) 53
|
||||
Return
|
||||
FunctionEnd
|
||||
9(@main(): 7(fvec4) Function None 8
|
||||
10: Label
|
||||
13(x): 12(ptr) Variable Function
|
||||
27(y): 12(ptr) Variable Function
|
||||
37(z): 12(ptr) Variable Function
|
||||
Store 13(x) 14
|
||||
Branch 15
|
||||
15: Label
|
||||
LoopMerge 17 18 Unroll
|
||||
Branch 19
|
||||
19: Label
|
||||
20: 11(int) Load 13(x)
|
||||
23: 22(bool) SLessThan 20 21
|
||||
BranchConditional 23 16 17
|
||||
16: Label
|
||||
Branch 18
|
||||
18: Label
|
||||
24: 11(int) Load 13(x)
|
||||
26: 11(int) IAdd 24 25
|
||||
Store 13(x) 26
|
||||
Branch 15
|
||||
17: Label
|
||||
Store 27(y) 14
|
||||
Branch 28
|
||||
28: Label
|
||||
LoopMerge 30 31 DontUnroll
|
||||
Branch 32
|
||||
32: Label
|
||||
33: 11(int) Load 27(y)
|
||||
34: 22(bool) SLessThan 33 21
|
||||
BranchConditional 34 29 30
|
||||
29: Label
|
||||
Branch 31
|
||||
31: Label
|
||||
35: 11(int) Load 27(y)
|
||||
36: 11(int) IAdd 35 25
|
||||
Store 27(y) 36
|
||||
Branch 28
|
||||
30: Label
|
||||
Store 37(z) 14
|
||||
Branch 38
|
||||
38: Label
|
||||
LoopMerge 40 41 None
|
||||
Branch 42
|
||||
42: Label
|
||||
43: 11(int) Load 37(z)
|
||||
44: 22(bool) SLessThan 43 21
|
||||
BranchConditional 44 39 40
|
||||
39: Label
|
||||
Branch 41
|
||||
41: Label
|
||||
45: 11(int) Load 37(z)
|
||||
46: 11(int) IAdd 45 25
|
||||
Store 37(z) 46
|
||||
Branch 38
|
||||
40: Label
|
||||
ReturnValue 48
|
||||
FunctionEnd
|
||||
Reference in New Issue
Block a user