HLSL: Fix #1249: Always execute both sides of ternary "?:".
This is semantically required by HLSL, and frequently results in using OpSelect instead of control flow.
This commit is contained in:
@@ -18,7 +18,7 @@ gl_FragCoord origin is upper left
|
||||
0:3 'n_dot_l' ( in float)
|
||||
0:3 Constant:
|
||||
0:3 0.000000
|
||||
0:3 Test condition and select ( temp float)
|
||||
0:3 Test condition and select ( temp float): no shortcircuit
|
||||
0:3 Condition
|
||||
0:3 Compare Less Than ( temp bool)
|
||||
0:3 min ( temp float)
|
||||
@@ -79,7 +79,7 @@ gl_FragCoord origin is upper left
|
||||
0:3 'n_dot_l' ( in float)
|
||||
0:3 Constant:
|
||||
0:3 0.000000
|
||||
0:3 Test condition and select ( temp float)
|
||||
0:3 Test condition and select ( temp float): no shortcircuit
|
||||
0:3 Condition
|
||||
0:3 Compare Less Than ( temp bool)
|
||||
0:3 min ( temp float)
|
||||
@@ -119,12 +119,12 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80004
|
||||
// Id's are bound by 52
|
||||
// Id's are bound by 48
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 37 40 43
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 33 36 39
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 500
|
||||
Name 4 "PixelShaderFunction"
|
||||
@@ -133,18 +133,18 @@ gl_FragCoord origin is upper left
|
||||
Name 10 "n_dot_h"
|
||||
Name 11 "m"
|
||||
Name 16 "r0"
|
||||
Name 35 "n_dot_l"
|
||||
Name 37 "n_dot_l"
|
||||
Name 39 "n_dot_h"
|
||||
Name 40 "n_dot_h"
|
||||
Name 42 "m"
|
||||
Name 43 "m"
|
||||
Name 31 "n_dot_l"
|
||||
Name 33 "n_dot_l"
|
||||
Name 35 "n_dot_h"
|
||||
Name 36 "n_dot_h"
|
||||
Name 38 "m"
|
||||
Name 39 "m"
|
||||
Name 41 "param"
|
||||
Name 43 "param"
|
||||
Name 45 "param"
|
||||
Name 47 "param"
|
||||
Name 49 "param"
|
||||
Decorate 37(n_dot_l) Location 0
|
||||
Decorate 40(n_dot_h) Location 1
|
||||
Decorate 43(m) Location 2
|
||||
Decorate 33(n_dot_l) Location 0
|
||||
Decorate 36(n_dot_h) Location 1
|
||||
Decorate 39(m) Location 2
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -154,32 +154,32 @@ gl_FragCoord origin is upper left
|
||||
15: TypePointer Function 14(fvec4)
|
||||
17: 6(float) Constant 1065353216
|
||||
19: 6(float) Constant 0
|
||||
25: TypeBool
|
||||
36: TypePointer Input 6(float)
|
||||
37(n_dot_l): 36(ptr) Variable Input
|
||||
40(n_dot_h): 36(ptr) Variable Input
|
||||
43(m): 36(ptr) Variable Input
|
||||
24: TypeBool
|
||||
32: TypePointer Input 6(float)
|
||||
33(n_dot_l): 32(ptr) Variable Input
|
||||
36(n_dot_h): 32(ptr) Variable Input
|
||||
39(m): 32(ptr) Variable Input
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
35(n_dot_l): 7(ptr) Variable Function
|
||||
39(n_dot_h): 7(ptr) Variable Function
|
||||
42(m): 7(ptr) Variable Function
|
||||
31(n_dot_l): 7(ptr) Variable Function
|
||||
35(n_dot_h): 7(ptr) Variable Function
|
||||
38(m): 7(ptr) Variable Function
|
||||
41(param): 7(ptr) Variable Function
|
||||
43(param): 7(ptr) Variable Function
|
||||
45(param): 7(ptr) Variable Function
|
||||
47(param): 7(ptr) Variable Function
|
||||
49(param): 7(ptr) Variable Function
|
||||
38: 6(float) Load 37(n_dot_l)
|
||||
Store 35(n_dot_l) 38
|
||||
41: 6(float) Load 40(n_dot_h)
|
||||
Store 39(n_dot_h) 41
|
||||
44: 6(float) Load 43(m)
|
||||
Store 42(m) 44
|
||||
46: 6(float) Load 35(n_dot_l)
|
||||
34: 6(float) Load 33(n_dot_l)
|
||||
Store 31(n_dot_l) 34
|
||||
37: 6(float) Load 36(n_dot_h)
|
||||
Store 35(n_dot_h) 37
|
||||
40: 6(float) Load 39(m)
|
||||
Store 38(m) 40
|
||||
42: 6(float) Load 31(n_dot_l)
|
||||
Store 41(param) 42
|
||||
44: 6(float) Load 35(n_dot_h)
|
||||
Store 43(param) 44
|
||||
46: 6(float) Load 38(m)
|
||||
Store 45(param) 46
|
||||
48: 6(float) Load 39(n_dot_h)
|
||||
Store 47(param) 48
|
||||
50: 6(float) Load 42(m)
|
||||
Store 49(param) 50
|
||||
51: 2 FunctionCall 12(@PixelShaderFunction(f1;f1;f1;) 45(param) 47(param) 49(param)
|
||||
47: 2 FunctionCall 12(@PixelShaderFunction(f1;f1;f1;) 41(param) 43(param) 45(param)
|
||||
Return
|
||||
FunctionEnd
|
||||
12(@PixelShaderFunction(f1;f1;f1;): 2 Function None 8
|
||||
@@ -188,27 +188,17 @@ gl_FragCoord origin is upper left
|
||||
11(m): 7(ptr) FunctionParameter
|
||||
13: Label
|
||||
16(r0): 15(ptr) Variable Function
|
||||
21: 7(ptr) Variable Function
|
||||
18: 6(float) Load 9(n_dot_l)
|
||||
20: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 18 19
|
||||
22: 6(float) Load 9(n_dot_l)
|
||||
23: 6(float) Load 10(n_dot_h)
|
||||
24: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 22 23
|
||||
26: 25(bool) FOrdLessThan 24 19
|
||||
SelectionMerge 28 None
|
||||
BranchConditional 26 27 29
|
||||
27: Label
|
||||
Store 21 19
|
||||
Branch 28
|
||||
29: Label
|
||||
30: 6(float) Load 10(n_dot_h)
|
||||
31: 6(float) Load 11(m)
|
||||
32: 6(float) FMul 30 31
|
||||
Store 21 32
|
||||
Branch 28
|
||||
28: Label
|
||||
33: 6(float) Load 21
|
||||
34: 14(fvec4) CompositeConstruct 17 20 33 17
|
||||
Store 16(r0) 34
|
||||
21: 6(float) Load 9(n_dot_l)
|
||||
22: 6(float) Load 10(n_dot_h)
|
||||
23: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 21 22
|
||||
25: 24(bool) FOrdLessThan 23 19
|
||||
26: 6(float) Load 10(n_dot_h)
|
||||
27: 6(float) Load 11(m)
|
||||
28: 6(float) FMul 26 27
|
||||
29: 6(float) Select 25 19 28
|
||||
30: 14(fvec4) CompositeConstruct 17 20 29 17
|
||||
Store 16(r0) 30
|
||||
Return
|
||||
FunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user