diff --git a/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs b/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs index 021388f81..ad0ccd23b 100644 --- a/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs +++ b/src/Ryujinx.Graphics.OpenGL/Effects/ShaderHelper.cs @@ -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) diff --git a/src/Ryujinx.Graphics.OpenGL/Effects/SmaaPostProcessingEffect.cs b/src/Ryujinx.Graphics.OpenGL/Effects/SmaaPostProcessingEffect.cs index a31c10891..27120a015 100644 --- a/src/Ryujinx.Graphics.OpenGL/Effects/SmaaPostProcessingEffect.cs +++ b/src/Ryujinx.Graphics.OpenGL/Effects/SmaaPostProcessingEffect.cs @@ -44,11 +44,11 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa { _renderer = renderer; - _edgeShaderPrograms = Array.Empty(); - _blendShaderPrograms = Array.Empty(); - _neighbourShaderPrograms = Array.Empty(); + _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; @@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa string blendShaderData = EmbeddedResources.ReadAllText("Ryujinx.Graphics.OpenGL/Effects/Shaders/smaa_blend.glsl"); string neighbourShaderData = EmbeddedResources.ReadAllText("Ryujinx.Graphics.OpenGL/Effects/Shaders/smaa_neighbour.glsl"); - string[] shaders = new string[] { presets, edgeShaderData }; + string[] shaders = [presets, edgeShaderData]; int edgeProgram = ShaderHelper.CompileProgram(shaders, ShaderType.ComputeShader); shaders[1] = blendShaderData; diff --git a/src/Ryujinx.Graphics.OpenGL/Image/IntermmediatePool.cs b/src/Ryujinx.Graphics.OpenGL/Image/IntermmediatePool.cs index 64ee73fbe..1bcc13ab4 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/IntermmediatePool.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/IntermmediatePool.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.OpenGL.Image public IntermediatePool(OpenGLRenderer renderer) { _renderer = renderer; - _entries = new List(); + _entries = []; } public TextureView GetOrCreateWithAtLeast( diff --git a/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs b/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs index 1a94660b5..648ba1bc2 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/TextureCopyIncompatible.cs @@ -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]; diff --git a/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs index 2c7b8f98c..84bb86a2d 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs @@ -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) { diff --git a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs index 83319ea6d..36db655ad 100644 --- a/src/Ryujinx.Graphics.OpenGL/Pipeline.cs +++ b/src/Ryujinx.Graphics.OpenGL/Pipeline.cs @@ -35,8 +35,8 @@ namespace Ryujinx.Graphics.OpenGL private bool _stencilTestEnable; private bool _cullEnable; - private float[] _viewportArray = Array.Empty(); - private double[] _depthRangeArray = Array.Empty(); + 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)) { diff --git a/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs b/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs index c8ff30a07..352728813 100644 --- a/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs +++ b/src/Ryujinx.Graphics.OpenGL/ResourcePool.cs @@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.OpenGL { if (!_textures.TryGetValue(view.Info, out List list)) { - list = new List(); + list = []; _textures.Add(view.Info, list); } diff --git a/src/Ryujinx.Graphics.OpenGL/Sync.cs b/src/Ryujinx.Graphics.OpenGL/Sync.cs index e8f7ebc00..9fd7db9d1 100644 --- a/src/Ryujinx.Graphics.OpenGL/Sync.cs +++ b/src/Ryujinx.Graphics.OpenGL/Sync.cs @@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.OpenGL private ulong _firstHandle = 0; private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit; - private readonly List _handles = new(); + private readonly List _handles = []; public void Create(ulong id) {