summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/spirv/emit_spirv.cpp
diff options
context:
space:
mode:
authorGravatar lat9nq2021-04-05 22:25:22 -0400
committerGravatar ameerj2021-07-22 21:51:26 -0400
commit0bb85f6a753c769266c95c4ba146b25b9eaaaffd (patch)
treee5d818ae7dc1d0025bb115c7a63235d866e53286 /src/shader_recompiler/backend/spirv/emit_spirv.cpp
parentshader: Fix FCMP immediate variant (diff)
downloadyuzu-0bb85f6a753c769266c95c4ba146b25b9eaaaffd.tar.gz
yuzu-0bb85f6a753c769266c95c4ba146b25b9eaaaffd.tar.xz
yuzu-0bb85f6a753c769266c95c4ba146b25b9eaaaffd.zip
shader_recompiler,video_core: Cleanup some GCC and Clang errors
Mostly fixing unused *, implicit conversion, braced scalar init, fpermissive, and some others. Some Clang errors likely remain in video_core, and std::ranges is still a pertinent issue in shader_recompiler shader_recompiler: cmake: Force bracket depth to 1024 on Clang Increases the maximum fold expression depth thread_worker: Include condition_variable Don't use list initializers in control flow Co-authored-by: ReinUsesLisp <reinuseslisp@airmail.cc>
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv.cpp')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
index 32512a0e5..355cf0ca8 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
@@ -16,7 +16,7 @@
16namespace Shader::Backend::SPIRV { 16namespace Shader::Backend::SPIRV {
17namespace { 17namespace {
18template <class Func> 18template <class Func>
19struct FuncTraits : FuncTraits<Func> {}; 19struct FuncTraits {};
20 20
21template <class ReturnType_, class... Args> 21template <class ReturnType_, class... Args>
22struct FuncTraits<ReturnType_ (*)(Args...)> { 22struct FuncTraits<ReturnType_ (*)(Args...)> {
@@ -64,17 +64,20 @@ ArgType Arg(EmitContext& ctx, const IR::Value& arg) {
64template <auto func, bool is_first_arg_inst, size_t... I> 64template <auto func, bool is_first_arg_inst, size_t... I>
65void Invoke(EmitContext& ctx, IR::Inst* inst, std::index_sequence<I...>) { 65void Invoke(EmitContext& ctx, IR::Inst* inst, std::index_sequence<I...>) {
66 using Traits = FuncTraits<decltype(func)>; 66 using Traits = FuncTraits<decltype(func)>;
67 if constexpr (std::is_same_v<Traits::ReturnType, Id>) { 67 if constexpr (std::is_same_v<typename Traits::ReturnType, Id>) {
68 if constexpr (is_first_arg_inst) { 68 if constexpr (is_first_arg_inst) {
69 SetDefinition<func>(ctx, inst, inst, Arg<Traits::ArgType<I + 2>>(ctx, inst->Arg(I))...); 69 SetDefinition<func>(
70 ctx, inst, inst,
71 Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...);
70 } else { 72 } else {
71 SetDefinition<func>(ctx, inst, Arg<Traits::ArgType<I + 1>>(ctx, inst->Arg(I))...); 73 SetDefinition<func>(
74 ctx, inst, Arg<typename Traits::template ArgType<I + 1>>(ctx, inst->Arg(I))...);
72 } 75 }
73 } else { 76 } else {
74 if constexpr (is_first_arg_inst) { 77 if constexpr (is_first_arg_inst) {
75 func(ctx, inst, Arg<Traits::ArgType<I + 2>>(ctx, inst->Arg(I))...); 78 func(ctx, inst, Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...);
76 } else { 79 } else {
77 func(ctx, Arg<Traits::ArgType<I + 1>>(ctx, inst->Arg(I))...); 80 func(ctx, Arg<typename Traits::template ArgType<I + 1>>(ctx, inst->Arg(I))...);
78 } 81 }
79 } 82 }
80} 83}
@@ -94,14 +97,14 @@ void Invoke(EmitContext& ctx, IR::Inst* inst) {
94} 97}
95 98
96void EmitInst(EmitContext& ctx, IR::Inst* inst) { 99void EmitInst(EmitContext& ctx, IR::Inst* inst) {
97 switch (inst->Opcode()) { 100 switch (inst->GetOpcode()) {
98#define OPCODE(name, result_type, ...) \ 101#define OPCODE(name, result_type, ...) \
99 case IR::Opcode::name: \ 102 case IR::Opcode::name: \
100 return Invoke<&Emit##name>(ctx, inst); 103 return Invoke<&Emit##name>(ctx, inst);
101#include "shader_recompiler/frontend/ir/opcodes.inc" 104#include "shader_recompiler/frontend/ir/opcodes.inc"
102#undef OPCODE 105#undef OPCODE
103 } 106 }
104 throw LogicError("Invalid opcode {}", inst->Opcode()); 107 throw LogicError("Invalid opcode {}", inst->GetOpcode());
105} 108}
106 109
107Id TypeId(const EmitContext& ctx, IR::Type type) { 110Id TypeId(const EmitContext& ctx, IR::Type type) {