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

@@ -13,12 +13,11 @@ gl_FragCoord origin is upper left
0:13 '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:13 Constant:
0:13 0 (const uint)
0:13 Convert int to bool ( temp bool)
0:13 Convert float to int ( temp int)
0:13 fval: direct index for structure ( uniform float)
0:13 '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:13 Constant:
0:13 2 (const uint)
0:13 Convert float to bool ( temp bool)
0:13 fval: direct index for structure ( uniform float)
0:13 '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:13 Constant:
0:13 2 (const uint)
0:13 true case is null
0:14 Test condition and select ( temp void)
0:14 Condition
@@ -28,12 +27,11 @@ gl_FragCoord origin is upper left
0:14 '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:14 Constant:
0:14 0 (const uint)
0:14 Convert int to bool ( temp bool)
0:14 Convert float to int ( temp int)
0:14 fval: direct index for structure ( uniform float)
0:14 '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:14 Constant:
0:14 2 (const uint)
0:14 Convert float to bool ( temp bool)
0:14 fval: direct index for structure ( uniform float)
0:14 '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:14 Constant:
0:14 2 (const uint)
0:14 true case is null
0:17 move second child to first child ( temp 4-component vector of float)
0:17 Color: direct index for structure ( temp 4-component vector of float)
@@ -79,12 +77,11 @@ gl_FragCoord origin is upper left
0:13 '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:13 Constant:
0:13 0 (const uint)
0:13 Convert int to bool ( temp bool)
0:13 Convert float to int ( temp int)
0:13 fval: direct index for structure ( uniform float)
0:13 '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:13 Constant:
0:13 2 (const uint)
0:13 Convert float to bool ( temp bool)
0:13 fval: direct index for structure ( uniform float)
0:13 '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:13 Constant:
0:13 2 (const uint)
0:13 true case is null
0:14 Test condition and select ( temp void)
0:14 Condition
@@ -94,12 +91,11 @@ gl_FragCoord origin is upper left
0:14 '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:14 Constant:
0:14 0 (const uint)
0:14 Convert int to bool ( temp bool)
0:14 Convert float to int ( temp int)
0:14 fval: direct index for structure ( uniform float)
0:14 '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:14 Constant:
0:14 2 (const uint)
0:14 Convert float to bool ( temp bool)
0:14 fval: direct index for structure ( uniform float)
0:14 '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:14 Constant:
0:14 2 (const uint)
0:14 true case is null
0:17 move second child to first child ( temp 4-component vector of float)
0:17 Color: direct index for structure ( temp 4-component vector of float)
@@ -129,12 +125,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 57
// Id's are bound by 56
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 54
EntryPoint Fragment 4 "main" 53
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -147,15 +143,15 @@ gl_FragCoord origin is upper left
MemberName 14($Global) 2 "fval"
MemberName 14($Global) 3 "fval4"
Name 16 ""
Name 45 "psout"
Name 54 "@entryPointOutput.Color"
Name 44 "psout"
Name 53 "@entryPointOutput.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 54(@entryPointOutput.Color) Location 0
Decorate 53(@entryPointOutput.Color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -174,29 +170,29 @@ gl_FragCoord origin is upper left
23: 22(int) Constant 0
25: 12(int) Constant 2
26: TypePointer Uniform 6(float)
44: TypePointer Function 8(PS_OUTPUT)
46: 6(float) Constant 1065353216
47: 7(fvec4) ConstantComposite 46 46 46 46
48: TypePointer Function 7(fvec4)
53: TypePointer Output 7(fvec4)
54(@entryPointOutput.Color): 53(ptr) Variable Output
29: 6(float) Constant 0
43: TypePointer Function 8(PS_OUTPUT)
45: 6(float) Constant 1065353216
46: 7(fvec4) ConstantComposite 45 45 45 45
47: TypePointer Function 7(fvec4)
52: TypePointer Output 7(fvec4)
53(@entryPointOutput.Color): 52(ptr) Variable Output
4(main): 2 Function None 3
5: Label
55:8(PS_OUTPUT) FunctionCall 10(@main()
56: 7(fvec4) CompositeExtract 55 0
Store 54(@entryPointOutput.Color) 56
54:8(PS_OUTPUT) FunctionCall 10(@main()
55: 7(fvec4) CompositeExtract 54 0
Store 53(@entryPointOutput.Color) 55
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
45(psout): 44(ptr) Variable Function
44(psout): 43(ptr) Variable Function
19: 18(ptr) AccessChain 16 17
20: 12(int) Load 19
24: 21(bool) INotEqual 20 23
27: 26(ptr) AccessChain 16 25
28: 6(float) Load 27
29: 12(int) ConvertFToS 28
30: 21(bool) INotEqual 29 23
30: 21(bool) FOrdNotEqual 28 29
31: 21(bool) LogicalAnd 24 30
SelectionMerge 33 None
BranchConditional 31 32 33
@@ -208,16 +204,15 @@ gl_FragCoord origin is upper left
36: 21(bool) INotEqual 35 23
37: 26(ptr) AccessChain 16 25
38: 6(float) Load 37
39: 12(int) ConvertFToS 38
40: 21(bool) INotEqual 39 23
41: 21(bool) LogicalOr 36 40
SelectionMerge 43 None
BranchConditional 41 42 43
42: Label
Branch 43
43: Label
49: 48(ptr) AccessChain 45(psout) 17
Store 49 47
50:8(PS_OUTPUT) Load 45(psout)
ReturnValue 50
39: 21(bool) FOrdNotEqual 38 29
40: 21(bool) LogicalOr 36 39
SelectionMerge 42 None
BranchConditional 40 41 42
41: Label
Branch 42
42: Label
48: 47(ptr) AccessChain 44(psout) 17
Store 48 46
49:8(PS_OUTPUT) Load 44(psout)
ReturnValue 49
FunctionEnd