diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_select.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_select.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp new file mode 100644 index 000000000..49fba9073 --- /dev/null +++ b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string_view> | ||
| 6 | |||
| 7 | #include "shader_recompiler/backend/glsl/emit_context.h" | ||
| 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/value.h" | ||
| 10 | |||
| 11 | namespace Shader::Backend::GLSL { | ||
| 12 | void EmitSelectU1(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | ||
| 13 | std::string_view true_value, std::string_view false_value) { | ||
| 14 | ctx.AddU1("{}={}?{}:{};", inst, cond, true_value, false_value); | ||
| 15 | } | ||
| 16 | |||
| 17 | void EmitSelectU8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 18 | [[maybe_unused]] std::string_view true_value, | ||
| 19 | [[maybe_unused]] std::string_view false_value) { | ||
| 20 | NotImplemented(); | ||
| 21 | } | ||
| 22 | |||
| 23 | void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 24 | [[maybe_unused]] std::string_view true_value, | ||
| 25 | [[maybe_unused]] std::string_view false_value) { | ||
| 26 | NotImplemented(); | ||
| 27 | } | ||
| 28 | |||
| 29 | void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | ||
| 30 | std::string_view true_value, std::string_view false_value) { | ||
| 31 | ctx.AddU32("{}={}?{}:{};", inst, cond, true_value, false_value); | ||
| 32 | } | ||
| 33 | |||
| 34 | void EmitSelectU64(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | ||
| 35 | std::string_view true_value, std::string_view false_value) { | ||
| 36 | ctx.AddU64("{}={}?{}:{};", inst, cond, true_value, false_value); | ||
| 37 | } | ||
| 38 | |||
| 39 | void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | ||
| 40 | [[maybe_unused]] std::string_view true_value, | ||
| 41 | [[maybe_unused]] std::string_view false_value) { | ||
| 42 | NotImplemented(); | ||
| 43 | } | ||
| 44 | |||
| 45 | void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | ||
| 46 | std::string_view true_value, std::string_view false_value) { | ||
| 47 | ctx.AddF32("{}={}?{}:{};", inst, cond, true_value, false_value); | ||
| 48 | } | ||
| 49 | |||
| 50 | void EmitSelectF64(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | ||
| 51 | std::string_view true_value, std::string_view false_value) { | ||
| 52 | ctx.AddF64("{}={}?{}:{};", inst, cond, true_value, false_value); | ||
| 53 | } | ||
| 54 | |||
| 55 | } // namespace Shader::Backend::GLSL | ||