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,7 +3,7 @@ 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 49
// Id's are bound by 44
Capability Shader
1: ExtInstImport "GLSL.std.450"
@ -19,18 +19,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
MemberName 22(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 22(gl_PerVertex) 3 "gl_CullDistance"
Name 24 ""
Name 29 "ubname"
MemberName 29(ubname) 0 "b"
Name 31 "ubinst"
Name 32 "param"
Name 27 "ubname"
MemberName 27(ubname) 0 "b"
Name 29 "ubinst"
Name 30 "param"
MemberDecorate 22(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 22(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 22(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 22(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 22(gl_PerVertex) Block
MemberDecorate 29(ubname) 0 Offset 0
Decorate 29(ubname) Block
Decorate 31(ubinst) DescriptorSet 0
MemberDecorate 27(ubname) 0 Offset 0
Decorate 27(ubname) Block
Decorate 29(ubinst) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeBool
@ -47,38 +47,27 @@ Warning, version 450 is not yet complete; most version-specific features are pre
24: 23(ptr) Variable Output
25: TypeInt 32 1
26: 25(int) Constant 0
27: TypePointer Function 18(fvec4)
29(ubname): TypeStruct 19(int)
30: TypePointer Uniform 29(ubname)
31(ubinst): 30(ptr) Variable Uniform
33: TypePointer Uniform 19(int)
36: 19(int) Constant 0
41: 17(float) Constant 0
42: 18(fvec4) ConstantComposite 41 41 41 41
44: 17(float) Constant 1065353216
45: 18(fvec4) ConstantComposite 44 44 44 44
47: TypePointer Output 18(fvec4)
27(ubname): TypeStruct 19(int)
28: TypePointer Uniform 27(ubname)
29(ubinst): 28(ptr) Variable Uniform
31: TypePointer Uniform 19(int)
34: 19(int) Constant 0
37: 17(float) Constant 0
38: 18(fvec4) ConstantComposite 37 37 37 37
39: 17(float) Constant 1065353216
40: 18(fvec4) ConstantComposite 39 39 39 39
42: TypePointer Output 18(fvec4)
4(main): 2 Function None 3
5: Label
28: 27(ptr) Variable Function
32(param): 7(ptr) Variable Function
34: 33(ptr) AccessChain 31(ubinst) 26
35: 19(int) Load 34
37: 6(bool) INotEqual 35 36
Store 32(param) 37
38: 6(bool) FunctionCall 10(foo(b1;) 32(param)
SelectionMerge 40 None
BranchConditional 38 39 43
39: Label
Store 28 42
Branch 40
43: Label
Store 28 45
Branch 40
40: Label
46: 18(fvec4) Load 28
48: 47(ptr) AccessChain 24 26
Store 48 46
30(param): 7(ptr) Variable Function
32: 31(ptr) AccessChain 29(ubinst) 26
33: 19(int) Load 32
35: 6(bool) INotEqual 33 34
Store 30(param) 35
36: 6(bool) FunctionCall 10(foo(b1;) 30(param)
41: 18(fvec4) Select 36 38 40
43: 42(ptr) AccessChain 24 26
Store 43 41
Return
FunctionEnd
10(foo(b1;): 6(bool) Function None 8