emit_spirv_select.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "shader_recompiler/backend/spirv/emit_spirv_instructions.h"
  4. #include "shader_recompiler/backend/spirv/spirv_emit_context.h"
  5. namespace Shader::Backend::SPIRV {
  6. Id EmitSelectU1(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  7. return ctx.OpSelect(ctx.U1, cond, true_value, false_value);
  8. }
  9. Id EmitSelectU8(EmitContext&, Id, Id, Id) {
  10. throw NotImplementedException("SPIR-V Instruction");
  11. }
  12. Id EmitSelectU16(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  13. return ctx.OpSelect(ctx.U16, cond, true_value, false_value);
  14. }
  15. Id EmitSelectU32(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  16. return ctx.OpSelect(ctx.U32[1], cond, true_value, false_value);
  17. }
  18. Id EmitSelectU64(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  19. return ctx.OpSelect(ctx.U64, cond, true_value, false_value);
  20. }
  21. Id EmitSelectF16(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  22. return ctx.OpSelect(ctx.F16[1], cond, true_value, false_value);
  23. }
  24. Id EmitSelectF32(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  25. return ctx.OpSelect(ctx.F32[1], cond, true_value, false_value);
  26. }
  27. Id EmitSelectF64(EmitContext& ctx, Id cond, Id true_value, Id false_value) {
  28. return ctx.OpSelect(ctx.F64[1], cond, true_value, false_value);
  29. }
  30. } // namespace Shader::Backend::SPIRV