Fix part of #2070: Correctly handle promotion for <unary-op>(int).

This still only handles a scalar correctly, and some
vector cases need additional fixes.
This commit is contained in:
John Kessenich 2020-02-11 06:23:48 -07:00
parent 113d07a6eb
commit abfc4c2ceb
6 changed files with 413 additions and 64 deletions

View file

@ -17,8 +17,13 @@ gl_FragCoord origin is upper left
0:7 'inF0' ( in 1-component vector of uint)
0:? Sequence
0:8 Branch: Return with expression
0:8 Constant:
0:8 0.000000
0:8 Construct float ( temp 1-component vector of float)
0:8 direct index ( temp float)
0:8 unpackHalf2x16 ( temp 2-component vector of float)
0:8 Construct uint ( in uint)
0:8 'inF0' ( in 1-component vector of uint)
0:8 Constant:
0:8 0 (const int)
0:12 Function Definition: PixelShaderFunction2(vu2; ( temp 2-component vector of float)
0:12 Function Parameters:
0:12 'inF0' ( in 2-component vector of uint)
@ -149,8 +154,13 @@ gl_FragCoord origin is upper left
0:7 'inF0' ( in 1-component vector of uint)
0:? Sequence
0:8 Branch: Return with expression
0:8 Constant:
0:8 0.000000
0:8 Construct float ( temp 1-component vector of float)
0:8 direct index ( temp float)
0:8 unpackHalf2x16 ( temp 2-component vector of float)
0:8 Construct uint ( in uint)
0:8 'inF0' ( in 1-component vector of uint)
0:8 Constant:
0:8 0 (const int)
0:12 Function Definition: PixelShaderFunction2(vu2; ( temp 2-component vector of float)
0:12 Function Parameters:
0:12 'inF0' ( in 2-component vector of uint)
@ -261,12 +271,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80008
// Id's are bound by 103
// Id's are bound by 106
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 101
EntryPoint Fragment 4 "main" 104
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@ -281,8 +291,8 @@ gl_FragCoord origin is upper left
Name 35 "PixelShaderFunction(vu4;"
Name 34 "inF0"
Name 38 "@main("
Name 101 "@entryPointOutput"
Decorate 101(@entryPointOutput) Location 0
Name 104 "@entryPointOutput"
Decorate 104(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -303,17 +313,17 @@ gl_FragCoord origin is upper left
33: TypeFunction 32(fvec4) 31(ptr)
37: TypeFunction 32(fvec4)
42: 6(int) Constant 0
46: 8(float) Constant 0
53: 6(int) Constant 1
69: 6(int) Constant 2
89: 6(int) Constant 3
97: 32(fvec4) ConstantComposite 46 46 46 46
100: TypePointer Output 32(fvec4)
101(@entryPointOutput): 100(ptr) Variable Output
55: 6(int) Constant 1
71: 6(int) Constant 2
91: 6(int) Constant 3
99: 8(float) Constant 0
100: 32(fvec4) ConstantComposite 99 99 99 99
103: TypePointer Output 32(fvec4)
104(@entryPointOutput): 103(ptr) Variable Output
4(main): 2 Function None 3
5: Label
102: 32(fvec4) FunctionCall 38(@main()
Store 101(@entryPointOutput) 102
105: 32(fvec4) FunctionCall 38(@main()
Store 104(@entryPointOutput) 105
Return
FunctionEnd
11(PixelShaderFunctionS(u1;): 8(float) Function None 9
@ -327,63 +337,66 @@ gl_FragCoord origin is upper left
14(PixelShaderFunction1(vu1;): 8(float) Function None 9
13(inF0): 7(ptr) FunctionParameter
15: Label
ReturnValue 46
46: 6(int) Load 13(inF0)
47: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 46
48: 8(float) CompositeExtract 47 0
ReturnValue 48
FunctionEnd
21(PixelShaderFunction2(vu2;): 18(fvec2) Function None 19
20(inF0): 17(ptr) FunctionParameter
22: Label
49: 7(ptr) AccessChain 20(inF0) 42
50: 6(int) Load 49
51: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 50
52: 8(float) CompositeExtract 51 0
54: 7(ptr) AccessChain 20(inF0) 53
55: 6(int) Load 54
56: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 55
57: 8(float) CompositeExtract 56 0
58: 18(fvec2) CompositeConstruct 52 57
ReturnValue 58
51: 7(ptr) AccessChain 20(inF0) 42
52: 6(int) Load 51
53: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 52
54: 8(float) CompositeExtract 53 0
56: 7(ptr) AccessChain 20(inF0) 55
57: 6(int) Load 56
58: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 57
59: 8(float) CompositeExtract 58 0
60: 18(fvec2) CompositeConstruct 54 59
ReturnValue 60
FunctionEnd
28(PixelShaderFunction3(vu3;): 25(fvec3) Function None 26
27(inF0): 24(ptr) FunctionParameter
29: Label
61: 7(ptr) AccessChain 27(inF0) 42
62: 6(int) Load 61
63: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 62
64: 8(float) CompositeExtract 63 0
65: 7(ptr) AccessChain 27(inF0) 53
66: 6(int) Load 65
67: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 66
68: 8(float) CompositeExtract 67 0
70: 7(ptr) AccessChain 27(inF0) 69
71: 6(int) Load 70
72: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 71
73: 8(float) CompositeExtract 72 0
74: 25(fvec3) CompositeConstruct 64 68 73
ReturnValue 74
63: 7(ptr) AccessChain 27(inF0) 42
64: 6(int) Load 63
65: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 64
66: 8(float) CompositeExtract 65 0
67: 7(ptr) AccessChain 27(inF0) 55
68: 6(int) Load 67
69: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 68
70: 8(float) CompositeExtract 69 0
72: 7(ptr) AccessChain 27(inF0) 71
73: 6(int) Load 72
74: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 73
75: 8(float) CompositeExtract 74 0
76: 25(fvec3) CompositeConstruct 66 70 75
ReturnValue 76
FunctionEnd
35(PixelShaderFunction(vu4;): 32(fvec4) Function None 33
34(inF0): 31(ptr) FunctionParameter
36: Label
77: 7(ptr) AccessChain 34(inF0) 42
78: 6(int) Load 77
79: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 78
80: 8(float) CompositeExtract 79 0
81: 7(ptr) AccessChain 34(inF0) 53
82: 6(int) Load 81
83: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 82
84: 8(float) CompositeExtract 83 0
85: 7(ptr) AccessChain 34(inF0) 69
86: 6(int) Load 85
87: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 86
88: 8(float) CompositeExtract 87 0
90: 7(ptr) AccessChain 34(inF0) 89
91: 6(int) Load 90
92: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 91
93: 8(float) CompositeExtract 92 0
94: 32(fvec4) CompositeConstruct 80 84 88 93
ReturnValue 94
79: 7(ptr) AccessChain 34(inF0) 42
80: 6(int) Load 79
81: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 80
82: 8(float) CompositeExtract 81 0
83: 7(ptr) AccessChain 34(inF0) 55
84: 6(int) Load 83
85: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 84
86: 8(float) CompositeExtract 85 0
87: 7(ptr) AccessChain 34(inF0) 71
88: 6(int) Load 87
89: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 88
90: 8(float) CompositeExtract 89 0
92: 7(ptr) AccessChain 34(inF0) 91
93: 6(int) Load 92
94: 18(fvec2) ExtInst 1(GLSL.std.450) 62(UnpackHalf2x16) 93
95: 8(float) CompositeExtract 94 0
96: 32(fvec4) CompositeConstruct 82 86 90 95
ReturnValue 96
FunctionEnd
38(@main(): 32(fvec4) Function None 37
39: Label
ReturnValue 97
ReturnValue 100
FunctionEnd