1
0
Fork 0
forked from eden-emu/eden
eden/src/shader_recompiler/backend/spirv/emit_spirv_control_flow.cpp

28 lines
946 B
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2021-02-08 02:54:35 -03:00
#include "shader_recompiler/backend/spirv/emit_spirv_instructions.h"
#include "shader_recompiler/backend/spirv/spirv_emit_context.h"
2021-02-16 04:10:22 -03:00
namespace Shader::Backend::SPIRV {
2021-04-19 01:03:38 +02:00
void EmitJoin(EmitContext&) {
throw NotImplementedException("Join shouldn't be emitted");
}
void EmitDemoteToHelperInvocation(EmitContext& ctx) {
2021-05-23 04:20:37 -03:00
if (ctx.profile.support_demote_to_helper_invocation) {
ctx.OpDemoteToHelperInvocation();
2021-05-23 04:20:37 -03:00
} else {
const Id kill_label{ctx.OpLabel()};
const Id impossible_label{ctx.OpLabel()};
ctx.OpSelectionMerge(impossible_label, spv::SelectionControlMask::MaskNone);
ctx.OpBranchConditional(ctx.true_value, kill_label, impossible_label);
ctx.AddLabel(kill_label);
2021-05-23 04:20:37 -03:00
ctx.OpKill();
ctx.AddLabel(impossible_label);
2021-05-23 04:20:37 -03:00
}
}
2021-02-16 04:10:22 -03:00
} // namespace Shader::Backend::SPIRV