emit_glsl_select.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <string_view>
  5. #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h"
  6. #include "shader_recompiler/backend/glsl/glsl_emit_context.h"
  7. #include "shader_recompiler/frontend/ir/value.h"
  8. namespace Shader::Backend::GLSL {
  9. void EmitSelectU1(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
  10. std::string_view true_value, std::string_view false_value) {
  11. ctx.AddU1("{}={}?{}:{};", inst, cond, true_value, false_value);
  12. }
  13. void EmitSelectU8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond,
  14. [[maybe_unused]] std::string_view true_value,
  15. [[maybe_unused]] std::string_view false_value) {
  16. NotImplemented();
  17. }
  18. void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond,
  19. [[maybe_unused]] std::string_view true_value,
  20. [[maybe_unused]] std::string_view false_value) {
  21. NotImplemented();
  22. }
  23. void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
  24. std::string_view true_value, std::string_view false_value) {
  25. ctx.AddU32("{}={}?{}:{};", inst, cond, true_value, false_value);
  26. }
  27. void EmitSelectU64(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
  28. std::string_view true_value, std::string_view false_value) {
  29. ctx.AddU64("{}={}?{}:{};", inst, cond, true_value, false_value);
  30. }
  31. void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond,
  32. [[maybe_unused]] std::string_view true_value,
  33. [[maybe_unused]] std::string_view false_value) {
  34. NotImplemented();
  35. }
  36. void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
  37. std::string_view true_value, std::string_view false_value) {
  38. ctx.AddF32("{}={}?{}:{};", inst, cond, true_value, false_value);
  39. }
  40. void EmitSelectF64(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
  41. std::string_view true_value, std::string_view false_value) {
  42. ctx.AddF64("{}={}?{}:{};", inst, cond, true_value, false_value);
  43. }
  44. } // namespace Shader::Backend::GLSL