summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-05-19 04:47:00 -0400
committerGravatar Lioncash2019-05-19 08:23:14 -0400
commit212b148923f1d2d193d79e75dde565cedc095252 (patch)
tree192d530fa48805357d615c5d6d45aec1d3c1743f /src
parentshader/shader_ir: Remove unnecessary template parameter packs from Operation(... (diff)
downloadyuzu-212b148923f1d2d193d79e75dde565cedc095252.tar.gz
yuzu-212b148923f1d2d193d79e75dde565cedc095252.tar.xz
yuzu-212b148923f1d2d193d79e75dde565cedc095252.zip
shader/shader_ir: Simplify constructors for OperationNode
Many of these constructors don't even need to be templated. The only ones that need to be templated are the ones that actually make use of the parameter pack. Even then, since std::vector accepts an initializer list, we can supply the parameter pack directly to it instead of creating our own copy of the list, then copying it again into the std::vector.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/shader_ir.h21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 5f3aef7ce..b93cde71a 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -336,32 +336,23 @@ using Meta = std::variant<MetaArithmetic, MetaTexture, Tegra::Shader::HalfType>;
336/// Holds any kind of operation that can be done in the IR 336/// Holds any kind of operation that can be done in the IR
337class OperationNode final { 337class OperationNode final {
338public: 338public:
339 template <typename... T> 339 explicit OperationNode(OperationCode code) : code{code} {}
340 explicit constexpr OperationNode(OperationCode code) : code{code}, meta{} {}
341 340
342 template <typename... T> 341 explicit OperationNode(OperationCode code, Meta&& meta) : code{code}, meta{std::move(meta)} {}
343 explicit constexpr OperationNode(OperationCode code, Meta&& meta)
344 : code{code}, meta{std::move(meta)} {}
345 342
346 template <typename... T> 343 template <typename... T>
347 explicit constexpr OperationNode(OperationCode code, const T*... operands) 344 explicit OperationNode(OperationCode code, const T*... operands)
348 : OperationNode(code, {}, operands...) {} 345 : OperationNode(code, {}, operands...) {}
349 346
350 template <typename... T> 347 template <typename... T>
351 explicit constexpr OperationNode(OperationCode code, Meta&& meta, const T*... operands_) 348 explicit OperationNode(OperationCode code, Meta&& meta, const T*... operands_)
352 : code{code}, meta{std::move(meta)} { 349 : code{code}, meta{std::move(meta)}, operands{operands_...} {}
353
354 auto operands_list = {operands_...};
355 for (auto& operand : operands_list) {
356 operands.push_back(operand);
357 }
358 }
359 350
360 explicit OperationNode(OperationCode code, Meta&& meta, std::vector<Node>&& operands) 351 explicit OperationNode(OperationCode code, Meta&& meta, std::vector<Node>&& operands)
361 : code{code}, meta{meta}, operands{std::move(operands)} {} 352 : code{code}, meta{meta}, operands{std::move(operands)} {}
362 353
363 explicit OperationNode(OperationCode code, std::vector<Node>&& operands) 354 explicit OperationNode(OperationCode code, std::vector<Node>&& operands)
364 : code{code}, meta{}, operands{std::move(operands)} {} 355 : code{code}, operands{std::move(operands)} {}
365 356
366 OperationCode GetCode() const { 357 OperationCode GetCode() const {
367 return code; 358 return code;