SPV: Emit OpSelect when a selection node is simple enough.

Also, ensures it has a type, no disallowed side effects,
or performance trade offs.
This commit is contained in:
John Kessenich
2017-01-26 20:31:11 -07:00
parent 509177d136
commit 433e9ff896
6 changed files with 321 additions and 322 deletions

View File

@@ -3,38 +3,37 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 35
// Id's are bound by 31
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 18 31
EntryPoint Vertex 4 "main" 17 27
Source GLSL 450
Name 4 "main"
Name 8 "i"
Name 18 "flag"
Name 31 "r"
Decorate 18(flag) RelaxedPrecision
Decorate 18(flag) Location 0
Decorate 19 RelaxedPrecision
Decorate 31(r) Location 0
Name 17 "flag"
Name 27 "r"
Decorate 17(flag) RelaxedPrecision
Decorate 17(flag) Location 0
Decorate 18 RelaxedPrecision
Decorate 27(r) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 0
17: TypePointer Input 6(int)
18(flag): 17(ptr) Variable Input
20: 6(int) Constant 1
21: TypeBool
25: 6(int) Constant 10
27: 6(int) Constant 15
30: TypePointer Output 6(int)
31(r): 30(ptr) Variable Output
16: TypePointer Input 6(int)
17(flag): 16(ptr) Variable Input
19: 6(int) Constant 1
20: TypeBool
22: 6(int) Constant 10
23: 6(int) Constant 15
26: TypePointer Output 6(int)
27(r): 26(ptr) Variable Output
4(main): 2 Function None 3
5: Label
8(i): 7(ptr) Variable Function
16: 7(ptr) Variable Function
Store 8(i) 9
Branch 10
10: Label
@@ -42,29 +41,20 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Branch 14
14: Label
15: 6(int) Load 8(i)
19: 6(int) Load 18(flag)
22: 21(bool) IEqual 19 20
SelectionMerge 24 None
BranchConditional 22 23 26
23: Label
Store 16 25
Branch 24
26: Label
Store 16 27
Branch 24
24: Label
28: 6(int) Load 16
29: 21(bool) SLessThan 15 28
BranchConditional 29 11 12
11: Label
32: 6(int) Load 8(i)
Store 31(r) 32
Branch 13
13: Label
33: 6(int) Load 8(i)
34: 6(int) IAdd 33 20
Store 8(i) 34
Branch 10
18: 6(int) Load 17(flag)
21: 20(bool) IEqual 18 19
24: 6(int) Select 21 22 23
25: 20(bool) SLessThan 15 24
BranchConditional 25 11 12
11: Label
28: 6(int) Load 8(i)
Store 27(r) 28
Branch 13
13: Label
29: 6(int) Load 8(i)
30: 6(int) IAdd 29 19
Store 8(i) 30
Branch 10
12: Label
Return
FunctionEnd