emit_spirv_control_flow.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "shader_recompiler/backend/spirv/emit_spirv.h"
  5. namespace Shader::Backend::SPIRV {
  6. void EmitBranch(EmitContext& ctx, IR::Block* label) {
  7. ctx.OpBranch(label->Definition<Id>());
  8. }
  9. void EmitBranchConditional(EmitContext& ctx, Id condition, IR::Block* true_label,
  10. IR::Block* false_label) {
  11. ctx.OpBranchConditional(condition, true_label->Definition<Id>(), false_label->Definition<Id>());
  12. }
  13. void EmitLoopMerge(EmitContext& ctx, IR::Block* merge_label, IR::Block* continue_label) {
  14. ctx.OpLoopMerge(merge_label->Definition<Id>(), continue_label->Definition<Id>(),
  15. spv::LoopControlMask::MaskNone);
  16. }
  17. void EmitSelectionMerge(EmitContext& ctx, IR::Block* merge_label) {
  18. ctx.OpSelectionMerge(merge_label->Definition<Id>(), spv::SelectionControlMask::MaskNone);
  19. }
  20. void EmitReturn(EmitContext& ctx) {
  21. ctx.OpReturn();
  22. }
  23. } // namespace Shader::Backend::SPIRV