mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-19 20:26:54 +02:00
misc: chore: Use collection expressions in Shader project
This commit is contained in:
parent
a5dbcb75d0
commit
95f9e548ca
38 changed files with 198 additions and 204 deletions
|
@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
int functionId = context.Hfm.GetOrCreateFunctionId(name, memoryId.Value);
|
||||
|
||||
Operand[] callArgs = new Operand[] { Const(functionId), byteOffset, value };
|
||||
Operand[] callArgs = [Const(functionId), byteOffset, value];
|
||||
|
||||
LinkedListNode<INode> newNode = node.List.AddBefore(node, new Operation(Instruction.Call, 0, result, callArgs));
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
int functionId = context.Hfm.GetOrCreateFunctionId(name, memoryId.Value);
|
||||
|
||||
Operand[] callArgs = new Operand[] { Const(functionId), byteOffset, value };
|
||||
Operand[] callArgs = [Const(functionId), byteOffset, value];
|
||||
|
||||
LinkedListNode<INode> newNode = node.List.AddBefore(node, new Operation(Instruction.Call, 0, (Operand)null, callArgs));
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
operation.Dest = null;
|
||||
|
||||
Operand[] callArgs = new Operand[] { Const(functionId), value, index, mask, valid };
|
||||
Operand[] callArgs = [Const(functionId), value, index, mask, valid];
|
||||
|
||||
LinkedListNode<INode> newNode = node.List.AddBefore(node, new Operation(Instruction.Call, 0, result, callArgs));
|
||||
|
||||
|
|
|
@ -71,11 +71,12 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
if (stage == ShaderStage.Fragment)
|
||||
{
|
||||
callArgs = new Operand[] { Const(functionId), texOp.GetSource(coordsIndex + index), Const(samplerIndex), Const(index) };
|
||||
callArgs = [Const(functionId), texOp.GetSource(coordsIndex + index), Const(samplerIndex), Const(index)
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
callArgs = new Operand[] { Const(functionId), texOp.GetSource(coordsIndex + index), Const(samplerIndex) };
|
||||
callArgs = [Const(functionId), texOp.GetSource(coordsIndex + index), Const(samplerIndex)];
|
||||
}
|
||||
|
||||
node.List.AddBefore(node, new Operation(Instruction.Call, 0, scaledCoord, callArgs));
|
||||
|
@ -127,7 +128,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
}
|
||||
}
|
||||
|
||||
Operand[] callArgs = new Operand[] { Const(functionId), dest, Const(samplerIndex) };
|
||||
Operand[] callArgs = [Const(functionId), dest, Const(samplerIndex)];
|
||||
|
||||
node.List.AddAfter(node, new Operation(Instruction.Call, 0, unscaledSize, callArgs));
|
||||
}
|
||||
|
@ -175,7 +176,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
{
|
||||
Operand coordSize = Local();
|
||||
|
||||
Operand[] texSizeSources = new Operand[] { Const(0) };
|
||||
Operand[] texSizeSources = [Const(0)];
|
||||
|
||||
LinkedListNode<INode> textureSizeNode = node.List.AddBefore(node, new TextureOperation(
|
||||
Instruction.TextureQuerySize,
|
||||
|
@ -185,7 +186,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
texOp.Set,
|
||||
texOp.Binding,
|
||||
index,
|
||||
new[] { coordSize },
|
||||
[coordSize],
|
||||
texSizeSources));
|
||||
|
||||
resourceManager.SetUsageFlagsForTextureQuery(texOp.Binding, texOp.Type);
|
||||
|
@ -240,11 +241,11 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
if (isBindless || isIndexed)
|
||||
{
|
||||
texSizeSources = new Operand[] { texOp.GetSource(0), Const(0) };
|
||||
texSizeSources = [texOp.GetSource(0), Const(0)];
|
||||
}
|
||||
else
|
||||
{
|
||||
texSizeSources = new Operand[] { Const(0) };
|
||||
texSizeSources = [Const(0)];
|
||||
}
|
||||
|
||||
node.List.AddBefore(node, new TextureOperation(
|
||||
|
@ -255,7 +256,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
texOp.Set,
|
||||
texOp.Binding,
|
||||
index,
|
||||
new[] { coordSize },
|
||||
[coordSize],
|
||||
texSizeSources));
|
||||
|
||||
node.List.AddBefore(node, new Operation(
|
||||
|
@ -476,7 +477,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
texOp.Set,
|
||||
texOp.Binding,
|
||||
1 << 3, // W component: i=0, j=0
|
||||
new[] { dests[destIndex++] },
|
||||
[dests[destIndex++]],
|
||||
newSources);
|
||||
|
||||
node = node.List.AddBefore(node, newTexOp);
|
||||
|
@ -565,11 +566,11 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
if (bindlessHandle != null)
|
||||
{
|
||||
texSizeSources = new Operand[] { bindlessHandle, Const(0) };
|
||||
texSizeSources = [bindlessHandle, Const(0)];
|
||||
}
|
||||
else
|
||||
{
|
||||
texSizeSources = new Operand[] { Const(0) };
|
||||
texSizeSources = [Const(0)];
|
||||
}
|
||||
|
||||
node.List.AddBefore(node, new TextureOperation(
|
||||
|
@ -580,7 +581,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
texOp.Set,
|
||||
texOp.Binding,
|
||||
index,
|
||||
new[] { texSizes[index] },
|
||||
[texSizes[index]],
|
||||
texSizeSources));
|
||||
}
|
||||
|
||||
|
@ -611,7 +612,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
texOp.Set,
|
||||
texOp.Binding,
|
||||
0,
|
||||
new[] { lod },
|
||||
[lod],
|
||||
lodSources));
|
||||
}
|
||||
else
|
||||
|
@ -627,11 +628,11 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
if (bindlessHandle != null)
|
||||
{
|
||||
texSizeSources = new Operand[] { bindlessHandle, GenerateF2i(node, lod) };
|
||||
texSizeSources = [bindlessHandle, GenerateF2i(node, lod)];
|
||||
}
|
||||
else
|
||||
{
|
||||
texSizeSources = new Operand[] { GenerateF2i(node, lod) };
|
||||
texSizeSources = [GenerateF2i(node, lod)];
|
||||
}
|
||||
|
||||
node.List.AddBefore(node, new TextureOperation(
|
||||
|
@ -642,7 +643,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
texOp.Set,
|
||||
texOp.Binding,
|
||||
index,
|
||||
new[] { texSizes[index] },
|
||||
[texSizes[index]],
|
||||
texSizeSources));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
setAndBinding.SetIndex,
|
||||
setAndBinding.Binding,
|
||||
1 << component,
|
||||
new[] { temp },
|
||||
new[] { vertexElemOffset }));
|
||||
[temp],
|
||||
[vertexElemOffset]));
|
||||
|
||||
if (needsSextNorm)
|
||||
{
|
||||
|
@ -89,8 +89,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
setAndBinding.SetIndex,
|
||||
setAndBinding.Binding,
|
||||
1,
|
||||
new[] { temp },
|
||||
new[] { vertexElemOffset }));
|
||||
[temp],
|
||||
[vertexElemOffset]));
|
||||
|
||||
if (component > 0)
|
||||
{
|
||||
|
@ -312,21 +312,21 @@ namespace Ryujinx.Graphics.Shader.Translation.Transforms
|
|||
|
||||
private static LinkedListNode<INode> GenerateVertexIdVertexRateLoad(ResourceManager resourceManager, LinkedListNode<INode> node, Operand dest)
|
||||
{
|
||||
Operand[] sources = new Operand[] { Const(resourceManager.LocalVertexIndexVertexRateMemoryId) };
|
||||
Operand[] sources = [Const(resourceManager.LocalVertexIndexVertexRateMemoryId)];
|
||||
|
||||
return node.List.AddBefore(node, new Operation(Instruction.Load, StorageKind.LocalMemory, dest, sources));
|
||||
}
|
||||
|
||||
private static LinkedListNode<INode> GenerateVertexIdInstanceRateLoad(ResourceManager resourceManager, LinkedListNode<INode> node, Operand dest)
|
||||
{
|
||||
Operand[] sources = new Operand[] { Const(resourceManager.LocalVertexIndexInstanceRateMemoryId) };
|
||||
Operand[] sources = [Const(resourceManager.LocalVertexIndexInstanceRateMemoryId)];
|
||||
|
||||
return node.List.AddBefore(node, new Operation(Instruction.Load, StorageKind.LocalMemory, dest, sources));
|
||||
}
|
||||
|
||||
private static LinkedListNode<INode> GenerateInstanceIdLoad(LinkedListNode<INode> node, Operand dest)
|
||||
{
|
||||
Operand[] sources = new Operand[] { Const((int)IoVariable.GlobalId), Const(1) };
|
||||
Operand[] sources = [Const((int)IoVariable.GlobalId), Const(1)];
|
||||
|
||||
return node.List.AddBefore(node, new Operation(Instruction.Load, StorageKind.Input, dest, sources));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue