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

@@ -335,12 +335,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 145
// Id's are bound by 140
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 143
EntryPoint Fragment 4 "main" 138
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -352,17 +352,17 @@ gl_FragCoord origin is upper left
MemberName 16($Global) 2 "condf1"
MemberName 16($Global) 3 "condi1"
Name 18 ""
Name 93 "f"
Name 106 "i"
Name 126 "g"
Name 143 "@entryPointOutput"
Name 88 "f"
Name 101 "i"
Name 121 "g"
Name 138 "@entryPointOutput"
MemberDecorate 16($Global) 0 Offset 0
MemberDecorate 16($Global) 1 Offset 4
MemberDecorate 16($Global) 2 Offset 8
MemberDecorate 16($Global) 3 Offset 12
Decorate 16($Global) Block
Decorate 18 DescriptorSet 0
Decorate 143(@entryPointOutput) Location 0
Decorate 138(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -388,25 +388,25 @@ gl_FragCoord origin is upper left
53: 6(float) Constant 1077936128
57: 15(int) Constant 3
64: 6(float) Constant 1082130432
88: 6(float) Constant 1084227584
92: TypePointer Function 6(float)
105: TypePointer Function 15(int)
130: 6(float) Constant 1088421888
131: 6(float) Constant 1090519040
142: TypePointer Output 7(fvec4)
143(@entryPointOutput): 142(ptr) Variable Output
83: 6(float) Constant 1084227584
87: TypePointer Function 6(float)
100: TypePointer Function 15(int)
125: 6(float) Constant 1088421888
126: 6(float) Constant 1090519040
137: TypePointer Output 7(fvec4)
138(@entryPointOutput): 137(ptr) Variable Output
4(main): 2 Function None 3
5: Label
144: 7(fvec4) FunctionCall 9(@main()
Store 143(@entryPointOutput) 144
139: 7(fvec4) FunctionCall 9(@main()
Store 138(@entryPointOutput) 139
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
12(a): 11(ptr) Variable Function
93(f): 92(ptr) Variable Function
106(i): 105(ptr) Variable Function
126(g): 92(ptr) Variable Function
88(f): 87(ptr) Variable Function
101(i): 100(ptr) Variable Function
121(g): 87(ptr) Variable Function
Store 12(a) 14
21: 20(ptr) AccessChain 18 19
22: 15(int) Load 21
@@ -455,98 +455,87 @@ gl_FragCoord origin is upper left
68: 20(ptr) AccessChain 18 19
69: 15(int) Load 68
70: 23(bool) INotEqual 69 25
SelectionMerge 72 None
BranchConditional 70 71 72
71: Label
73: 35(ptr) AccessChain 18 34
74: 6(float) Load 73
75: 15(int) ConvertFToS 74
76: 23(bool) INotEqual 75 25
Branch 72
72: Label
77: 23(bool) Phi 70 62 76 71
78: 23(bool) LogicalNot 77
SelectionMerge 80 None
BranchConditional 78 79 80
79: Label
81: 35(ptr) AccessChain 18 46
82: 6(float) Load 81
83: 23(bool) FOrdNotEqual 82 38
Branch 80
80: Label
84: 23(bool) Phi 77 72 83 79
SelectionMerge 86 None
BranchConditional 84 85 86
85: Label
87: 7(fvec4) Load 12(a)
89: 7(fvec4) CompositeConstruct 88 88 88 88
90: 7(fvec4) FAdd 87 89
ReturnValue 90
86: Label
94: 35(ptr) AccessChain 18 34
95: 6(float) Load 94
Store 93(f) 95
Branch 96
96: Label
LoopMerge 98 99 None
Branch 100
100: Label
101: 6(float) Load 93(f)
102: 23(bool) FOrdNotEqual 101 38
BranchConditional 102 97 98
97: Label
103: 6(float) Load 93(f)
104: 6(float) FSub 103 30
Store 93(f) 104
Branch 99
99: Label
Branch 96
98: Label
107: 20(ptr) AccessChain 18 19
108: 15(int) Load 107
Store 106(i) 108
Branch 109
109: Label
LoopMerge 111 112 None
Branch 110
110: Label
113: 15(int) Load 106(i)
114: 15(int) ISub 113 19
Store 106(i) 114
71: 35(ptr) AccessChain 18 34
72: 6(float) Load 71
73: 15(int) ConvertFToS 72
74: 23(bool) INotEqual 73 25
75: 23(bool) LogicalAnd 70 74
76: 35(ptr) AccessChain 18 46
77: 6(float) Load 76
78: 23(bool) FOrdNotEqual 77 38
79: 23(bool) LogicalOr 75 78
SelectionMerge 81 None
BranchConditional 79 80 81
80: Label
82: 7(fvec4) Load 12(a)
84: 7(fvec4) CompositeConstruct 83 83 83 83
85: 7(fvec4) FAdd 82 84
ReturnValue 85
81: Label
89: 35(ptr) AccessChain 18 34
90: 6(float) Load 89
Store 88(f) 90
Branch 91
91: Label
LoopMerge 93 94 None
Branch 95
95: Label
96: 6(float) Load 88(f)
97: 23(bool) FOrdNotEqual 96 38
BranchConditional 97 92 93
92: Label
98: 6(float) Load 88(f)
99: 6(float) FSub 98 30
Store 88(f) 99
Branch 94
94: Label
Branch 91
93: Label
102: 20(ptr) AccessChain 18 19
103: 15(int) Load 102
Store 101(i) 103
Branch 104
104: Label
LoopMerge 106 107 None
Branch 105
105: Label
108: 15(int) Load 101(i)
109: 15(int) ISub 108 19
Store 101(i) 109
Branch 107
107: Label
110: 15(int) Load 101(i)
111: 23(bool) INotEqual 110 25
BranchConditional 111 104 106
106: Label
Branch 112
112: Label
115: 15(int) Load 106(i)
116: 23(bool) INotEqual 115 25
BranchConditional 116 109 111
111: Label
Branch 117
117: Label
LoopMerge 119 120 None
Branch 121
121: Label
122: 15(int) Load 106(i)
123: 23(bool) INotEqual 122 25
BranchConditional 123 118 119
118: Label
124: 15(int) Load 106(i)
125: 15(int) ISub 124 19
Store 106(i) 125
Branch 120
120: Label
Branch 117
119: Label
127: 35(ptr) AccessChain 18 34
128: 6(float) Load 127
129: 23(bool) FOrdNotEqual 128 38
132: 6(float) Select 129 130 131
Store 126(g) 132
133: 6(float) Load 126(g)
134: 7(fvec4) Load 12(a)
135: 7(fvec4) CompositeConstruct 133 133 133 133
136: 7(fvec4) FAdd 134 135
Store 12(a) 136
137: 7(fvec4) Load 12(a)
138: 7(fvec4) CompositeConstruct 30 30 30 30
139: 7(fvec4) FSub 137 138
ReturnValue 139
LoopMerge 114 115 None
Branch 116
116: Label
117: 15(int) Load 101(i)
118: 23(bool) INotEqual 117 25
BranchConditional 118 113 114
113: Label
119: 15(int) Load 101(i)
120: 15(int) ISub 119 19
Store 101(i) 120
Branch 115
115: Label
Branch 112
114: Label
122: 35(ptr) AccessChain 18 34
123: 6(float) Load 122
124: 23(bool) FOrdNotEqual 123 38
127: 6(float) Select 124 125 126
Store 121(g) 127
128: 6(float) Load 121(g)
129: 7(fvec4) Load 12(a)
130: 7(fvec4) CompositeConstruct 128 128 128 128
131: 7(fvec4) FAdd 129 130
Store 12(a) 131
132: 7(fvec4) Load 12(a)
133: 7(fvec4) CompositeConstruct 30 30 30 30
134: 7(fvec4) FSub 132 133
ReturnValue 134
FunctionEnd