HLSL: Implicit bool conversions for conditional expressions and related.
Covers if(cond), while(cond), do-while(cond), for(;cond;), and (cond ? :). Fixes #778.
This commit is contained in:
parent
8f9fdc986a
commit
7e997e2612
@ -9,7 +9,7 @@ gl_FragCoord origin is upper left
|
||||
0:11 Test condition and select ( temp void)
|
||||
0:11 Condition
|
||||
0:11 Constant:
|
||||
0:11 0 (const int)
|
||||
0:11 false (const bool)
|
||||
0:11 true case is null
|
||||
0:2 Function Definition: PixelShaderFunction( ( temp void)
|
||||
0:2 Function Parameters:
|
||||
@ -36,7 +36,7 @@ gl_FragCoord origin is upper left
|
||||
0:11 Test condition and select ( temp void)
|
||||
0:11 Condition
|
||||
0:11 Constant:
|
||||
0:11 0 (const int)
|
||||
0:11 false (const bool)
|
||||
0:11 true case is null
|
||||
0:2 Function Definition: PixelShaderFunction( ( temp void)
|
||||
0:2 Function Parameters:
|
||||
@ -71,8 +71,8 @@ gl_FragCoord origin is upper left
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
9: TypeFunction 2 8(ptr)
|
||||
13: TypeInt 32 1
|
||||
14: 13(int) Constant 0
|
||||
13: TypeBool
|
||||
14: 13(bool) ConstantFalse
|
||||
18: TypePointer Input 7(fvec4)
|
||||
19(input): 18(ptr) Variable Input
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
|
||||
@ -55,7 +55,8 @@ gl_FragCoord origin is upper left
|
||||
0:12 'a' ( temp int)
|
||||
0:12 Test condition and select ( temp int)
|
||||
0:12 Condition
|
||||
0:12 'b' ( temp int)
|
||||
0:12 Convert int to bool ( temp bool)
|
||||
0:12 'b' ( temp int)
|
||||
0:12 true case
|
||||
0:12 move second child to first child ( temp int)
|
||||
0:12 'c' ( temp int)
|
||||
@ -67,7 +68,8 @@ gl_FragCoord origin is upper left
|
||||
0:12 'b' ( temp int)
|
||||
0:12 Test condition and select ( temp int)
|
||||
0:12 Condition
|
||||
0:12 'a' ( temp int)
|
||||
0:12 Convert int to bool ( temp bool)
|
||||
0:12 'a' ( temp int)
|
||||
0:12 true case
|
||||
0:12 move second child to first child ( temp int)
|
||||
0:12 'd' ( temp int)
|
||||
@ -179,7 +181,8 @@ gl_FragCoord origin is upper left
|
||||
0:12 'a' ( temp int)
|
||||
0:12 Test condition and select ( temp int)
|
||||
0:12 Condition
|
||||
0:12 'b' ( temp int)
|
||||
0:12 Convert int to bool ( temp bool)
|
||||
0:12 'b' ( temp int)
|
||||
0:12 true case
|
||||
0:12 move second child to first child ( temp int)
|
||||
0:12 'c' ( temp int)
|
||||
@ -191,7 +194,8 @@ gl_FragCoord origin is upper left
|
||||
0:12 'b' ( temp int)
|
||||
0:12 Test condition and select ( temp int)
|
||||
0:12 Condition
|
||||
0:12 'a' ( temp int)
|
||||
0:12 Convert int to bool ( temp bool)
|
||||
0:12 'a' ( temp int)
|
||||
0:12 true case
|
||||
0:12 move second child to first child ( temp int)
|
||||
0:12 'd' ( temp int)
|
||||
@ -245,12 +249,12 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 100
|
||||
// Id's are bound by 102
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 93 96
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 95 98
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 11 "@PixelShaderFunction(vf4;"
|
||||
@ -261,13 +265,13 @@ gl_FragCoord origin is upper left
|
||||
Name 21 "d"
|
||||
Name 22 "ret"
|
||||
Name 42 "e"
|
||||
Name 59 "f"
|
||||
Name 91 "input"
|
||||
Name 64 "f"
|
||||
Name 93 "input"
|
||||
Name 96 "@entryPointOutput"
|
||||
Name 97 "param"
|
||||
Decorate 93(input) Location 0
|
||||
Decorate 96(@entryPointOutput) Location 0
|
||||
Name 95 "input"
|
||||
Name 98 "@entryPointOutput"
|
||||
Name 99 "param"
|
||||
Decorate 95(input) Location 0
|
||||
Decorate 98(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@ -279,27 +283,27 @@ gl_FragCoord origin is upper left
|
||||
16: 13(int) Constant 5
|
||||
18: 13(int) Constant 6
|
||||
20: 13(int) Constant 7
|
||||
49: 13(int) Constant 10
|
||||
57: 13(int) Constant 11
|
||||
61: TypeInt 32 0
|
||||
62: 61(int) Constant 0
|
||||
63: TypePointer Function 6(float)
|
||||
66: 61(int) Constant 1
|
||||
69: TypeBool
|
||||
92: TypePointer Input 7(fvec4)
|
||||
93(input): 92(ptr) Variable Input
|
||||
95: TypePointer Output 7(fvec4)
|
||||
96(@entryPointOutput): 95(ptr) Variable Output
|
||||
45: TypeBool
|
||||
46: TypeInt 32 0
|
||||
47: 46(int) Constant 0
|
||||
53: 13(int) Constant 10
|
||||
62: 13(int) Constant 11
|
||||
66: TypePointer Function 6(float)
|
||||
69: 46(int) Constant 1
|
||||
94: TypePointer Input 7(fvec4)
|
||||
95(input): 94(ptr) Variable Input
|
||||
97: TypePointer Output 7(fvec4)
|
||||
98(@entryPointOutput): 97(ptr) Variable Output
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
91(input): 8(ptr) Variable Function
|
||||
97(param): 8(ptr) Variable Function
|
||||
94: 7(fvec4) Load 93(input)
|
||||
Store 91(input) 94
|
||||
98: 7(fvec4) Load 91(input)
|
||||
Store 97(param) 98
|
||||
99: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 97(param)
|
||||
Store 96(@entryPointOutput) 99
|
||||
93(input): 8(ptr) Variable Function
|
||||
99(param): 8(ptr) Variable Function
|
||||
96: 7(fvec4) Load 95(input)
|
||||
Store 93(input) 96
|
||||
100: 7(fvec4) Load 93(input)
|
||||
Store 99(param) 100
|
||||
101: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 99(param)
|
||||
Store 98(@entryPointOutput) 101
|
||||
Return
|
||||
FunctionEnd
|
||||
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
|
||||
@ -312,9 +316,9 @@ gl_FragCoord origin is upper left
|
||||
22(ret): 8(ptr) Variable Function
|
||||
42(e): 14(ptr) Variable Function
|
||||
43: 14(ptr) Variable Function
|
||||
51: 14(ptr) Variable Function
|
||||
59(f): 8(ptr) Variable Function
|
||||
60: 8(ptr) Variable Function
|
||||
55: 14(ptr) Variable Function
|
||||
64(f): 8(ptr) Variable Function
|
||||
65: 8(ptr) Variable Function
|
||||
Store 15(a) 16
|
||||
Store 17(b) 18
|
||||
Store 19(c) 20
|
||||
@ -340,63 +344,65 @@ gl_FragCoord origin is upper left
|
||||
41: 7(fvec4) FAdd 36 40
|
||||
Store 22(ret) 41
|
||||
44: 13(int) Load 17(b)
|
||||
SelectionMerge 46 None
|
||||
BranchConditional 44 45 48
|
||||
45: Label
|
||||
47: 13(int) Load 21(d)
|
||||
Store 19(c) 47
|
||||
Store 43 47
|
||||
Branch 46
|
||||
48: Label
|
||||
Store 43 49
|
||||
Branch 46
|
||||
46: Label
|
||||
50: 13(int) Load 43
|
||||
Store 15(a) 50
|
||||
Store 42(e) 50
|
||||
52: 13(int) Load 15(a)
|
||||
SelectionMerge 54 None
|
||||
BranchConditional 52 53 56
|
||||
53: Label
|
||||
55: 13(int) Load 19(c)
|
||||
Store 21(d) 55
|
||||
Store 51 55
|
||||
Branch 54
|
||||
56: Label
|
||||
Store 51 57
|
||||
Branch 54
|
||||
54: Label
|
||||
58: 13(int) Load 51
|
||||
Store 17(b) 58
|
||||
64: 63(ptr) AccessChain 22(ret) 62
|
||||
65: 6(float) Load 64
|
||||
67: 63(ptr) AccessChain 10(input) 66
|
||||
48: 45(bool) INotEqual 44 47
|
||||
SelectionMerge 50 None
|
||||
BranchConditional 48 49 52
|
||||
49: Label
|
||||
51: 13(int) Load 21(d)
|
||||
Store 19(c) 51
|
||||
Store 43 51
|
||||
Branch 50
|
||||
52: Label
|
||||
Store 43 53
|
||||
Branch 50
|
||||
50: Label
|
||||
54: 13(int) Load 43
|
||||
Store 15(a) 54
|
||||
Store 42(e) 54
|
||||
56: 13(int) Load 15(a)
|
||||
57: 45(bool) INotEqual 56 47
|
||||
SelectionMerge 59 None
|
||||
BranchConditional 57 58 61
|
||||
58: Label
|
||||
60: 13(int) Load 19(c)
|
||||
Store 21(d) 60
|
||||
Store 55 60
|
||||
Branch 59
|
||||
61: Label
|
||||
Store 55 62
|
||||
Branch 59
|
||||
59: Label
|
||||
63: 13(int) Load 55
|
||||
Store 17(b) 63
|
||||
67: 66(ptr) AccessChain 22(ret) 47
|
||||
68: 6(float) Load 67
|
||||
70: 69(bool) FOrdLessThan 65 68
|
||||
SelectionMerge 72 None
|
||||
BranchConditional 70 71 77
|
||||
71: Label
|
||||
73: 13(int) Load 19(c)
|
||||
74: 6(float) ConvertSToF 73
|
||||
75: 7(fvec4) Load 10(input)
|
||||
76: 7(fvec4) VectorTimesScalar 75 74
|
||||
Store 60 76
|
||||
Branch 72
|
||||
77: Label
|
||||
78: 13(int) Load 21(d)
|
||||
79: 6(float) ConvertSToF 78
|
||||
80: 7(fvec4) Load 10(input)
|
||||
81: 7(fvec4) VectorTimesScalar 80 79
|
||||
Store 60 81
|
||||
Branch 72
|
||||
72: Label
|
||||
82: 7(fvec4) Load 60
|
||||
Store 59(f) 82
|
||||
83: 13(int) Load 42(e)
|
||||
84: 6(float) ConvertSToF 83
|
||||
85: 7(fvec4) Load 22(ret)
|
||||
86: 7(fvec4) VectorTimesScalar 85 84
|
||||
87: 7(fvec4) Load 59(f)
|
||||
88: 7(fvec4) FAdd 86 87
|
||||
ReturnValue 88
|
||||
70: 66(ptr) AccessChain 10(input) 69
|
||||
71: 6(float) Load 70
|
||||
72: 45(bool) FOrdLessThan 68 71
|
||||
SelectionMerge 74 None
|
||||
BranchConditional 72 73 79
|
||||
73: Label
|
||||
75: 13(int) Load 19(c)
|
||||
76: 6(float) ConvertSToF 75
|
||||
77: 7(fvec4) Load 10(input)
|
||||
78: 7(fvec4) VectorTimesScalar 77 76
|
||||
Store 65 78
|
||||
Branch 74
|
||||
79: Label
|
||||
80: 13(int) Load 21(d)
|
||||
81: 6(float) ConvertSToF 80
|
||||
82: 7(fvec4) Load 10(input)
|
||||
83: 7(fvec4) VectorTimesScalar 82 81
|
||||
Store 65 83
|
||||
Branch 74
|
||||
74: Label
|
||||
84: 7(fvec4) Load 65
|
||||
Store 64(f) 84
|
||||
85: 13(int) Load 42(e)
|
||||
86: 6(float) ConvertSToF 85
|
||||
87: 7(fvec4) Load 22(ret)
|
||||
88: 7(fvec4) VectorTimesScalar 87 86
|
||||
89: 7(fvec4) Load 64(f)
|
||||
90: 7(fvec4) FAdd 88 89
|
||||
ReturnValue 90
|
||||
FunctionEnd
|
||||
|
||||
@ -25,10 +25,11 @@ gl_FragCoord origin is upper left
|
||||
0:9 2 (const int)
|
||||
0:10 Test condition and select ( temp void)
|
||||
0:10 Condition
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 Convert float to bool ( temp bool)
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 true case
|
||||
0:11 Branch: Kill
|
||||
0:12 Sequence
|
||||
@ -80,10 +81,11 @@ gl_FragCoord origin is upper left
|
||||
0:9 2 (const int)
|
||||
0:10 Test condition and select ( temp void)
|
||||
0:10 Condition
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 Convert float to bool ( temp bool)
|
||||
0:10 direct index ( temp float)
|
||||
0:10 'input' ( in 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 0 (const int)
|
||||
0:10 true case
|
||||
0:11 Branch: Kill
|
||||
0:12 Sequence
|
||||
@ -107,12 +109,12 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 48
|
||||
// Id's are bound by 50
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 43
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 45
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 10 "foo(f1;"
|
||||
@ -120,11 +122,11 @@ gl_FragCoord origin is upper left
|
||||
Name 16 "@PixelShaderFunction(vf4;"
|
||||
Name 15 "input"
|
||||
Name 25 "param"
|
||||
Name 37 "f"
|
||||
Name 41 "input"
|
||||
Name 39 "f"
|
||||
Name 43 "input"
|
||||
Name 45 "param"
|
||||
Decorate 43(input) Location 0
|
||||
Name 45 "input"
|
||||
Name 47 "param"
|
||||
Decorate 45(input) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@ -138,17 +140,18 @@ gl_FragCoord origin is upper left
|
||||
26: TypeInt 32 0
|
||||
27: 26(int) Constant 2
|
||||
31: 26(int) Constant 0
|
||||
42: TypePointer Input 12(fvec4)
|
||||
43(input): 42(ptr) Variable Input
|
||||
34: 6(float) Constant 0
|
||||
44: TypePointer Input 12(fvec4)
|
||||
45(input): 44(ptr) Variable Input
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
41(input): 13(ptr) Variable Function
|
||||
45(param): 13(ptr) Variable Function
|
||||
44: 12(fvec4) Load 43(input)
|
||||
Store 41(input) 44
|
||||
46: 12(fvec4) Load 41(input)
|
||||
Store 45(param) 46
|
||||
47: 2 FunctionCall 16(@PixelShaderFunction(vf4;) 45(param)
|
||||
43(input): 13(ptr) Variable Function
|
||||
47(param): 13(ptr) Variable Function
|
||||
46: 12(fvec4) Load 45(input)
|
||||
Store 43(input) 46
|
||||
48: 12(fvec4) Load 43(input)
|
||||
Store 47(param) 48
|
||||
49: 2 FunctionCall 16(@PixelShaderFunction(vf4;) 47(param)
|
||||
Return
|
||||
FunctionEnd
|
||||
10(foo(f1;): 2 Function None 8
|
||||
@ -167,20 +170,21 @@ gl_FragCoord origin is upper left
|
||||
15(input): 13(ptr) FunctionParameter
|
||||
17: Label
|
||||
25(param): 7(ptr) Variable Function
|
||||
37(f): 7(ptr) Variable Function
|
||||
39(f): 7(ptr) Variable Function
|
||||
28: 7(ptr) AccessChain 15(input) 27
|
||||
29: 6(float) Load 28
|
||||
Store 25(param) 29
|
||||
30: 2 FunctionCall 10(foo(f1;) 25(param)
|
||||
32: 7(ptr) AccessChain 15(input) 31
|
||||
33: 6(float) Load 32
|
||||
SelectionMerge 35 None
|
||||
BranchConditional 33 34 35
|
||||
34: Label
|
||||
35: 20(bool) FOrdNotEqual 33 34
|
||||
SelectionMerge 37 None
|
||||
BranchConditional 35 36 37
|
||||
36: Label
|
||||
Kill
|
||||
35: Label
|
||||
38: 7(ptr) AccessChain 15(input) 31
|
||||
39: 6(float) Load 38
|
||||
Store 37(f) 39
|
||||
37: Label
|
||||
40: 7(ptr) AccessChain 15(input) 31
|
||||
41: 6(float) Load 40
|
||||
Store 39(f) 41
|
||||
Kill
|
||||
FunctionEnd
|
||||
|
||||
@ -69,12 +69,13 @@ gl_FragCoord origin is upper left
|
||||
0:26 'input' ( in 4-component vector of float)
|
||||
0:30 Test condition and select ( temp void)
|
||||
0:30 Condition
|
||||
0:30 move second child to first child ( temp float)
|
||||
0:30 'ii' ( temp float)
|
||||
0:30 direct index ( temp float)
|
||||
0:30 'input' ( in 4-component vector of float)
|
||||
0:30 Constant:
|
||||
0:30 2 (const int)
|
||||
0:30 Convert float to bool ( temp bool)
|
||||
0:30 move second child to first child ( temp float)
|
||||
0:30 'ii' ( temp float)
|
||||
0:30 direct index ( temp float)
|
||||
0:30 'input' ( in 4-component vector of float)
|
||||
0:30 Constant:
|
||||
0:30 2 (const int)
|
||||
0:30 true case
|
||||
0:31 Pre-Increment ( temp float)
|
||||
0:31 'ii' ( temp float)
|
||||
@ -178,12 +179,13 @@ gl_FragCoord origin is upper left
|
||||
0:26 'input' ( in 4-component vector of float)
|
||||
0:30 Test condition and select ( temp void)
|
||||
0:30 Condition
|
||||
0:30 move second child to first child ( temp float)
|
||||
0:30 'ii' ( temp float)
|
||||
0:30 direct index ( temp float)
|
||||
0:30 'input' ( in 4-component vector of float)
|
||||
0:30 Constant:
|
||||
0:30 2 (const int)
|
||||
0:30 Convert float to bool ( temp bool)
|
||||
0:30 move second child to first child ( temp float)
|
||||
0:30 'ii' ( temp float)
|
||||
0:30 direct index ( temp float)
|
||||
0:30 'input' ( in 4-component vector of float)
|
||||
0:30 Constant:
|
||||
0:30 2 (const int)
|
||||
0:30 true case
|
||||
0:31 Pre-Increment ( temp float)
|
||||
0:31 'ii' ( temp float)
|
||||
@ -215,24 +217,24 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 101
|
||||
// Id's are bound by 103
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 94 97
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 96 99
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 11 "@PixelShaderFunction(vf4;"
|
||||
Name 10 "input"
|
||||
Name 68 "ii"
|
||||
Name 80 "ii"
|
||||
Name 92 "input"
|
||||
Name 82 "ii"
|
||||
Name 94 "input"
|
||||
Name 97 "@entryPointOutput"
|
||||
Name 98 "param"
|
||||
Decorate 94(input) Location 0
|
||||
Decorate 97(@entryPointOutput) Location 0
|
||||
Name 96 "input"
|
||||
Name 99 "@entryPointOutput"
|
||||
Name 100 "param"
|
||||
Decorate 96(input) Location 0
|
||||
Decorate 99(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@ -244,31 +246,32 @@ gl_FragCoord origin is upper left
|
||||
67: TypePointer Function 6(float)
|
||||
69: TypeInt 32 0
|
||||
70: 69(int) Constant 2
|
||||
76: 6(float) Constant 1065353216
|
||||
78: TypeInt 32 1
|
||||
79: TypePointer Function 78(int)
|
||||
82: 78(int) Constant 1
|
||||
93: TypePointer Input 7(fvec4)
|
||||
94(input): 93(ptr) Variable Input
|
||||
96: TypePointer Output 7(fvec4)
|
||||
97(@entryPointOutput): 96(ptr) Variable Output
|
||||
73: 6(float) Constant 0
|
||||
78: 6(float) Constant 1065353216
|
||||
80: TypeInt 32 1
|
||||
81: TypePointer Function 80(int)
|
||||
84: 80(int) Constant 1
|
||||
95: TypePointer Input 7(fvec4)
|
||||
96(input): 95(ptr) Variable Input
|
||||
98: TypePointer Output 7(fvec4)
|
||||
99(@entryPointOutput): 98(ptr) Variable Output
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
92(input): 8(ptr) Variable Function
|
||||
98(param): 8(ptr) Variable Function
|
||||
95: 7(fvec4) Load 94(input)
|
||||
Store 92(input) 95
|
||||
99: 7(fvec4) Load 92(input)
|
||||
Store 98(param) 99
|
||||
100: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 98(param)
|
||||
Store 97(@entryPointOutput) 100
|
||||
94(input): 8(ptr) Variable Function
|
||||
100(param): 8(ptr) Variable Function
|
||||
97: 7(fvec4) Load 96(input)
|
||||
Store 94(input) 97
|
||||
101: 7(fvec4) Load 94(input)
|
||||
Store 100(param) 101
|
||||
102: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 100(param)
|
||||
Store 99(@entryPointOutput) 102
|
||||
Return
|
||||
FunctionEnd
|
||||
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
|
||||
10(input): 8(ptr) FunctionParameter
|
||||
12: Label
|
||||
68(ii): 67(ptr) Variable Function
|
||||
80(ii): 79(ptr) Variable Function
|
||||
82(ii): 81(ptr) Variable Function
|
||||
13: 7(fvec4) Load 10(input)
|
||||
14: 7(fvec4) Load 10(input)
|
||||
17: 16(bvec4) FOrdEqual 13 14
|
||||
@ -338,28 +341,29 @@ gl_FragCoord origin is upper left
|
||||
71: 67(ptr) AccessChain 10(input) 70
|
||||
72: 6(float) Load 71
|
||||
Store 68(ii) 72
|
||||
SelectionMerge 74 None
|
||||
BranchConditional 72 73 74
|
||||
73: Label
|
||||
75: 6(float) Load 68(ii)
|
||||
77: 6(float) FAdd 75 76
|
||||
Store 68(ii) 77
|
||||
Branch 74
|
||||
74: Label
|
||||
81: 78(int) Load 80(ii)
|
||||
83: 78(int) IAdd 81 82
|
||||
Store 80(ii) 83
|
||||
84: 78(int) Load 80(ii)
|
||||
85: 6(float) ConvertSToF 84
|
||||
86: 15(bool) FOrdEqual 85 76
|
||||
SelectionMerge 88 None
|
||||
BranchConditional 86 87 88
|
||||
87: Label
|
||||
89: 78(int) Load 80(ii)
|
||||
90: 78(int) IAdd 89 82
|
||||
Store 80(ii) 90
|
||||
Branch 88
|
||||
88: Label
|
||||
91: 7(fvec4) Undef
|
||||
ReturnValue 91
|
||||
74: 15(bool) FOrdNotEqual 72 73
|
||||
SelectionMerge 76 None
|
||||
BranchConditional 74 75 76
|
||||
75: Label
|
||||
77: 6(float) Load 68(ii)
|
||||
79: 6(float) FAdd 77 78
|
||||
Store 68(ii) 79
|
||||
Branch 76
|
||||
76: Label
|
||||
83: 80(int) Load 82(ii)
|
||||
85: 80(int) IAdd 83 84
|
||||
Store 82(ii) 85
|
||||
86: 80(int) Load 82(ii)
|
||||
87: 6(float) ConvertSToF 86
|
||||
88: 15(bool) FOrdEqual 87 78
|
||||
SelectionMerge 90 None
|
||||
BranchConditional 88 89 90
|
||||
89: Label
|
||||
91: 80(int) Load 82(ii)
|
||||
92: 80(int) IAdd 91 84
|
||||
Store 82(ii) 92
|
||||
Branch 90
|
||||
90: Label
|
||||
93: 7(fvec4) Undef
|
||||
ReturnValue 93
|
||||
FunctionEnd
|
||||
|
||||
549
Test/baseResults/hlsl.implicitBool.frag.out
Executable file
549
Test/baseResults/hlsl.implicitBool.frag.out
Executable file
@ -0,0 +1,549 @@
|
||||
hlsl.implicitBool.frag
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:7 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:8 Sequence
|
||||
0:8 move second child to first child ( temp 4-component vector of float)
|
||||
0:8 'a' ( temp 4-component vector of float)
|
||||
0:? Constant:
|
||||
0:? 2.000000
|
||||
0:? 2.000000
|
||||
0:? 2.000000
|
||||
0:? 2.000000
|
||||
0:9 Test condition and select ( temp void)
|
||||
0:9 Condition
|
||||
0:9 Convert int to bool ( temp bool)
|
||||
0:9 condi: direct index for structure ( uniform int)
|
||||
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:9 Constant:
|
||||
0:9 1 (const uint)
|
||||
0:9 true case
|
||||
0:10 Branch: Return with expression
|
||||
0:10 add ( temp 4-component vector of float)
|
||||
0:10 'a' ( temp 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 1.000000
|
||||
0:11 Test condition and select ( temp void)
|
||||
0:11 Condition
|
||||
0:11 Convert float to bool ( temp bool)
|
||||
0:11 condf: direct index for structure ( uniform float)
|
||||
0:11 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:11 Constant:
|
||||
0:11 0 (const uint)
|
||||
0:11 true case
|
||||
0:12 Branch: Return with expression
|
||||
0:12 add ( temp 4-component vector of float)
|
||||
0:12 'a' ( temp 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 2.000000
|
||||
0:13 Test condition and select ( temp void)
|
||||
0:13 Condition
|
||||
0:13 Convert float to bool ( temp bool)
|
||||
0:13 condf1: direct index for structure ( uniform 1-component vector of float)
|
||||
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:13 Constant:
|
||||
0:13 2 (const uint)
|
||||
0:13 true case
|
||||
0:14 Branch: Return with expression
|
||||
0:14 add ( temp 4-component vector of float)
|
||||
0:14 'a' ( temp 4-component vector of float)
|
||||
0:14 Constant:
|
||||
0:14 3.000000
|
||||
0:15 Test condition and select ( temp void)
|
||||
0:15 Condition
|
||||
0:15 Convert int to bool ( temp bool)
|
||||
0:15 condi1: direct index for structure ( uniform 1-component vector of int)
|
||||
0:15 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:15 Constant:
|
||||
0:15 3 (const uint)
|
||||
0:15 true case
|
||||
0:16 Branch: Return with expression
|
||||
0:16 add ( temp 4-component vector of float)
|
||||
0:16 'a' ( temp 4-component vector of float)
|
||||
0:16 Constant:
|
||||
0:16 4.000000
|
||||
0:17 Test condition and select ( temp void)
|
||||
0:17 Condition
|
||||
0:17 logical-or ( temp bool)
|
||||
0:17 logical-and ( temp bool)
|
||||
0:17 Convert int to bool ( temp bool)
|
||||
0:17 condi: direct index for structure ( uniform int)
|
||||
0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:17 Constant:
|
||||
0:17 1 (const uint)
|
||||
0:17 Convert int to bool ( temp bool)
|
||||
0:17 Convert float to int ( temp int)
|
||||
0:17 condf: direct index for structure ( uniform float)
|
||||
0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:17 Constant:
|
||||
0:17 0 (const uint)
|
||||
0:17 Convert float to bool ( temp bool)
|
||||
0:17 condf1: direct index for structure ( uniform 1-component vector of float)
|
||||
0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:17 Constant:
|
||||
0:17 2 (const uint)
|
||||
0:17 true case
|
||||
0:18 Branch: Return with expression
|
||||
0:18 add ( temp 4-component vector of float)
|
||||
0:18 'a' ( temp 4-component vector of float)
|
||||
0:18 Constant:
|
||||
0:18 5.000000
|
||||
0:20 Sequence
|
||||
0:20 move second child to first child ( temp float)
|
||||
0:20 'f' ( temp float)
|
||||
0:20 condf: direct index for structure ( uniform float)
|
||||
0:20 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:20 Constant:
|
||||
0:20 0 (const uint)
|
||||
0:21 Loop with condition tested first
|
||||
0:21 Loop Condition
|
||||
0:21 Convert float to bool ( temp bool)
|
||||
0:21 'f' ( temp float)
|
||||
0:21 Loop Body
|
||||
0:? Sequence
|
||||
0:21 Pre-Decrement ( temp float)
|
||||
0:21 'f' ( temp float)
|
||||
0:23 Sequence
|
||||
0:23 move second child to first child ( temp int)
|
||||
0:23 'i' ( temp int)
|
||||
0:23 condi: direct index for structure ( uniform int)
|
||||
0:23 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:23 Constant:
|
||||
0:23 1 (const uint)
|
||||
0:24 Loop with condition not tested first
|
||||
0:24 Loop Condition
|
||||
0:24 Convert int to bool ( temp bool)
|
||||
0:24 'i' ( temp int)
|
||||
0:24 Loop Body
|
||||
0:24 Pre-Decrement ( temp int)
|
||||
0:24 'i' ( temp int)
|
||||
0:? Sequence
|
||||
0:26 Loop with condition tested first
|
||||
0:26 Loop Condition
|
||||
0:26 Convert int to bool ( temp bool)
|
||||
0:26 'i' ( temp int)
|
||||
0:26 Loop Body
|
||||
0:? Sequence
|
||||
0:26 Pre-Decrement ( temp int)
|
||||
0:26 'i' ( temp int)
|
||||
0:28 Sequence
|
||||
0:28 move second child to first child ( temp float)
|
||||
0:28 'g' ( temp float)
|
||||
0:28 Test condition and select ( temp float)
|
||||
0:28 Condition
|
||||
0:28 Convert float to bool ( temp bool)
|
||||
0:28 condf: direct index for structure ( uniform float)
|
||||
0:28 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:28 Constant:
|
||||
0:28 0 (const uint)
|
||||
0:28 true case
|
||||
0:28 Constant:
|
||||
0:28 7.000000
|
||||
0:28 false case
|
||||
0:28 Constant:
|
||||
0:28 8.000000
|
||||
0:29 add second child into first child ( temp 4-component vector of float)
|
||||
0:29 'a' ( temp 4-component vector of float)
|
||||
0:29 'g' ( temp float)
|
||||
0:31 Branch: Return with expression
|
||||
0:31 subtract ( temp 4-component vector of float)
|
||||
0:31 'a' ( temp 4-component vector of float)
|
||||
0:31 Constant:
|
||||
0:31 1.000000
|
||||
0:7 Function Definition: main( ( temp void)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:7 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:7 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:8 Sequence
|
||||
0:8 move second child to first child ( temp 4-component vector of float)
|
||||
0:8 'a' ( temp 4-component vector of float)
|
||||
0:? Constant:
|
||||
0:? 2.000000
|
||||
0:? 2.000000
|
||||
0:? 2.000000
|
||||
0:? 2.000000
|
||||
0:9 Test condition and select ( temp void)
|
||||
0:9 Condition
|
||||
0:9 Convert int to bool ( temp bool)
|
||||
0:9 condi: direct index for structure ( uniform int)
|
||||
0:9 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:9 Constant:
|
||||
0:9 1 (const uint)
|
||||
0:9 true case
|
||||
0:10 Branch: Return with expression
|
||||
0:10 add ( temp 4-component vector of float)
|
||||
0:10 'a' ( temp 4-component vector of float)
|
||||
0:10 Constant:
|
||||
0:10 1.000000
|
||||
0:11 Test condition and select ( temp void)
|
||||
0:11 Condition
|
||||
0:11 Convert float to bool ( temp bool)
|
||||
0:11 condf: direct index for structure ( uniform float)
|
||||
0:11 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:11 Constant:
|
||||
0:11 0 (const uint)
|
||||
0:11 true case
|
||||
0:12 Branch: Return with expression
|
||||
0:12 add ( temp 4-component vector of float)
|
||||
0:12 'a' ( temp 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 2.000000
|
||||
0:13 Test condition and select ( temp void)
|
||||
0:13 Condition
|
||||
0:13 Convert float to bool ( temp bool)
|
||||
0:13 condf1: direct index for structure ( uniform 1-component vector of float)
|
||||
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:13 Constant:
|
||||
0:13 2 (const uint)
|
||||
0:13 true case
|
||||
0:14 Branch: Return with expression
|
||||
0:14 add ( temp 4-component vector of float)
|
||||
0:14 'a' ( temp 4-component vector of float)
|
||||
0:14 Constant:
|
||||
0:14 3.000000
|
||||
0:15 Test condition and select ( temp void)
|
||||
0:15 Condition
|
||||
0:15 Convert int to bool ( temp bool)
|
||||
0:15 condi1: direct index for structure ( uniform 1-component vector of int)
|
||||
0:15 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:15 Constant:
|
||||
0:15 3 (const uint)
|
||||
0:15 true case
|
||||
0:16 Branch: Return with expression
|
||||
0:16 add ( temp 4-component vector of float)
|
||||
0:16 'a' ( temp 4-component vector of float)
|
||||
0:16 Constant:
|
||||
0:16 4.000000
|
||||
0:17 Test condition and select ( temp void)
|
||||
0:17 Condition
|
||||
0:17 logical-or ( temp bool)
|
||||
0:17 logical-and ( temp bool)
|
||||
0:17 Convert int to bool ( temp bool)
|
||||
0:17 condi: direct index for structure ( uniform int)
|
||||
0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:17 Constant:
|
||||
0:17 1 (const uint)
|
||||
0:17 Convert int to bool ( temp bool)
|
||||
0:17 Convert float to int ( temp int)
|
||||
0:17 condf: direct index for structure ( uniform float)
|
||||
0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:17 Constant:
|
||||
0:17 0 (const uint)
|
||||
0:17 Convert float to bool ( temp bool)
|
||||
0:17 condf1: direct index for structure ( uniform 1-component vector of float)
|
||||
0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:17 Constant:
|
||||
0:17 2 (const uint)
|
||||
0:17 true case
|
||||
0:18 Branch: Return with expression
|
||||
0:18 add ( temp 4-component vector of float)
|
||||
0:18 'a' ( temp 4-component vector of float)
|
||||
0:18 Constant:
|
||||
0:18 5.000000
|
||||
0:20 Sequence
|
||||
0:20 move second child to first child ( temp float)
|
||||
0:20 'f' ( temp float)
|
||||
0:20 condf: direct index for structure ( uniform float)
|
||||
0:20 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:20 Constant:
|
||||
0:20 0 (const uint)
|
||||
0:21 Loop with condition tested first
|
||||
0:21 Loop Condition
|
||||
0:21 Convert float to bool ( temp bool)
|
||||
0:21 'f' ( temp float)
|
||||
0:21 Loop Body
|
||||
0:? Sequence
|
||||
0:21 Pre-Decrement ( temp float)
|
||||
0:21 'f' ( temp float)
|
||||
0:23 Sequence
|
||||
0:23 move second child to first child ( temp int)
|
||||
0:23 'i' ( temp int)
|
||||
0:23 condi: direct index for structure ( uniform int)
|
||||
0:23 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:23 Constant:
|
||||
0:23 1 (const uint)
|
||||
0:24 Loop with condition not tested first
|
||||
0:24 Loop Condition
|
||||
0:24 Convert int to bool ( temp bool)
|
||||
0:24 'i' ( temp int)
|
||||
0:24 Loop Body
|
||||
0:24 Pre-Decrement ( temp int)
|
||||
0:24 'i' ( temp int)
|
||||
0:? Sequence
|
||||
0:26 Loop with condition tested first
|
||||
0:26 Loop Condition
|
||||
0:26 Convert int to bool ( temp bool)
|
||||
0:26 'i' ( temp int)
|
||||
0:26 Loop Body
|
||||
0:? Sequence
|
||||
0:26 Pre-Decrement ( temp int)
|
||||
0:26 'i' ( temp int)
|
||||
0:28 Sequence
|
||||
0:28 move second child to first child ( temp float)
|
||||
0:28 'g' ( temp float)
|
||||
0:28 Test condition and select ( temp float)
|
||||
0:28 Condition
|
||||
0:28 Convert float to bool ( temp bool)
|
||||
0:28 condf: direct index for structure ( uniform float)
|
||||
0:28 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:28 Constant:
|
||||
0:28 0 (const uint)
|
||||
0:28 true case
|
||||
0:28 Constant:
|
||||
0:28 7.000000
|
||||
0:28 false case
|
||||
0:28 Constant:
|
||||
0:28 8.000000
|
||||
0:29 add second child into first child ( temp 4-component vector of float)
|
||||
0:29 'a' ( temp 4-component vector of float)
|
||||
0:29 'g' ( temp float)
|
||||
0:31 Branch: Return with expression
|
||||
0:31 subtract ( temp 4-component vector of float)
|
||||
0:31 'a' ( temp 4-component vector of float)
|
||||
0:31 Constant:
|
||||
0:31 1.000000
|
||||
0:7 Function Definition: main( ( temp void)
|
||||
0:7 Function Parameters:
|
||||
0:? Sequence
|
||||
0:7 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:7 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 145
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 143
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "main"
|
||||
Name 9 "@main("
|
||||
Name 12 "a"
|
||||
Name 16 "$Global"
|
||||
MemberName 16($Global) 0 "condf"
|
||||
MemberName 16($Global) 1 "condi"
|
||||
MemberName 16($Global) 2 "condf1"
|
||||
MemberName 16($Global) 3 "condi1"
|
||||
Name 18 ""
|
||||
Name 93 "f"
|
||||
Name 106 "i"
|
||||
Name 126 "g"
|
||||
Name 143 "@entryPointOutput"
|
||||
MemberDecorate 16($Global) 0 Offset 0
|
||||
MemberDecorate 16($Global) 1 Offset 4
|
||||
MemberDecorate 16($Global) 2 Offset 16
|
||||
MemberDecorate 16($Global) 3 Offset 32
|
||||
Decorate 16($Global) Block
|
||||
Decorate 18 DescriptorSet 0
|
||||
Decorate 143(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypeFunction 7(fvec4)
|
||||
11: TypePointer Function 7(fvec4)
|
||||
13: 6(float) Constant 1073741824
|
||||
14: 7(fvec4) ConstantComposite 13 13 13 13
|
||||
15: TypeInt 32 1
|
||||
16($Global): TypeStruct 6(float) 15(int) 6(float) 15(int)
|
||||
17: TypePointer Uniform 16($Global)
|
||||
18: 17(ptr) Variable Uniform
|
||||
19: 15(int) Constant 1
|
||||
20: TypePointer Uniform 15(int)
|
||||
23: TypeBool
|
||||
24: TypeInt 32 0
|
||||
25: 24(int) Constant 0
|
||||
30: 6(float) Constant 1065353216
|
||||
34: 15(int) Constant 0
|
||||
35: TypePointer Uniform 6(float)
|
||||
38: 6(float) Constant 0
|
||||
46: 15(int) Constant 2
|
||||
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
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
144: 7(fvec4) FunctionCall 9(@main()
|
||||
Store 143(@entryPointOutput) 144
|
||||
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
|
||||
Store 12(a) 14
|
||||
21: 20(ptr) AccessChain 18 19
|
||||
22: 15(int) Load 21
|
||||
26: 23(bool) INotEqual 22 25
|
||||
SelectionMerge 28 None
|
||||
BranchConditional 26 27 28
|
||||
27: Label
|
||||
29: 7(fvec4) Load 12(a)
|
||||
31: 7(fvec4) CompositeConstruct 30 30 30 30
|
||||
32: 7(fvec4) FAdd 29 31
|
||||
ReturnValue 32
|
||||
28: Label
|
||||
36: 35(ptr) AccessChain 18 34
|
||||
37: 6(float) Load 36
|
||||
39: 23(bool) FOrdNotEqual 37 38
|
||||
SelectionMerge 41 None
|
||||
BranchConditional 39 40 41
|
||||
40: Label
|
||||
42: 7(fvec4) Load 12(a)
|
||||
43: 7(fvec4) CompositeConstruct 13 13 13 13
|
||||
44: 7(fvec4) FAdd 42 43
|
||||
ReturnValue 44
|
||||
41: Label
|
||||
47: 35(ptr) AccessChain 18 46
|
||||
48: 6(float) Load 47
|
||||
49: 23(bool) FOrdNotEqual 48 38
|
||||
SelectionMerge 51 None
|
||||
BranchConditional 49 50 51
|
||||
50: Label
|
||||
52: 7(fvec4) Load 12(a)
|
||||
54: 7(fvec4) CompositeConstruct 53 53 53 53
|
||||
55: 7(fvec4) FAdd 52 54
|
||||
ReturnValue 55
|
||||
51: Label
|
||||
58: 20(ptr) AccessChain 18 57
|
||||
59: 15(int) Load 58
|
||||
60: 23(bool) INotEqual 59 25
|
||||
SelectionMerge 62 None
|
||||
BranchConditional 60 61 62
|
||||
61: Label
|
||||
63: 7(fvec4) Load 12(a)
|
||||
65: 7(fvec4) CompositeConstruct 64 64 64 64
|
||||
66: 7(fvec4) FAdd 63 65
|
||||
ReturnValue 66
|
||||
62: Label
|
||||
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
|
||||
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
|
||||
FunctionEnd
|
||||
@ -31,17 +31,19 @@ gl_FragCoord origin is upper left
|
||||
0:17 3 (const uint)
|
||||
0:19 Test condition and select ( temp void)
|
||||
0:19 Condition
|
||||
0:19 ival: direct index for structure ( uniform int)
|
||||
0:19 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:19 Constant:
|
||||
0:19 0 (const uint)
|
||||
0:19 Convert int to bool ( temp bool)
|
||||
0:19 ival: direct index for structure ( uniform int)
|
||||
0:19 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:19 Constant:
|
||||
0:19 0 (const uint)
|
||||
0:19 true case is null
|
||||
0:20 Test condition and select ( temp void)
|
||||
0:20 Condition
|
||||
0:20 fval: direct index for structure ( uniform float)
|
||||
0:20 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:20 Constant:
|
||||
0:20 2 (const uint)
|
||||
0:20 Convert float to bool ( temp bool)
|
||||
0:20 fval: direct index for structure ( uniform float)
|
||||
0:20 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:20 Constant:
|
||||
0:20 2 (const uint)
|
||||
0:20 true case is null
|
||||
0:21 Test condition and select ( temp void)
|
||||
0:21 Condition
|
||||
@ -123,17 +125,19 @@ gl_FragCoord origin is upper left
|
||||
0:17 3 (const uint)
|
||||
0:19 Test condition and select ( temp void)
|
||||
0:19 Condition
|
||||
0:19 ival: direct index for structure ( uniform int)
|
||||
0:19 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:19 Constant:
|
||||
0:19 0 (const uint)
|
||||
0:19 Convert int to bool ( temp bool)
|
||||
0:19 ival: direct index for structure ( uniform int)
|
||||
0:19 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:19 Constant:
|
||||
0:19 0 (const uint)
|
||||
0:19 true case is null
|
||||
0:20 Test condition and select ( temp void)
|
||||
0:20 Condition
|
||||
0:20 fval: direct index for structure ( uniform float)
|
||||
0:20 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:20 Constant:
|
||||
0:20 2 (const uint)
|
||||
0:20 Convert float to bool ( temp bool)
|
||||
0:20 fval: direct index for structure ( uniform float)
|
||||
0:20 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
|
||||
0:20 Constant:
|
||||
0:20 2 (const uint)
|
||||
0:20 true case is null
|
||||
0:21 Test condition and select ( temp void)
|
||||
0:21 Condition
|
||||
@ -181,12 +185,12 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 82
|
||||
// Id's are bound by 84
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 79
|
||||
EntryPoint Fragment 4 "main" 81
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "main"
|
||||
Name 8 "PS_OUTPUT"
|
||||
@ -198,15 +202,15 @@ gl_FragCoord origin is upper left
|
||||
MemberName 14($Global) 2 "fval"
|
||||
MemberName 14($Global) 3 "fval4"
|
||||
Name 16 ""
|
||||
Name 70 "psout"
|
||||
Name 79 "Color"
|
||||
Name 72 "psout"
|
||||
Name 81 "Color"
|
||||
MemberDecorate 14($Global) 0 Offset 0
|
||||
MemberDecorate 14($Global) 1 Offset 16
|
||||
MemberDecorate 14($Global) 2 Offset 32
|
||||
MemberDecorate 14($Global) 3 Offset 48
|
||||
Decorate 14($Global) Block
|
||||
Decorate 16 DescriptorSet 0
|
||||
Decorate 79(Color) Location 0
|
||||
Decorate 81(Color) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@ -234,22 +238,22 @@ gl_FragCoord origin is upper left
|
||||
42: 12(int) Constant 3
|
||||
43: TypePointer Uniform 7(fvec4)
|
||||
46: 7(fvec4) ConstantComposite 39 39 39 39
|
||||
69: TypePointer Function 8(PS_OUTPUT)
|
||||
71: 6(float) Constant 1065353216
|
||||
72: 7(fvec4) ConstantComposite 71 71 71 71
|
||||
73: TypePointer Function 7(fvec4)
|
||||
78: TypePointer Output 7(fvec4)
|
||||
79(Color): 78(ptr) Variable Output
|
||||
71: TypePointer Function 8(PS_OUTPUT)
|
||||
73: 6(float) Constant 1065353216
|
||||
74: 7(fvec4) ConstantComposite 73 73 73 73
|
||||
75: TypePointer Function 7(fvec4)
|
||||
80: TypePointer Output 7(fvec4)
|
||||
81(Color): 80(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
80:8(PS_OUTPUT) FunctionCall 10(@main()
|
||||
81: 7(fvec4) CompositeExtract 80 0
|
||||
Store 79(Color) 81
|
||||
82:8(PS_OUTPUT) FunctionCall 10(@main()
|
||||
83: 7(fvec4) CompositeExtract 82 0
|
||||
Store 81(Color) 83
|
||||
Return
|
||||
FunctionEnd
|
||||
10(@main():8(PS_OUTPUT) Function None 9
|
||||
11: Label
|
||||
70(psout): 69(ptr) Variable Function
|
||||
72(psout): 71(ptr) Variable Function
|
||||
19: 18(ptr) AccessChain 16 17
|
||||
20: 12(int) Load 19
|
||||
24: 21(bool) INotEqual 20 23
|
||||
@ -268,38 +272,40 @@ gl_FragCoord origin is upper left
|
||||
48: 30(bvec4) LogicalNot 47
|
||||
49: 18(ptr) AccessChain 16 17
|
||||
50: 12(int) Load 49
|
||||
SelectionMerge 52 None
|
||||
BranchConditional 50 51 52
|
||||
51: Label
|
||||
Branch 52
|
||||
52: Label
|
||||
53: 36(ptr) AccessChain 16 35
|
||||
54: 6(float) Load 53
|
||||
SelectionMerge 56 None
|
||||
BranchConditional 54 55 56
|
||||
55: Label
|
||||
Branch 56
|
||||
56: Label
|
||||
57: 18(ptr) AccessChain 16 17
|
||||
58: 12(int) Load 57
|
||||
59: 21(bool) INotEqual 58 23
|
||||
60: 21(bool) LogicalNot 59
|
||||
SelectionMerge 62 None
|
||||
BranchConditional 60 61 62
|
||||
61: Label
|
||||
Branch 62
|
||||
62: Label
|
||||
63: 36(ptr) AccessChain 16 35
|
||||
64: 6(float) Load 63
|
||||
65: 21(bool) FOrdNotEqual 64 39
|
||||
66: 21(bool) LogicalNot 65
|
||||
SelectionMerge 68 None
|
||||
BranchConditional 66 67 68
|
||||
67: Label
|
||||
Branch 68
|
||||
68: Label
|
||||
74: 73(ptr) AccessChain 70(psout) 17
|
||||
Store 74 72
|
||||
75:8(PS_OUTPUT) Load 70(psout)
|
||||
ReturnValue 75
|
||||
51: 21(bool) INotEqual 50 23
|
||||
SelectionMerge 53 None
|
||||
BranchConditional 51 52 53
|
||||
52: Label
|
||||
Branch 53
|
||||
53: Label
|
||||
54: 36(ptr) AccessChain 16 35
|
||||
55: 6(float) Load 54
|
||||
56: 21(bool) FOrdNotEqual 55 39
|
||||
SelectionMerge 58 None
|
||||
BranchConditional 56 57 58
|
||||
57: Label
|
||||
Branch 58
|
||||
58: Label
|
||||
59: 18(ptr) AccessChain 16 17
|
||||
60: 12(int) Load 59
|
||||
61: 21(bool) INotEqual 60 23
|
||||
62: 21(bool) LogicalNot 61
|
||||
SelectionMerge 64 None
|
||||
BranchConditional 62 63 64
|
||||
63: Label
|
||||
Branch 64
|
||||
64: Label
|
||||
65: 36(ptr) AccessChain 16 35
|
||||
66: 6(float) Load 65
|
||||
67: 21(bool) FOrdNotEqual 66 39
|
||||
68: 21(bool) LogicalNot 67
|
||||
SelectionMerge 70 None
|
||||
BranchConditional 68 69 70
|
||||
69: Label
|
||||
Branch 70
|
||||
70: Label
|
||||
76: 75(ptr) AccessChain 72(psout) 17
|
||||
Store 76 74
|
||||
77:8(PS_OUTPUT) Load 72(psout)
|
||||
ReturnValue 77
|
||||
FunctionEnd
|
||||
|
||||
32
Test/hlsl.implicitBool.frag
Executable file
32
Test/hlsl.implicitBool.frag
Executable file
@ -0,0 +1,32 @@
|
||||
float condf;
|
||||
int condi;
|
||||
float1 condf1;
|
||||
int1 condi1;
|
||||
|
||||
float4 main() : SV_Target0
|
||||
{
|
||||
float4 a = float4(2.0, 2.0, 2.0, 2.0);
|
||||
if (condi)
|
||||
return a + 1.0;
|
||||
if (condf)
|
||||
return a + 2.0;
|
||||
if (condf1)
|
||||
return a + 3.0;
|
||||
if (condi1)
|
||||
return a + 4.0;
|
||||
if (condi && condf || condf1)
|
||||
return a + 5.0;
|
||||
|
||||
float f = condf;
|
||||
while (f) { --f; }
|
||||
|
||||
int i = condi;
|
||||
do { --i; } while (i);
|
||||
|
||||
for (; i; ) { --i; }
|
||||
|
||||
float g = condf ? 7.0 : 8.0;
|
||||
a += g;
|
||||
|
||||
return a - 1.0;
|
||||
}
|
||||
@ -2,5 +2,5 @@
|
||||
// For the version, it uses the latest git tag followed by the number of commits.
|
||||
// For the date, it uses the current date (when then script is run).
|
||||
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1946"
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1947"
|
||||
#define GLSLANG_DATE "30-Mar-2017"
|
||||
|
||||
@ -127,6 +127,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
{"hlsl.hull.void.tesc", "main"},
|
||||
{"hlsl.identifier.sample.frag", "main"},
|
||||
{"hlsl.if.frag", "PixelShaderFunction"},
|
||||
{"hlsl.implicitBool.frag", "main"},
|
||||
{"hlsl.inoutquals.frag", "main"},
|
||||
{"hlsl.init.frag", "ShaderFunction"},
|
||||
{"hlsl.init2.frag", "main"},
|
||||
|
||||
@ -2527,6 +2527,10 @@ bool HlslGrammar::acceptConditionalExpression(TIntermTyped*& node)
|
||||
if (! acceptTokenClass(EHTokQuestion))
|
||||
return true;
|
||||
|
||||
node = parseContext.convertConditionalExpression(token.loc, node);
|
||||
if (node == nullptr)
|
||||
return false;
|
||||
|
||||
TIntermTyped* trueNode = nullptr;
|
||||
if (! acceptExpression(trueNode)) {
|
||||
expected("expression after ?");
|
||||
@ -3197,6 +3201,9 @@ bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement)
|
||||
TIntermTyped* condition;
|
||||
if (! acceptParenExpression(condition))
|
||||
return false;
|
||||
condition = parseContext.convertConditionalExpression(loc, condition);
|
||||
if (condition == nullptr)
|
||||
return false;
|
||||
|
||||
// create the child statements
|
||||
TIntermNodePair thenElse = { nullptr, nullptr };
|
||||
@ -3280,6 +3287,9 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
|
||||
// LEFT_PAREN condition RIGHT_PAREN
|
||||
if (! acceptParenExpression(condition))
|
||||
return false;
|
||||
condition = parseContext.convertConditionalExpression(loc, condition);
|
||||
if (condition == nullptr)
|
||||
return false;
|
||||
|
||||
// statement
|
||||
if (! acceptScopedStatement(statement)) {
|
||||
@ -3319,6 +3329,9 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
|
||||
TIntermTyped* condition;
|
||||
if (! acceptParenExpression(condition))
|
||||
return false;
|
||||
condition = parseContext.convertConditionalExpression(loc, condition);
|
||||
if (condition == nullptr)
|
||||
return false;
|
||||
|
||||
if (! acceptTokenClass(EHTokSemicolon))
|
||||
expected(";");
|
||||
@ -3356,6 +3369,11 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
|
||||
acceptExpression(condition);
|
||||
if (! acceptTokenClass(EHTokSemicolon))
|
||||
expected(";");
|
||||
if (condition != nullptr) {
|
||||
condition = parseContext.convertConditionalExpression(loc, condition);
|
||||
if (condition == nullptr)
|
||||
return false;
|
||||
}
|
||||
|
||||
// iterator SEMI_COLON
|
||||
TIntermTyped* iterator = nullptr;
|
||||
|
||||
@ -4285,6 +4285,18 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
|
||||
// report an error and return nullptr.
|
||||
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition)
|
||||
{
|
||||
if (!condition->getType().isScalarOrVec1()) {
|
||||
error(loc, "requires a scalar", "conditional expression", "");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return intermediate.addConversion(EOpConstructBool, TType(EbtBool), condition);
|
||||
}
|
||||
|
||||
//
|
||||
// Same error message for all places assignments don't work.
|
||||
//
|
||||
@ -4607,13 +4619,6 @@ bool HlslParseContext::voidErrorCheck(const TSourceLoc& loc, const TString& iden
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks to see if the node (for the expression) contains a scalar boolean expression or not
|
||||
void HlslParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type)
|
||||
{
|
||||
if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector())
|
||||
error(loc, "boolean expression expected", "", "");
|
||||
}
|
||||
|
||||
//
|
||||
// Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
|
||||
//
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
const glslang::TString* component);
|
||||
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
|
||||
int subComponent, const glslang::TString*);
|
||||
|
||||
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*);
|
||||
TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
|
||||
|
||||
bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);
|
||||
@ -120,7 +120,6 @@ public:
|
||||
void structArrayCheck(const TSourceLoc&, const TType& structure);
|
||||
void arrayDimMerge(TType& type, const TArraySizes* sizes);
|
||||
bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType);
|
||||
void boolCheck(const TSourceLoc&, const TIntermTyped*);
|
||||
void globalQualifierFix(const TSourceLoc&, TQualifier&);
|
||||
bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
|
||||
void mergeQualifiers(TQualifier& dst, const TQualifier& src);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user