AST: Remove convertToBasicType() which was obfuscating the conversion design.

Reinforces that conversion rules are operation-specific.
Side effect is that HLSL logical-operator conversions are more direct
(e.g. float -> bool, rather than float -> int -> bool).
This commit is contained in:
John Kessenich 2018-03-15 19:14:47 -06:00
parent 2ad4737dc2
commit 137a24dffa
4 changed files with 315 additions and 329 deletions

View file

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