summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/spirv/emit_spirv_control_flow.cpp
blob: 48755b827870c5d060c340838effa4cdbb41806f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 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"

namespace Shader::Backend::SPIRV {

void EmitBranch(EmitContext& ctx, IR::Block* label) {
    ctx.OpBranch(label->Definition<Id>());
}

void EmitBranchConditional(EmitContext& ctx, Id condition, IR::Block* true_label,
                           IR::Block* false_label) {
    ctx.OpBranchConditional(condition, true_label->Definition<Id>(), false_label->Definition<Id>());
}

void EmitLoopMerge(EmitContext& ctx, IR::Block* merge_label, IR::Block* continue_label) {
    ctx.OpLoopMerge(merge_label->Definition<Id>(), continue_label->Definition<Id>(),
                    spv::LoopControlMask::MaskNone);
}

void EmitSelectionMerge(EmitContext& ctx, IR::Block* merge_label) {
    ctx.OpSelectionMerge(merge_label->Definition<Id>(), spv::SelectionControlMask::MaskNone);
}

void EmitReturn(EmitContext& ctx) {
    ctx.OpReturn();
}

} // namespace Shader::Backend::SPIRV