summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
index a22313141..016bccd39 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
@@ -1,4 +1,3 @@
1
2// Copyright 2021 yuzu Emulator Project 1// Copyright 2021 yuzu Emulator Project
3// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
4// Refer to the license.txt file included. 3// Refer to the license.txt file included.
@@ -48,7 +47,7 @@ void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& in
48 47
49void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 48void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
50 [[maybe_unused]] std::string_view value) { 49 [[maybe_unused]] std::string_view value) {
51 throw NotImplementedException("GLSL Instruction"); 50 ctx.AddU32("{}=abs({});", inst, value);
52} 51}
53 52
54void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 53void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -59,52 +58,52 @@ void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& in
59void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 58void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
60 [[maybe_unused]] std::string_view base, 59 [[maybe_unused]] std::string_view base,
61 [[maybe_unused]] std::string_view shift) { 60 [[maybe_unused]] std::string_view shift) {
62 throw NotImplementedException("GLSL Instruction"); 61 ctx.AddU32("{}={}<<{};", inst, base, shift);
63} 62}
64 63
65void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 64void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
66 [[maybe_unused]] std::string_view base, 65 [[maybe_unused]] std::string_view base,
67 [[maybe_unused]] std::string_view shift) { 66 [[maybe_unused]] std::string_view shift) {
68 throw NotImplementedException("GLSL Instruction"); 67 ctx.AddU64("{}={}<<{};", inst, base, shift);
69} 68}
70 69
71void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 70void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
72 [[maybe_unused]] std::string_view base, 71 [[maybe_unused]] std::string_view base,
73 [[maybe_unused]] std::string_view shift) { 72 [[maybe_unused]] std::string_view shift) {
74 throw NotImplementedException("GLSL Instruction"); 73 ctx.AddU32("{}={}>>{};", inst, base, shift);
75} 74}
76 75
77void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 76void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
78 [[maybe_unused]] std::string_view base, 77 [[maybe_unused]] std::string_view base,
79 [[maybe_unused]] std::string_view shift) { 78 [[maybe_unused]] std::string_view shift) {
80 throw NotImplementedException("GLSL Instruction"); 79 ctx.AddU64("{}={}>>{};", inst, base, shift);
81} 80}
82 81
83void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 82void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
84 [[maybe_unused]] std::string_view base, 83 [[maybe_unused]] std::string_view base,
85 [[maybe_unused]] std::string_view shift) { 84 [[maybe_unused]] std::string_view shift) {
86 throw NotImplementedException("GLSL Instruction"); 85 ctx.AddS32("{}=int({})>>{};", inst, base, shift);
87} 86}
88 87
89void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 88void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
90 [[maybe_unused]] std::string_view base, 89 [[maybe_unused]] std::string_view base,
91 [[maybe_unused]] std::string_view shift) { 90 [[maybe_unused]] std::string_view shift) {
92 throw NotImplementedException("GLSL Instruction"); 91 ctx.AddU64("{}=int64_t({})>>{};", inst, base, shift);
93} 92}
94 93
95void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 94void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
96 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 95 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
97 throw NotImplementedException("GLSL Instruction"); 96 ctx.AddU32("{}={}&{};", inst, a, b);
98} 97}
99 98
100void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 99void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
101 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 100 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
102 throw NotImplementedException("GLSL Instruction"); 101 ctx.AddU32("{}={}|{};", inst, a, b);
103} 102}
104 103
105void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 104void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
106 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 105 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
107 throw NotImplementedException("GLSL Instruction"); 106 ctx.AddU32("{}={}^{};", inst, a, b);
108} 107}
109 108
110void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 109void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -141,7 +140,7 @@ void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst
141 140
142void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 141void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
143 [[maybe_unused]] std::string_view value) { 142 [[maybe_unused]] std::string_view value) {
144 throw NotImplementedException("GLSL Instruction"); 143 ctx.AddU32("{}=~{};", inst, value);
145} 144}
146 145
147void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 146void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -156,22 +155,22 @@ void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst
156 155
157void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 156void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
158 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 157 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
159 throw NotImplementedException("GLSL Instruction"); 158 ctx.AddU32("{}=min(int({}), int({}));", inst, a, b);
160} 159}
161 160
162void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 161void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
163 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 162 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
164 throw NotImplementedException("GLSL Instruction"); 163 ctx.AddU32("{}=min(uint({}), uint({}));", inst, a, b);
165} 164}
166 165
167void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 166void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
168 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 167 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
169 throw NotImplementedException("GLSL Instruction"); 168 ctx.AddU32("{}=max(int({}), int({}));", inst, a, b);
170} 169}
171 170
172void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 171void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
173 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 172 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
174 throw NotImplementedException("GLSL Instruction"); 173 ctx.AddU32("{}=max(uint({}), uint({}));", inst, a, b);
175} 174}
176 175
177void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 176void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
@@ -188,57 +187,57 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst&
188 187
189void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 188void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
190 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 189 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
191 throw NotImplementedException("GLSL Instruction"); 190 ctx.AddU1("{}=int({})<int({});", inst, lhs, rhs);
192} 191}
193 192
194void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 193void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
195 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 194 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
196 throw NotImplementedException("GLSL Instruction"); 195 ctx.AddU1("{}=uint({})<uint({)};", inst, lhs, rhs);
197} 196}
198 197
199void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 198void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
200 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 199 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
201 throw NotImplementedException("GLSL Instruction"); 200 ctx.AddU1("{}={}=={};", inst, lhs, rhs);
202} 201}
203 202
204void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 203void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
205 [[maybe_unused]] std::string_view lhs, 204 [[maybe_unused]] std::string_view lhs,
206 [[maybe_unused]] std::string_view rhs) { 205 [[maybe_unused]] std::string_view rhs) {
207 throw NotImplementedException("GLSL Instruction"); 206 ctx.AddU1("{}=int({})<=int({});", inst, lhs, rhs);
208} 207}
209 208
210void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 209void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
211 [[maybe_unused]] std::string_view lhs, 210 [[maybe_unused]] std::string_view lhs,
212 [[maybe_unused]] std::string_view rhs) { 211 [[maybe_unused]] std::string_view rhs) {
213 throw NotImplementedException("GLSL Instruction"); 212 ctx.AddU1("{}=uint({})<=uint({});", inst, lhs, rhs);
214} 213}
215 214
216void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 215void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
217 [[maybe_unused]] std::string_view lhs, 216 [[maybe_unused]] std::string_view lhs,
218 [[maybe_unused]] std::string_view rhs) { 217 [[maybe_unused]] std::string_view rhs) {
219 throw NotImplementedException("GLSL Instruction"); 218 ctx.AddU1("{}=int({})>int({});", inst, lhs, rhs);
220} 219}
221 220
222void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 221void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
223 [[maybe_unused]] std::string_view lhs, 222 [[maybe_unused]] std::string_view lhs,
224 [[maybe_unused]] std::string_view rhs) { 223 [[maybe_unused]] std::string_view rhs) {
225 throw NotImplementedException("GLSL Instruction"); 224 ctx.AddU1("{}=uint({})>uint({});", inst, lhs, rhs);
226} 225}
227 226
228void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 227void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
229 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { 228 [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
230 throw NotImplementedException("GLSL Instruction"); 229 ctx.AddU1("{}={}!={};", inst, lhs, rhs);
231} 230}
232 231
233void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 232void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
234 [[maybe_unused]] std::string_view lhs, 233 [[maybe_unused]] std::string_view lhs,
235 [[maybe_unused]] std::string_view rhs) { 234 [[maybe_unused]] std::string_view rhs) {
236 throw NotImplementedException("GLSL Instruction"); 235 ctx.AddU1("{}=int({})>=int({});", inst, lhs, rhs);
237} 236}
238 237
239void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 238void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
240 [[maybe_unused]] std::string_view lhs, 239 [[maybe_unused]] std::string_view lhs,
241 [[maybe_unused]] std::string_view rhs) { 240 [[maybe_unused]] std::string_view rhs) {
242 throw NotImplementedException("GLSL Instruction"); 241 ctx.AddU1("{}=uint({})>=uint({});", inst, lhs, rhs);
243} 242}
244} // namespace Shader::Backend::GLSL 243} // namespace Shader::Backend::GLSL