misc: chore: Use collection expressions

This commit is contained in:
KeatonTheBot 2025-03-06 20:46:29 -06:00
parent 4d5757417e
commit e2973a875a
236 changed files with 9843 additions and 7561 deletions

View file

@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects
{
public static int CompileProgram(string shaderCode, ShaderType shaderType)
{
return CompileProgram(new string[] { shaderCode }, shaderType);
return CompileProgram([shaderCode], shaderType);
}
public static int CompileProgram(string[] shaders, ShaderType shaderType)

View file

@ -43,11 +43,11 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
{
_renderer = renderer;
_edgeShaderPrograms = Array.Empty<int>();
_blendShaderPrograms = Array.Empty<int>();
_neighbourShaderPrograms = Array.Empty<int>();
_edgeShaderPrograms = [];
_blendShaderPrograms = [];
_neighbourShaderPrograms = [];
_qualities = new string[] { "SMAA_PRESET_LOW", "SMAA_PRESET_MEDIUM", "SMAA_PRESET_HIGH", "SMAA_PRESET_ULTRA" };
_qualities = ["SMAA_PRESET_LOW", "SMAA_PRESET_MEDIUM", "SMAA_PRESET_HIGH", "SMAA_PRESET_ULTRA"];
Quality = quality;

View file

@ -190,7 +190,8 @@ void main()
{
int csHandle = GL.CreateShader(ShaderType.ComputeShader);
string[] formatTable = new[] { "r8ui", "r16ui", "r32ui", "rg8ui", "rg16ui", "rg32ui", "rgba8ui", "rgba16ui", "rgba32ui" };
string[] formatTable = ["r8ui", "r16ui", "r32ui", "rg8ui", "rg16ui", "rg32ui", "rgba8ui", "rgba16ui", "rgba32ui"
];
string srcFormat = formatTable[srcIndex];
string dstFormat = formatTable[dstIndex];

View file

@ -67,13 +67,13 @@ namespace Ryujinx.Graphics.OpenGL.Image
GL.BindTexture(target, Handle);
int[] swizzleRgba = new int[]
{
int[] swizzleRgba =
[
(int)Info.SwizzleR.Convert(),
(int)Info.SwizzleG.Convert(),
(int)Info.SwizzleB.Convert(),
(int)Info.SwizzleA.Convert(),
};
(int)Info.SwizzleA.Convert()
];
if (Info.Format == Format.A1B5G5R5Unorm)
{

View file

@ -35,8 +35,8 @@ namespace Ryujinx.Graphics.OpenGL
private bool _stencilTestEnable;
private bool _cullEnable;
private float[] _viewportArray = Array.Empty<float>();
private double[] _depthRangeArray = Array.Empty<double>();
private float[] _viewportArray = [];
private double[] _depthRangeArray = [];
private int _boundDrawFramebuffer;
private int _boundReadFramebuffer;
@ -111,7 +111,7 @@ namespace Ryujinx.Graphics.OpenGL
(componentMask & 4) != 0,
(componentMask & 8) != 0);
float[] colors = new float[] { color.Red, color.Green, color.Blue, color.Alpha };
float[] colors = [color.Red, color.Green, color.Blue, color.Alpha];
if (layer != 0 || layerCount != _framebuffer.GetColorLayerCount(index))
{