From 61ef8af1e2a4024a1e90e4275df61604a807a9d6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 20 Oct 2018 14:19:28 -0400 Subject: [PATCH 1/3] gl_shader_decompiler: Fix a few comment typos --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index a427353e9..0e9c3e990 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -378,8 +378,8 @@ public: * @param reg The destination register to use. * @param elem The element to use for the operation. * @param value The code representing the value to assign. Type has to be half float. - * @param type Half float kind of assignment. - * @param dest_num_components Number of components in the destionation. + * @param merge Half float kind of assignment. + * @param dest_num_components Number of components in the destination. * @param value_num_components Number of components in the value. * @param is_saturated Optional, when True, saturates the provided value. * @param dest_elem Optional, the destination element to use for the operation. @@ -422,6 +422,7 @@ public: * @param reg The destination register to use. * @param elem The element to use for the operation. * @param attribute The input attribute to use as the source value. + * @param input_mode The input mode. * @param vertex The register that decides which vertex to read from (used in GS). */ void SetRegisterToInputAttibute(const Register& reg, u64 elem, Attribute::Index attribute, @@ -1058,7 +1059,7 @@ private: /* * Transforms the input string GLSL operand into an unpacked half float pair. * @note This function returns a float type pair instead of a half float pair. This is because - * real half floats are not standarized in GLSL but unpackHalf2x16 (which returns a vec2) is. + * real half floats are not standardized in GLSL but unpackHalf2x16 (which returns a vec2) is. * @param operand Input operand. It has to be an unsigned integer. * @param type How to unpack the unsigned integer to a half float pair. * @param abs Get the absolute value of unpacked half floats. From 381baf783d39330007e75e409aee2fc685e95c01 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 20 Oct 2018 14:22:16 -0400 Subject: [PATCH 2/3] gl_shader_decompiler: Get rid of variable shadowing warnings A variable with the same name was previously declared in an outer scope. --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 0e9c3e990..f9ef9d194 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -3308,8 +3308,8 @@ private: Tegra::Shader::VmadType type, u64 byte_height) { const std::string value = [&]() { if (!is_chunk) { - const auto offset = static_cast(byte_height * 8); - return "((" + op + " >> " + std::to_string(offset) + ") & 0xff)"; + const auto shift = static_cast(byte_height * 8); + return "((" + op + " >> " + std::to_string(shift) + ") & 0xff)"; } const std::string zero = "0"; From 8a86c8d48b7ca8b7c9217938a36720e616a2ebad Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 20 Oct 2018 14:25:12 -0400 Subject: [PATCH 3/3] gl_shader_decompiler: Allow std::move to function in SetPredicate If the variable being moved is const, then std::move will always perform a copy (since it can't actually move the data). --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index f9ef9d194..a88cf8699 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -952,7 +952,7 @@ private: // Can't assign to the constant predicate. ASSERT(pred != static_cast(Pred::UnusedIndex)); - const std::string variable = 'p' + std::to_string(pred) + '_' + suffix; + std::string variable = 'p' + std::to_string(pred) + '_' + suffix; shader.AddLine(variable + " = " + value + ';'); declr_predicates.insert(std::move(variable)); }