emit_glsl_logical.cpp 872 B

123456789101112131415161718192021222324252627
  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_context.h"
  6. #include "shader_recompiler/frontend/ir/value.h"
  7. namespace Shader::Backend::GLSL {
  8. void EmitLogicalOr(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
  9. ctx.AddU1("{}={}||{};", inst, a, b);
  10. }
  11. void EmitLogicalAnd(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
  12. ctx.AddU1("{}={}&&{};", inst, a, b);
  13. }
  14. void EmitLogicalXor(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
  15. ctx.AddU1("{}={}^^{};", inst, a, b);
  16. }
  17. void EmitLogicalNot(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
  18. ctx.AddU1("{}=!{};", inst, value);
  19. }
  20. } // namespace Shader::Backend::GLSL