diff options
author | Marco Carvalho <marcolucio27@gmail.com> | 2023-10-05 07:41:00 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-05 12:41:00 +0200 |
commit | 7835968214241c37c677b6c5c82aa3353546de89 (patch) | |
tree | 70e4a1d5fbacf371d1d5eff1d6c025b7ff14f922 /src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs | |
parent | 0aceb534cb34287e354f92c37a1b5ebf136e8e74 (diff) |
Strings should not be concatenated using '+' in a loop (#5664)1.1.1043
* Strings should not be concatenated using '+' in a loop
* fix IDE0090
* undo GenerateLoadOrStore
* prefer string interpolation
* Update src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs
Co-authored-by: Mary <thog@protonmail.com>
---------
Co-authored-by: Mary <thog@protonmail.com>
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs index 6b02f2bf..eb0cb92d 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs @@ -2,6 +2,7 @@ using Ryujinx.Graphics.Shader.IntermediateRepresentation; using Ryujinx.Graphics.Shader.StructuredIr; using Ryujinx.Graphics.Shader.Translation; using System; +using System.Text; using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenBallot; using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenCall; @@ -67,11 +68,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions int arity = (int)(info.Type & InstType.ArityMask); - string args = string.Empty; + StringBuilder builder = new(); if (atomic && (operation.StorageKind == StorageKind.StorageBuffer || operation.StorageKind == StorageKind.SharedMemory)) { - args = GenerateLoadOrStore(context, operation, isStore: false); + builder.Append(GenerateLoadOrStore(context, operation, isStore: false)); AggregateType dstType = operation.Inst == Instruction.AtomicMaxS32 || operation.Inst == Instruction.AtomicMinS32 ? AggregateType.S32 @@ -79,7 +80,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions for (int argIndex = operation.SourcesCount - arity + 2; argIndex < operation.SourcesCount; argIndex++) { - args += ", " + GetSoureExpr(context, operation.GetSource(argIndex), dstType); + builder.Append($", {GetSoureExpr(context, operation.GetSource(argIndex), dstType)}"); } } else @@ -88,16 +89,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { if (argIndex != 0) { - args += ", "; + builder.Append(", "); } AggregateType dstType = GetSrcVarType(inst, argIndex); - args += GetSoureExpr(context, operation.GetSource(argIndex), dstType); + builder.Append(GetSoureExpr(context, operation.GetSource(argIndex), dstType)); } } - return info.OpName + '(' + args + ')'; + return $"{info.OpName}({builder})"; } else if ((info.Type & InstType.Op) != 0) { |