diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp | 51 |
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 | ||
| 49 | void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 48 | void 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 | ||
| 54 | void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 53 | void 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 | |||
| 59 | void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 58 | void 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 | ||
| 65 | void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 64 | void 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 | ||
| 71 | void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 70 | void 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 | ||
| 77 | void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 76 | void 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 | ||
| 83 | void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 82 | void 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 | ||
| 89 | void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 88 | void 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 | ||
| 95 | void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 94 | void 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 | ||
| 100 | void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 99 | void 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 | ||
| 105 | void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 104 | void 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 | ||
| 110 | void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 109 | void 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 | ||
| 142 | void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 141 | void 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 | ||
| 147 | void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 146 | void 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 | ||
| 157 | void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 156 | void 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 | ||
| 162 | void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 161 | void 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 | ||
| 167 | void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 166 | void 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 | ||
| 172 | void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 171 | void 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 | ||
| 177 | void EmitSClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 176 | void 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 | ||
| 189 | void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 188 | void 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 | ||
| 194 | void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 193 | void 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 | ||
| 199 | void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 198 | void 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 | ||
| 204 | void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 203 | void 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 | ||
| 210 | void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 209 | void 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 | ||
| 216 | void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 215 | void 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 | ||
| 222 | void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 221 | void 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 | ||
| 228 | void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 227 | void 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 | ||
| 233 | void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 232 | void 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 | ||
| 239 | void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 238 | void 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 |