3
0
Fork 0
forked from suyu/suyu
suyu/src/shader_recompiler/backend/spirv/emit_spirv_control_flow.cpp

32 lines
1 KiB
C++
Raw Normal View History

2021-02-08 06:54:35 +01:00
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "shader_recompiler/backend/spirv/emit_spirv.h"
2021-02-16 08:10:22 +01:00
namespace Shader::Backend::SPIRV {
2021-02-17 04:59:28 +01:00
void EmitBranch(EmitContext& ctx, IR::Block* label) {
2021-02-16 08:10:22 +01:00
ctx.OpBranch(label->Definition<Id>());
}
2021-02-17 04:59:28 +01:00
void EmitBranchConditional(EmitContext& ctx, Id condition, IR::Block* true_label,
2021-02-16 08:10:22 +01:00
IR::Block* false_label) {
ctx.OpBranchConditional(condition, true_label->Definition<Id>(), false_label->Definition<Id>());
}
2021-02-17 04:59:28 +01:00
void EmitLoopMerge(EmitContext& ctx, IR::Block* merge_label, IR::Block* continue_label) {
2021-02-16 08:10:22 +01:00
ctx.OpLoopMerge(merge_label->Definition<Id>(), continue_label->Definition<Id>(),
spv::LoopControlMask::MaskNone);
}
2021-02-17 04:59:28 +01:00
void EmitSelectionMerge(EmitContext& ctx, IR::Block* merge_label) {
2021-02-16 08:10:22 +01:00
ctx.OpSelectionMerge(merge_label->Definition<Id>(), spv::SelectionControlMask::MaskNone);
}
2021-02-17 04:59:28 +01:00
void EmitReturn(EmitContext& ctx) {
2021-02-16 08:10:22 +01:00
ctx.OpReturn();
}
} // namespace Shader::Backend::SPIRV