HLSL: Fix #903: Don't short-circuit && or ||.

This commit is contained in:
John Kessenich 2017-05-24 16:44:47 -06:00
parent 6e2295d340
commit 84cc15f0d0
4 changed files with 256 additions and 294 deletions

View file

@ -173,34 +173,34 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 91
// Id's are bound by 85
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 89
EntryPoint Fragment 4 "main" 83
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 11 "test1(f1;"
Name 10 "v"
Name 15 "@main("
Name 22 "@finitetmp"
Name 36 "@finitetmp"
Name 39 "$Global"
MemberName 39($Global) 0 "f"
MemberName 39($Global) 1 "f2"
MemberName 39($Global) 2 "f3"
Name 41 ""
Name 57 "@finitetmp"
Name 71 "@finitetmp"
Name 89 "@entryPointOutput"
MemberDecorate 39($Global) 0 Offset 0
MemberDecorate 39($Global) 1 Offset 4
MemberDecorate 39($Global) 2 Offset 16
Decorate 39($Global) Block
Decorate 41 DescriptorSet 0
Decorate 89(@entryPointOutput) Location 0
Name 20 "@finitetmp"
Name 32 "@finitetmp"
Name 35 "$Global"
MemberName 35($Global) 0 "f"
MemberName 35($Global) 1 "f2"
MemberName 35($Global) 2 "f3"
Name 37 ""
Name 51 "@finitetmp"
Name 65 "@finitetmp"
Name 83 "@entryPointOutput"
MemberDecorate 35($Global) 0 Offset 0
MemberDecorate 35($Global) 1 Offset 4
MemberDecorate 35($Global) 2 Offset 16
Decorate 35($Global) Block
Decorate 37 DescriptorSet 0
Decorate 83(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -209,100 +209,85 @@ gl_FragCoord origin is upper left
9: TypeFunction 8(bool) 7(ptr)
13: TypeVector 6(float) 4
14: TypeFunction 13(fvec4)
37: TypeVector 6(float) 2
38: TypeVector 6(float) 3
39($Global): TypeStruct 6(float) 37(fvec2) 38(fvec3)
40: TypePointer Uniform 39($Global)
41: 40(ptr) Variable Uniform
42: TypeInt 32 1
43: 42(int) Constant 0
44: TypePointer Uniform 6(float)
56: TypePointer Function 37(fvec2)
58: 42(int) Constant 1
59: TypePointer Uniform 37(fvec2)
63: TypeVector 8(bool) 2
70: TypePointer Function 38(fvec3)
72: 42(int) Constant 2
73: TypePointer Uniform 38(fvec3)
77: TypeVector 8(bool) 3
84: 6(float) Constant 0
85: 13(fvec4) ConstantComposite 84 84 84 84
88: TypePointer Output 13(fvec4)
89(@entryPointOutput): 88(ptr) Variable Output
33: TypeVector 6(float) 2
34: TypeVector 6(float) 3
35($Global): TypeStruct 6(float) 33(fvec2) 34(fvec3)
36: TypePointer Uniform 35($Global)
37: 36(ptr) Variable Uniform
38: TypeInt 32 1
39: 38(int) Constant 0
40: TypePointer Uniform 6(float)
50: TypePointer Function 33(fvec2)
52: 38(int) Constant 1
53: TypePointer Uniform 33(fvec2)
57: TypeVector 8(bool) 2
64: TypePointer Function 34(fvec3)
66: 38(int) Constant 2
67: TypePointer Uniform 34(fvec3)
71: TypeVector 8(bool) 3
78: 6(float) Constant 0
79: 13(fvec4) ConstantComposite 78 78 78 78
82: TypePointer Output 13(fvec4)
83(@entryPointOutput): 82(ptr) Variable Output
4(main): 2 Function None 3
5: Label
90: 13(fvec4) FunctionCall 15(@main()
Store 89(@entryPointOutput) 90
84: 13(fvec4) FunctionCall 15(@main()
Store 83(@entryPointOutput) 84
Return
FunctionEnd
11(test1(f1;): 8(bool) Function None 9
10(v): 7(ptr) FunctionParameter
12: Label
22(@finitetmp): 7(ptr) Variable Function
20(@finitetmp): 7(ptr) Variable Function
17: 6(float) Load 10(v)
18: 8(bool) IsNan 17
19: 8(bool) LogicalNot 18
SelectionMerge 21 None
BranchConditional 19 20 21
20: Label
23: 6(float) Load 10(v)
Store 22(@finitetmp) 23
24: 6(float) Load 22(@finitetmp)
25: 8(bool) IsNan 24
26: 8(bool) LogicalNot 25
SelectionMerge 28 None
BranchConditional 26 27 28
27: Label
29: 6(float) Load 22(@finitetmp)
30: 8(bool) IsInf 29
31: 8(bool) LogicalNot 30
Branch 28
28: Label
32: 8(bool) Phi 26 20 31 27
Branch 21
21: Label
33: 8(bool) Phi 19 12 32 28
ReturnValue 33
21: 6(float) Load 10(v)
Store 20(@finitetmp) 21
22: 6(float) Load 20(@finitetmp)
23: 8(bool) IsNan 22
24: 8(bool) LogicalNot 23
25: 6(float) Load 20(@finitetmp)
26: 8(bool) IsInf 25
27: 8(bool) LogicalNot 26
28: 8(bool) LogicalAnd 24 27
29: 8(bool) LogicalAnd 19 28
ReturnValue 29
FunctionEnd
15(@main(): 13(fvec4) Function None 14
16: Label
36(@finitetmp): 7(ptr) Variable Function
57(@finitetmp): 56(ptr) Variable Function
71(@finitetmp): 70(ptr) Variable Function
45: 44(ptr) AccessChain 41 43
46: 6(float) Load 45
Store 36(@finitetmp) 46
47: 6(float) Load 36(@finitetmp)
48: 8(bool) IsNan 47
49: 8(bool) LogicalNot 48
SelectionMerge 51 None
BranchConditional 49 50 51
50: Label
52: 6(float) Load 36(@finitetmp)
53: 8(bool) IsInf 52
54: 8(bool) LogicalNot 53
Branch 51
51: Label
55: 8(bool) Phi 49 16 54 50
60: 59(ptr) AccessChain 41 58
61: 37(fvec2) Load 60
Store 57(@finitetmp) 61
62: 37(fvec2) Load 57(@finitetmp)
64: 63(bvec2) IsNan 62
65: 63(bvec2) LogicalNot 64
66: 37(fvec2) Load 57(@finitetmp)
67: 63(bvec2) IsInf 66
68: 63(bvec2) LogicalNot 67
69: 63(bvec2) LogicalAnd 65 68
74: 73(ptr) AccessChain 41 72
75: 38(fvec3) Load 74
Store 71(@finitetmp) 75
76: 38(fvec3) Load 71(@finitetmp)
78: 77(bvec3) IsNan 76
79: 77(bvec3) LogicalNot 78
80: 38(fvec3) Load 71(@finitetmp)
81: 77(bvec3) IsInf 80
82: 77(bvec3) LogicalNot 81
83: 77(bvec3) LogicalAnd 79 82
ReturnValue 85
32(@finitetmp): 7(ptr) Variable Function
51(@finitetmp): 50(ptr) Variable Function
65(@finitetmp): 64(ptr) Variable Function
41: 40(ptr) AccessChain 37 39
42: 6(float) Load 41
Store 32(@finitetmp) 42
43: 6(float) Load 32(@finitetmp)
44: 8(bool) IsNan 43
45: 8(bool) LogicalNot 44
46: 6(float) Load 32(@finitetmp)
47: 8(bool) IsInf 46
48: 8(bool) LogicalNot 47
49: 8(bool) LogicalAnd 45 48
54: 53(ptr) AccessChain 37 52
55: 33(fvec2) Load 54
Store 51(@finitetmp) 55
56: 33(fvec2) Load 51(@finitetmp)
58: 57(bvec2) IsNan 56
59: 57(bvec2) LogicalNot 58
60: 33(fvec2) Load 51(@finitetmp)
61: 57(bvec2) IsInf 60
62: 57(bvec2) LogicalNot 61
63: 57(bvec2) LogicalAnd 59 62
68: 67(ptr) AccessChain 37 66
69: 34(fvec3) Load 68
Store 65(@finitetmp) 69
70: 34(fvec3) Load 65(@finitetmp)
72: 71(bvec3) IsNan 70
73: 71(bvec3) LogicalNot 72
74: 34(fvec3) Load 65(@finitetmp)
75: 71(bvec3) IsInf 74
76: 71(bvec3) LogicalNot 75
77: 71(bvec3) LogicalAnd 73 76
ReturnValue 79
FunctionEnd