Strings should not be concatenated using '+' in a loop (#5664)
* 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>
This commit is contained in:
parent
0aceb534cb
commit
7835968214
12 changed files with 62 additions and 51 deletions
|
@ -2,6 +2,7 @@ using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandHelper;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
@ -785,30 +786,31 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||
|
||||
private static string GetFunctionName(Operation baseOp, bool isMultiTarget, IReadOnlyList<uint> targetCbs)
|
||||
{
|
||||
string name = baseOp.Inst.ToString();
|
||||
StringBuilder nameBuilder = new();
|
||||
nameBuilder.Append(baseOp.Inst.ToString());
|
||||
|
||||
name += baseOp.StorageKind switch
|
||||
nameBuilder.Append(baseOp.StorageKind switch
|
||||
{
|
||||
StorageKind.GlobalMemoryS8 => "S8",
|
||||
StorageKind.GlobalMemoryS16 => "S16",
|
||||
StorageKind.GlobalMemoryU8 => "U8",
|
||||
StorageKind.GlobalMemoryU16 => "U16",
|
||||
_ => string.Empty,
|
||||
};
|
||||
});
|
||||
|
||||
if (isMultiTarget)
|
||||
{
|
||||
name += "Multi";
|
||||
nameBuilder.Append("Multi");
|
||||
}
|
||||
|
||||
foreach (uint targetCb in targetCbs)
|
||||
{
|
||||
(int sbCbSlot, int sbCbOffset) = UnpackCbSlotAndOffset(targetCb);
|
||||
|
||||
name += $"_c{sbCbSlot}o{sbCbOffset}";
|
||||
nameBuilder.Append($"_c{sbCbSlot}o{sbCbOffset}");
|
||||
}
|
||||
|
||||
return name;
|
||||
return nameBuilder.ToString();
|
||||
}
|
||||
|
||||
private static bool TryGenerateStorageOp(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue