misc: chore: Use collection expressions in Shader project
This commit is contained in:
@@ -107,11 +107,11 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
ushort low = (ushort)(immH0 << 6);
|
||||
ushort high = (ushort)(immH1 << 6);
|
||||
|
||||
return new Operand[]
|
||||
{
|
||||
return
|
||||
[
|
||||
ConstF((float)Unsafe.As<ushort, Half>(ref low)),
|
||||
ConstF((float)Unsafe.As<ushort, Half>(ref high)),
|
||||
};
|
||||
ConstF((float)Unsafe.As<ushort, Half>(ref high))
|
||||
];
|
||||
}
|
||||
|
||||
public static Operand[] GetHalfSrc(EmitterContext context, int imm32)
|
||||
@@ -119,11 +119,11 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
ushort low = (ushort)imm32;
|
||||
ushort high = (ushort)(imm32 >> 16);
|
||||
|
||||
return new Operand[]
|
||||
{
|
||||
return
|
||||
[
|
||||
ConstF((float)Unsafe.As<ushort, Half>(ref low)),
|
||||
ConstF((float)Unsafe.As<ushort, Half>(ref high)),
|
||||
};
|
||||
ConstF((float)Unsafe.As<ushort, Half>(ref high))
|
||||
];
|
||||
}
|
||||
|
||||
public static Operand[] FPAbsNeg(EmitterContext context, Operand[] operands, bool abs, bool neg)
|
||||
@@ -140,22 +140,22 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
{
|
||||
return swizzle switch
|
||||
{
|
||||
HalfSwizzle.F16 => new Operand[]
|
||||
{
|
||||
context.UnpackHalf2x16Low (src),
|
||||
context.UnpackHalf2x16High(src),
|
||||
},
|
||||
HalfSwizzle.F32 => new Operand[] { src, src },
|
||||
HalfSwizzle.H0H0 => new Operand[]
|
||||
{
|
||||
context.UnpackHalf2x16Low(src),
|
||||
context.UnpackHalf2x16Low(src),
|
||||
},
|
||||
HalfSwizzle.H1H1 => new Operand[]
|
||||
{
|
||||
context.UnpackHalf2x16High(src),
|
||||
context.UnpackHalf2x16High(src),
|
||||
},
|
||||
HalfSwizzle.F16 =>
|
||||
[
|
||||
context.UnpackHalf2x16Low (src),
|
||||
context.UnpackHalf2x16High(src)
|
||||
],
|
||||
HalfSwizzle.F32 => [src, src],
|
||||
HalfSwizzle.H0H0 =>
|
||||
[
|
||||
context.UnpackHalf2x16Low(src),
|
||||
context.UnpackHalf2x16Low(src)
|
||||
],
|
||||
HalfSwizzle.H1H1 =>
|
||||
[
|
||||
context.UnpackHalf2x16High(src),
|
||||
context.UnpackHalf2x16High(src)
|
||||
],
|
||||
_ => throw new ArgumentException($"Invalid swizzle \"{swizzle}\"."),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
|
||||
Operand d = Register(dest, RegisterType.Gpr);
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
return context.Copy(Register(srcA++, RegisterType.Gpr));
|
||||
}
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
@@ -500,7 +500,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
return context.Copy(Register(srcB++, RegisterType.Gpr));
|
||||
}
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
@@ -605,7 +605,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
return context.Copy(Register(srcB++, RegisterType.Gpr));
|
||||
}
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
{
|
||||
private static readonly int[][] _maskLut = new int[][]
|
||||
{
|
||||
new int[] { 0b0001, 0b0010, 0b0100, 0b1000, 0b0011, 0b1001, 0b1010, 0b1100 },
|
||||
new int[] { 0b0111, 0b1011, 0b1101, 0b1110, 0b1111, 0b0000, 0b0000, 0b0000 },
|
||||
[0b0001, 0b0010, 0b0100, 0b1000, 0b0011, 0b1001, 0b1010, 0b1100], [0b0111, 0b1011, 0b1101, 0b1110, 0b1111, 0b0000, 0b0000, 0b0000
|
||||
],
|
||||
};
|
||||
|
||||
public const bool Sample1DAs2D = true;
|
||||
@@ -202,7 +202,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
|
||||
Operand arrayIndex = isArray ? Ra() : null;
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
@@ -339,7 +339,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
return;
|
||||
}
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
Operand Ra()
|
||||
{
|
||||
@@ -605,8 +605,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
|
||||
Operand[] sources = sourcesList.ToArray();
|
||||
|
||||
Operand[] rd0 = new Operand[2] { ConstF(0), ConstF(0) };
|
||||
Operand[] rd1 = new Operand[2] { ConstF(0), ConstF(0) };
|
||||
Operand[] rd0 = [ConstF(0), ConstF(0)];
|
||||
Operand[] rd1 = [ConstF(0), ConstF(0)];
|
||||
|
||||
int handle = imm;
|
||||
int componentMask = _maskLut[dest2 == RegisterConsts.RegisterZeroIndex ? 0 : 1][writeMask];
|
||||
@@ -701,7 +701,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
|
||||
Operand arrayIndex = isArray ? Ra() : null;
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
SamplerType type = ConvertSamplerType(dimensions);
|
||||
TextureFlags flags = TextureFlags.Gather;
|
||||
@@ -835,7 +835,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
|
||||
TextureFlags flags = TextureFlags.None;
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
@@ -963,7 +963,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
|
||||
TextureFlags flags = TextureFlags.Derivatives;
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
@@ -1076,7 +1076,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
return context.Copy(Register(srcA++, RegisterType.Gpr));
|
||||
}
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
List<Operand> sourcesList = [];
|
||||
|
||||
if (isBindless)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user