diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index 77c93146e..0f528b027 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp | |||
| @@ -37,8 +37,6 @@ template <typename ArgType> | |||
| 37 | ArgType Arg(EmitContext& ctx, const IR::Value& arg) { | 37 | ArgType Arg(EmitContext& ctx, const IR::Value& arg) { |
| 38 | if constexpr (std::is_same_v<ArgType, std::string>) { | 38 | if constexpr (std::is_same_v<ArgType, std::string>) { |
| 39 | return ctx.reg_alloc.Consume(arg); | 39 | return ctx.reg_alloc.Consume(arg); |
| 40 | } else if constexpr (std::is_same_v<ArgType, IR::Inst&>) { | ||
| 41 | return *arg.Inst(); | ||
| 42 | } else if constexpr (std::is_same_v<ArgType, const IR::Value&>) { | 40 | } else if constexpr (std::is_same_v<ArgType, const IR::Value&>) { |
| 43 | return arg; | 41 | return arg; |
| 44 | } else if constexpr (std::is_same_v<ArgType, u32>) { | 42 | } else if constexpr (std::is_same_v<ArgType, u32>) { |
| @@ -58,7 +56,7 @@ void Invoke(EmitContext& ctx, IR::Inst* inst, std::index_sequence<I...>) { | |||
| 58 | if constexpr (std::is_same_v<typename Traits::ReturnType, Id>) { | 56 | if constexpr (std::is_same_v<typename Traits::ReturnType, Id>) { |
| 59 | if constexpr (is_first_arg_inst) { | 57 | if constexpr (is_first_arg_inst) { |
| 60 | SetDefinition<func>( | 58 | SetDefinition<func>( |
| 61 | ctx, inst, inst, | 59 | ctx, inst, *inst, |
| 62 | Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...); | 60 | Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...); |
| 63 | } else { | 61 | } else { |
| 64 | SetDefinition<func>( | 62 | SetDefinition<func>( |
| @@ -66,7 +64,7 @@ void Invoke(EmitContext& ctx, IR::Inst* inst, std::index_sequence<I...>) { | |||
| 66 | } | 64 | } |
| 67 | } else { | 65 | } else { |
| 68 | if constexpr (is_first_arg_inst) { | 66 | if constexpr (is_first_arg_inst) { |
| 69 | func(ctx, inst, Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...); | 67 | func(ctx, *inst, Arg<typename Traits::template ArgType<I + 2>>(ctx, inst->Arg(I))...); |
| 70 | } else { | 68 | } else { |
| 71 | func(ctx, Arg<typename Traits::template ArgType<I + 1>>(ctx, inst->Arg(I))...); | 69 | func(ctx, Arg<typename Traits::template ArgType<I + 1>>(ctx, inst->Arg(I))...); |
| 72 | } | 70 | } |
| @@ -81,7 +79,7 @@ void Invoke(EmitContext& ctx, IR::Inst* inst) { | |||
| 81 | Invoke<func, false>(ctx, inst, std::make_index_sequence<0>{}); | 79 | Invoke<func, false>(ctx, inst, std::make_index_sequence<0>{}); |
| 82 | } else { | 80 | } else { |
| 83 | using FirstArgType = typename Traits::template ArgType<1>; | 81 | using FirstArgType = typename Traits::template ArgType<1>; |
| 84 | static constexpr bool is_first_arg_inst = std::is_same_v<FirstArgType, IR::Inst*>; | 82 | static constexpr bool is_first_arg_inst = std::is_same_v<FirstArgType, IR::Inst&>; |
| 85 | using Indices = std::make_index_sequence<Traits::NUM_ARGS - (is_first_arg_inst ? 2 : 1)>; | 83 | using Indices = std::make_index_sequence<Traits::NUM_ARGS - (is_first_arg_inst ? 2 : 1)>; |
| 86 | Invoke<func, is_first_arg_inst>(ctx, inst, Indices{}); | 84 | Invoke<func, is_first_arg_inst>(ctx, inst, Indices{}); |
| 87 | } | 85 | } |