From 3e1a9a45a6a1686e91768deef5f33afd5e55ed45 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 28 Jan 2019 07:43:19 -0500 Subject: [PATCH 1/3] shader/decode: Avoid a pessimizing std::move within DecodeRange() std::moveing a local variable in a return statement has the potential to prevent copy elision from occurring, so this can just be converted into a regular return. --- src/video_core/shader/decode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index 6fdcac784..812983a99 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp @@ -126,7 +126,7 @@ BasicBlock ShaderIR::DecodeRange(u32 begin, u32 end) { for (u32 pc = begin; pc < (begin > end ? MAX_PROGRAM_LENGTH : end);) { pc = DecodeInstr(basic_block, pc); } - return std::move(basic_block); + return basic_block; } u32 ShaderIR::DecodeInstr(BasicBlock& bb, u32 pc) { From 62e08c30b7ac61d8950b1dd732d7f82add51f77d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 28 Jan 2019 07:50:30 -0500 Subject: [PATCH 2/3] shader/shader_ir: Amend constructor initializer ordering for AbufNode Orders the class members in the same order that they would actually be initialized in. Gets rid of two compiler warnings. --- src/video_core/shader/shader_ir.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index 96e7df6b6..ea057980d 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -415,11 +415,11 @@ class AbufNode final { public: explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element, const Tegra::Shader::IpaMode& input_mode, Node buffer = {}) - : input_mode{input_mode}, index{index}, element{element}, buffer{buffer} {} + : input_mode{input_mode}, buffer{buffer}, index{index}, element{element} {} explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element, Node buffer = {}) - : input_mode{}, index{index}, element{element}, buffer{buffer} {} + : input_mode{}, buffer{buffer}, index{index}, element{element} {} Tegra::Shader::IpaMode GetInputMode() const { return input_mode; From b2b98b2f443ac470306c3a87886a4302a0e867d3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 28 Jan 2019 07:52:02 -0500 Subject: [PATCH 3/3] shader/shader_ir: Amend three comment typos Given we're in the area, these are three trivial typos that can be corrected. --- src/video_core/shader/shader_ir.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index ea057980d..ef8f94480 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -391,7 +391,7 @@ private: const InternalFlag flag; }; -/// A predicate register, it can be negated without aditional nodes +/// A predicate register, it can be negated without additional nodes class PredicateNode final { public: explicit constexpr PredicateNode(Tegra::Shader::Pred index, bool negated) @@ -626,10 +626,10 @@ private: Node GetPredicate(u64 pred, bool negated = false); /// Generates a predicate node for an immediate true or false value Node GetPredicate(bool immediate); - /// Generates a node representing an input atttribute. Keeps track of used attributes. + /// Generates a node representing an input attribute. Keeps track of used attributes. Node GetInputAttribute(Tegra::Shader::Attribute::Index index, u64 element, const Tegra::Shader::IpaMode& input_mode, Node buffer = {}); - /// Generates a node representing an output atttribute. Keeps track of used attributes. + /// Generates a node representing an output attribute. Keeps track of used attributes. Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer); /// Generates a node representing an internal flag Node GetInternalFlag(InternalFlag flag, bool negated = false);