GLSL: Implement GL_EXT_control_flow_attributes.
See https://github.com/KhronosGroup/GLSL/pull/11.
This commit is contained in:
@@ -15,3 +15,18 @@ void main()
|
||||
b1 = allInvocations(b1);
|
||||
b1 = allInvocationsEqual(b1);
|
||||
}
|
||||
|
||||
void attExtBad()
|
||||
{
|
||||
// ERRORs, not enabled
|
||||
[[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { }
|
||||
[[flatten]] if (true) { } else { }
|
||||
}
|
||||
|
||||
#extension GL_EXT_control_flow_attributes : enable
|
||||
|
||||
void attExt()
|
||||
{
|
||||
[[dependency_length(-3)]] do { } while(true); // ERROR, not positive
|
||||
[[dependency_length(0)]] do { } while(true); // ERROR, not positive
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
460.frag
|
||||
ERROR: 0:22: 'attribute' : required extension not requested: GL_EXT_control_flow_attributes
|
||||
ERROR: 0:23: 'attribute' : required extension not requested: GL_EXT_control_flow_attributes
|
||||
ERROR: 0:30: 'dependency_length' : must be positive
|
||||
ERROR: 0:31: 'dependency_length' : must be positive
|
||||
ERROR: 4 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 460
|
||||
0:? Sequence
|
||||
Requested GL_EXT_control_flow_attributes
|
||||
ERROR: node is still EOpNull!
|
||||
0:10 Function Definition: main( ( global void)
|
||||
0:10 Function Parameters:
|
||||
0:12 Sequence
|
||||
@@ -21,6 +29,43 @@ Shader version: 460
|
||||
0:16 'b1' ( temp bool)
|
||||
0:16 allInvocationsEqual ( global bool)
|
||||
0:16 'b1' ( temp bool)
|
||||
0:19 Function Definition: attExtBad( ( global void)
|
||||
0:19 Function Parameters:
|
||||
0:22 Sequence
|
||||
0:22 Sequence
|
||||
0:22 Sequence
|
||||
0:22 move second child to first child ( temp int)
|
||||
0:22 'i' ( temp int)
|
||||
0:22 Constant:
|
||||
0:22 0 (const int)
|
||||
0:22 Loop with condition tested first
|
||||
0:22 Loop Condition
|
||||
0:22 Compare Less Than ( temp bool)
|
||||
0:22 'i' ( temp int)
|
||||
0:22 Constant:
|
||||
0:22 8 (const int)
|
||||
0:22 No loop body
|
||||
0:22 Loop Terminal Expression
|
||||
0:22 Pre-Increment ( temp int)
|
||||
0:22 'i' ( temp int)
|
||||
0:23 Test condition and select ( temp void)
|
||||
0:23 Condition
|
||||
0:23 Constant:
|
||||
0:23 true (const bool)
|
||||
0:23 true case is null
|
||||
0:28 Function Definition: attExt( ( global void)
|
||||
0:28 Function Parameters:
|
||||
0:30 Sequence
|
||||
0:30 Loop with condition not tested first
|
||||
0:30 Loop Condition
|
||||
0:30 Constant:
|
||||
0:30 true (const bool)
|
||||
0:30 No loop body
|
||||
0:31 Loop with condition not tested first
|
||||
0:31 Loop Condition
|
||||
0:31 Constant:
|
||||
0:31 true (const bool)
|
||||
0:31 No loop body
|
||||
0:? Linker Objects
|
||||
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})
|
||||
|
||||
@@ -29,7 +74,8 @@ Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 460
|
||||
0:? Sequence
|
||||
Requested GL_EXT_control_flow_attributes
|
||||
ERROR: node is still EOpNull!
|
||||
0:10 Function Definition: main( ( global void)
|
||||
0:10 Function Parameters:
|
||||
0:12 Sequence
|
||||
|
||||
238
Test/baseResults/spv.controlFlowAttributes.frag.out
Executable file
238
Test/baseResults/spv.controlFlowAttributes.frag.out
Executable file
@@ -0,0 +1,238 @@
|
||||
spv.controlFlowAttributes.frag
|
||||
WARNING: 0:20: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:21: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:22: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:23: 'dependency_length' : expected a single integer argument
|
||||
WARNING: 0:24: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:25: '' : attribute with arguments not recognized, skipping
|
||||
WARNING: 0:26: '' : attribute with arguments not recognized, skipping
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80003
|
||||
// Id's are bound by 118
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_EXT_control_flow_attributes"
|
||||
Name 4 "main"
|
||||
Name 8 "i"
|
||||
Name 36 "i"
|
||||
Name 47 "cond"
|
||||
Name 60 "i"
|
||||
Name 79 "i"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 1
|
||||
7: TypePointer Function 6(int)
|
||||
9: 6(int) Constant 0
|
||||
16: 6(int) Constant 8
|
||||
17: TypeBool
|
||||
20: 6(int) Constant 1
|
||||
31: 17(bool) ConstantTrue
|
||||
46: TypePointer Private 17(bool)
|
||||
47(cond): 46(ptr) Variable Private
|
||||
54: 17(bool) ConstantFalse
|
||||
55: 6(int) Constant 3
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
8(i): 7(ptr) Variable Function
|
||||
36(i): 7(ptr) Variable Function
|
||||
60(i): 7(ptr) Variable Function
|
||||
79(i): 7(ptr) Variable Function
|
||||
Store 8(i) 9
|
||||
Branch 10
|
||||
10: Label
|
||||
LoopMerge 12 13 Unroll
|
||||
Branch 14
|
||||
14: Label
|
||||
15: 6(int) Load 8(i)
|
||||
18: 17(bool) SLessThan 15 16
|
||||
BranchConditional 18 11 12
|
||||
11: Label
|
||||
Branch 13
|
||||
13: Label
|
||||
19: 6(int) Load 8(i)
|
||||
21: 6(int) IAdd 19 20
|
||||
Store 8(i) 21
|
||||
Branch 10
|
||||
12: Label
|
||||
Branch 22
|
||||
22: Label
|
||||
LoopMerge 24 25 DontUnroll
|
||||
Branch 23
|
||||
23: Label
|
||||
Branch 25
|
||||
25: Label
|
||||
Branch 22
|
||||
24: Label
|
||||
Branch 26
|
||||
26: Label
|
||||
LoopMerge 28 29 DontUnroll
|
||||
Branch 30
|
||||
30: Label
|
||||
BranchConditional 31 27 28
|
||||
27: Label
|
||||
Branch 29
|
||||
29: Label
|
||||
Branch 26
|
||||
28: Label
|
||||
Branch 32
|
||||
32: Label
|
||||
LoopMerge 34 35 DependencyInfinite
|
||||
Branch 33
|
||||
33: Label
|
||||
Branch 35
|
||||
35: Label
|
||||
BranchConditional 31 32 34
|
||||
34: Label
|
||||
Store 36(i) 9
|
||||
Branch 37
|
||||
37: Label
|
||||
LoopMerge 39 40 DependencyLength 4
|
||||
Branch 41
|
||||
41: Label
|
||||
42: 6(int) Load 36(i)
|
||||
43: 17(bool) SLessThan 42 16
|
||||
BranchConditional 43 38 39
|
||||
38: Label
|
||||
Branch 40
|
||||
40: Label
|
||||
44: 6(int) Load 36(i)
|
||||
45: 6(int) IAdd 44 20
|
||||
Store 36(i) 45
|
||||
Branch 37
|
||||
39: Label
|
||||
48: 17(bool) Load 47(cond)
|
||||
SelectionMerge 50 Flatten
|
||||
BranchConditional 48 49 50
|
||||
49: Label
|
||||
Branch 50
|
||||
50: Label
|
||||
51: 17(bool) Load 47(cond)
|
||||
SelectionMerge 53 DontFlatten
|
||||
BranchConditional 51 52 53
|
||||
52: Label
|
||||
Store 47(cond) 54
|
||||
Branch 53
|
||||
53: Label
|
||||
SelectionMerge 57 DontFlatten
|
||||
Switch 55 57
|
||||
case 3: 56
|
||||
56: Label
|
||||
Branch 57
|
||||
57: Label
|
||||
Store 60(i) 9
|
||||
Branch 61
|
||||
61: Label
|
||||
LoopMerge 63 64 None
|
||||
Branch 65
|
||||
65: Label
|
||||
66: 6(int) Load 60(i)
|
||||
67: 17(bool) SLessThan 66 16
|
||||
BranchConditional 67 62 63
|
||||
62: Label
|
||||
Branch 64
|
||||
64: Label
|
||||
68: 6(int) Load 60(i)
|
||||
69: 6(int) IAdd 68 20
|
||||
Store 60(i) 69
|
||||
Branch 61
|
||||
63: Label
|
||||
Branch 70
|
||||
70: Label
|
||||
LoopMerge 72 73 None
|
||||
Branch 74
|
||||
74: Label
|
||||
BranchConditional 31 71 72
|
||||
71: Label
|
||||
Branch 73
|
||||
73: Label
|
||||
Branch 70
|
||||
72: Label
|
||||
Branch 75
|
||||
75: Label
|
||||
LoopMerge 77 78 None
|
||||
Branch 76
|
||||
76: Label
|
||||
Branch 78
|
||||
78: Label
|
||||
BranchConditional 31 75 77
|
||||
77: Label
|
||||
Store 79(i) 9
|
||||
Branch 80
|
||||
80: Label
|
||||
LoopMerge 82 83 None
|
||||
Branch 84
|
||||
84: Label
|
||||
85: 6(int) Load 79(i)
|
||||
86: 17(bool) SLessThan 85 16
|
||||
BranchConditional 86 81 82
|
||||
81: Label
|
||||
Branch 83
|
||||
83: Label
|
||||
87: 6(int) Load 79(i)
|
||||
88: 6(int) IAdd 87 20
|
||||
Store 79(i) 88
|
||||
Branch 80
|
||||
82: Label
|
||||
89: 17(bool) Load 47(cond)
|
||||
SelectionMerge 91 None
|
||||
BranchConditional 89 90 91
|
||||
90: Label
|
||||
Branch 91
|
||||
91: Label
|
||||
92: 17(bool) Load 47(cond)
|
||||
SelectionMerge 94 None
|
||||
BranchConditional 92 93 94
|
||||
93: Label
|
||||
Store 47(cond) 54
|
||||
Branch 94
|
||||
94: Label
|
||||
SelectionMerge 96 None
|
||||
Switch 55 96
|
||||
case 3: 95
|
||||
95: Label
|
||||
Branch 96
|
||||
96: Label
|
||||
Branch 99
|
||||
99: Label
|
||||
LoopMerge 101 102 Unroll DontUnroll DependencyLength 2
|
||||
Branch 103
|
||||
103: Label
|
||||
104: 17(bool) Load 47(cond)
|
||||
BranchConditional 104 100 101
|
||||
100: Label
|
||||
Branch 102
|
||||
102: Label
|
||||
Branch 99
|
||||
101: Label
|
||||
SelectionMerge 106 DontFlatten
|
||||
Switch 55 106
|
||||
case 3: 105
|
||||
105: Label
|
||||
Branch 106
|
||||
106: Label
|
||||
109: 17(bool) Load 47(cond)
|
||||
SelectionMerge 111 Flatten
|
||||
BranchConditional 109 110 111
|
||||
110: Label
|
||||
Branch 111
|
||||
111: Label
|
||||
Branch 112
|
||||
112: Label
|
||||
LoopMerge 114 115 DependencyInfinite
|
||||
Branch 116
|
||||
116: Label
|
||||
117: 17(bool) Load 47(cond)
|
||||
BranchConditional 117 113 114
|
||||
113: Label
|
||||
Branch 115
|
||||
115: Label
|
||||
Branch 112
|
||||
114: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
39
Test/spv.controlFlowAttributes.frag
Normal file
39
Test/spv.controlFlowAttributes.frag
Normal file
@@ -0,0 +1,39 @@
|
||||
#version 450
|
||||
|
||||
#extension GL_EXT_control_flow_attributes : enable
|
||||
|
||||
bool cond;
|
||||
|
||||
void main()
|
||||
{
|
||||
[[unroll]] for (int i = 0; i < 8; ++i) { }
|
||||
[[loop]] for (;;) { }
|
||||
[[dont_unroll]] while(true) { }
|
||||
[[dependency_infinite]] do { } while(true);
|
||||
[[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { }
|
||||
[[flatten]] if (cond) { } else { }
|
||||
[[branch]] if (cond) cond = false;
|
||||
[[dont_flatten]] switch(3) { } // dropped
|
||||
[[dont_flatten]] switch(3) { case 3: break; }
|
||||
|
||||
// warnings on all these
|
||||
[[unroll(2)]] for (int i = 0; i < 8; ++i) { }
|
||||
[[dont_unroll(-2)]] while(true) { }
|
||||
[[dependency_infinite(3)]] do { } while(true);
|
||||
[[dependency_length]] for (int i = 0; i < 8; ++i) { }
|
||||
[[flatten(3)]] if (cond) { } else { }
|
||||
[[branch(5.2)]] if (cond) cond = false;
|
||||
[[dont_flatten(3 + 7)]] switch(3) { case 3: break; }
|
||||
|
||||
// other valid uses
|
||||
[[ unroll, dont_unroll, dependency_length(2) ]] while(cond) { }
|
||||
[ [ dont_flatten , branch ] ] switch(3) { case 3: break; }
|
||||
[
|
||||
// attribute
|
||||
[
|
||||
// here
|
||||
flatten
|
||||
]
|
||||
] if (cond) { } else { }
|
||||
[[ dependency_length(2), dependency_infinite ]] while(cond) { }
|
||||
}
|
||||
Reference in New Issue
Block a user