SPV 1.4: Implement the 5 new loop controls.

This commit is contained in:
John Kessenich
2019-01-12 17:31:41 +07:00
parent 0c1e71a123
commit 1f4d04687b
12 changed files with 312 additions and 35 deletions

View File

@@ -56,7 +56,7 @@ ERROR: node is still EOpNull!
0:28 Function Definition: attExt( ( global void)
0:28 Function Parameters:
0:30 Sequence
0:30 Loop with condition not tested first: Dependency -3
0:30 Loop with condition not tested first
0:30 Loop Condition
0:30 Constant:
0:30 true (const bool)

View File

@@ -0,0 +1,110 @@
spv.1.4.LoopControl.frag
WARNING: 0:15: 'min_iterations' : expected a single integer argument
WARNING: 0:15: 'max_iterations' : expected a single integer argument
Validation failed
// Module Version 10400
// Generated by (magic number): 80007
// Id's are bound by 54
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 53
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_control_flow_attributes"
Name 4 "main"
Name 8 "i"
Name 32 "i"
Name 42 "i"
Name 53 "cond"
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
27: 17(bool) ConstantTrue
52: TypePointer Private 17(bool)
53(cond): 52(ptr) Variable Private
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
32(i): 7(ptr) Variable Function
42(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
LoopMerge 12 13 MinIterations MaxIterations 3 7
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 IterationMultiple 2
Branch 26
26: Label
BranchConditional 27 23 24
23: Label
Branch 25
25: Label
Branch 22
24: Label
Branch 28
28: Label
LoopMerge 30 31 PeelCount 5
Branch 29
29: Label
Branch 31
31: Label
BranchConditional 27 28 30
30: Label
Store 32(i) 9
Branch 33
33: Label
LoopMerge 35 36 PartialCount 4
Branch 37
37: Label
38: 6(int) Load 32(i)
39: 17(bool) SLessThan 38 16
BranchConditional 39 34 35
34: Label
Branch 36
36: Label
40: 6(int) Load 32(i)
41: 6(int) IAdd 40 20
Store 32(i) 41
Branch 33
35: Label
Store 42(i) 9
Branch 43
43: Label
LoopMerge 45 46 None
Branch 47
47: Label
48: 6(int) Load 42(i)
49: 17(bool) SLessThan 48 16
BranchConditional 49 44 45
44: Label
Branch 46
46: Label
50: 6(int) Load 42(i)
51: 6(int) IAdd 50 20
Store 42(i) 51
Branch 43
45: Label
Return
FunctionEnd

View File

@@ -1,7 +1,7 @@
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:20: 'unroll' : expected no arguments
WARNING: 0:21: 'dont_unroll' : expected no arguments
WARNING: 0:22: 'dependency_infinite' : expected no arguments
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

View File

@@ -0,0 +1,19 @@
#version 450
#extension GL_EXT_control_flow_attributes : enable
bool cond;
void main()
{
[[min_iterations(3), max_iterations(7)]] for (int i = 0; i < 8; ++i) { }
[[iteration_multiple(2)]] while(true) { }
[[peel_count(5)]] do { } while(true);
[[partial_count(4)]] for (int i = 0; i < 8; ++i) { }
// warnings on all these
[[min_iterations, max_iterations]] for (int i = 0; i < 8; ++i) { }
//[[iteration_multiple(0)]] while(true) { }
//[[peel_count]] do { } while(true);
//[[partial_count]] for (int i = 0; i < 8; ++i) { }
}