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:
John Kessenich
2017-03-30 22:09:30 -06:00
parent 8f9fdc986a
commit 7e997e2612
12 changed files with 887 additions and 263 deletions

View File

@@ -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