From c8473f399e745993d2b9980f4ef62fa6a208ec3d Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 18 Nov 2019 07:34:34 -0400 Subject: [PATCH] Shader_IR: Address Feedback --- .../renderer_opengl/gl_shader_decompiler.cpp | 2 +- src/video_core/shader/decode/arithmetic_integer.cpp | 11 ++++++----- src/video_core/shader/decode/texture.cpp | 7 ++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 49f0b16207..f7b77711ae 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1815,7 +1815,7 @@ private: ASSERT(meta); std::string expr = GenerateTexture(operation, "Grad", {TextureDerivates{}, TextureAoffi{}}); - return {expr + GetSwizzle(meta->element), Type::Float}; + return {std::move(expr) + GetSwizzle(meta->element), Type::Float}; } Expression ImageLoad(Operation operation) { diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp index 9208b7bef4..371fae1277 100644 --- a/src/video_core/shader/decode/arithmetic_integer.cpp +++ b/src/video_core/shader/decode/arithmetic_integer.cpp @@ -135,17 +135,18 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { case OpCode::Id::FLO_IMM: { Node value; if (instr.flo.invert) { - op_b = Operation(OperationCode::IBitwiseNot, NO_PRECISE, op_b); + op_b = Operation(OperationCode::IBitwiseNot, NO_PRECISE, std::move(op_b)); } if (instr.flo.is_signed) { - value = Operation(OperationCode::IBitMSB, NO_PRECISE, op_b); + value = Operation(OperationCode::IBitMSB, NO_PRECISE, std::move(op_b)); } else { - value = Operation(OperationCode::UBitMSB, NO_PRECISE, op_b); + value = Operation(OperationCode::UBitMSB, NO_PRECISE, std::move(op_b)); } if (instr.flo.sh) { - value = Operation(OperationCode::UBitwiseXor, NO_PRECISE, value, Immediate(31)); + value = + Operation(OperationCode::UBitwiseXor, NO_PRECISE, std::move(value), Immediate(31)); } - SetRegister(bb, instr.gpr0, value); + SetRegister(bb, instr.gpr0, std::move(value)); break; } case OpCode::Id::SEL_C: diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index 0e501919d4..9afba24953 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp @@ -147,8 +147,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { case OpCode::Id::TXD: { UNIMPLEMENTED_IF_MSG(instr.txd.UsesMiscMode(TextureMiscMode::AOFFI), "AOFFI is not implemented"); - const auto is_array = static_cast(instr.txd.is_array != 0); - UNIMPLEMENTED_IF_MSG(is_array, "TXD Array is not implemented"); + UNIMPLEMENTED_IF_MSG(instr.txd.is_array != 0, "TXD Array is not implemented"); u64 base_reg = instr.gpr8.Value(); const auto derivate_reg = instr.gpr20.Value(); @@ -173,10 +172,8 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { Node4 values; for (u32 element = 0; element < values.size(); ++element) { - auto coords_copy = coords; MetaTexture meta{sampler, {}, {}, {}, derivates, {}, {}, {}, element}; - values[element] = - Operation(OperationCode::TextureGradient, meta, std::move(coords_copy)); + values[element] = Operation(OperationCode::TextureGradient, std::move(meta), coords); } WriteTexInstructionFloat(bb, instr, values);