mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-02-24 06:04:33 +01:00
misc: chore: Use collection expressions in OpenGL project
This commit is contained in:
parent
aa0cb50c5d
commit
a5dbcb75d0
@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects
|
|||||||
{
|
{
|
||||||
public static int CompileProgram(string shaderCode, ShaderType shaderType)
|
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)
|
public static int CompileProgram(string[] shaders, ShaderType shaderType)
|
||||||
|
@ -44,11 +44,11 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
|
|||||||
{
|
{
|
||||||
_renderer = renderer;
|
_renderer = renderer;
|
||||||
|
|
||||||
_edgeShaderPrograms = Array.Empty<int>();
|
_edgeShaderPrograms = [];
|
||||||
_blendShaderPrograms = Array.Empty<int>();
|
_blendShaderPrograms = [];
|
||||||
_neighbourShaderPrograms = Array.Empty<int>();
|
_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;
|
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 blendShaderData = EmbeddedResources.ReadAllText("Ryujinx.Graphics.OpenGL/Effects/Shaders/smaa_blend.glsl");
|
||||||
string neighbourShaderData = EmbeddedResources.ReadAllText("Ryujinx.Graphics.OpenGL/Effects/Shaders/smaa_neighbour.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);
|
int edgeProgram = ShaderHelper.CompileProgram(shaders, ShaderType.ComputeShader);
|
||||||
|
|
||||||
shaders[1] = blendShaderData;
|
shaders[1] = blendShaderData;
|
||||||
|
@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
|||||||
public IntermediatePool(OpenGLRenderer renderer)
|
public IntermediatePool(OpenGLRenderer renderer)
|
||||||
{
|
{
|
||||||
_renderer = renderer;
|
_renderer = renderer;
|
||||||
_entries = new List<TextureView>();
|
_entries = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextureView GetOrCreateWithAtLeast(
|
public TextureView GetOrCreateWithAtLeast(
|
||||||
|
@ -190,7 +190,8 @@ void main()
|
|||||||
{
|
{
|
||||||
int csHandle = GL.CreateShader(ShaderType.ComputeShader);
|
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 srcFormat = formatTable[srcIndex];
|
||||||
string dstFormat = formatTable[dstIndex];
|
string dstFormat = formatTable[dstIndex];
|
||||||
|
@ -67,13 +67,13 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
|||||||
|
|
||||||
GL.BindTexture(target, Handle);
|
GL.BindTexture(target, Handle);
|
||||||
|
|
||||||
int[] swizzleRgba = new int[]
|
int[] swizzleRgba =
|
||||||
{
|
[
|
||||||
(int)Info.SwizzleR.Convert(),
|
(int)Info.SwizzleR.Convert(),
|
||||||
(int)Info.SwizzleG.Convert(),
|
(int)Info.SwizzleG.Convert(),
|
||||||
(int)Info.SwizzleB.Convert(),
|
(int)Info.SwizzleB.Convert(),
|
||||||
(int)Info.SwizzleA.Convert(),
|
(int)Info.SwizzleA.Convert()
|
||||||
};
|
];
|
||||||
|
|
||||||
if (Info.Format == Format.A1B5G5R5Unorm)
|
if (Info.Format == Format.A1B5G5R5Unorm)
|
||||||
{
|
{
|
||||||
|
@ -35,8 +35,8 @@ namespace Ryujinx.Graphics.OpenGL
|
|||||||
private bool _stencilTestEnable;
|
private bool _stencilTestEnable;
|
||||||
private bool _cullEnable;
|
private bool _cullEnable;
|
||||||
|
|
||||||
private float[] _viewportArray = Array.Empty<float>();
|
private float[] _viewportArray = [];
|
||||||
private double[] _depthRangeArray = Array.Empty<double>();
|
private double[] _depthRangeArray = [];
|
||||||
|
|
||||||
private int _boundDrawFramebuffer;
|
private int _boundDrawFramebuffer;
|
||||||
private int _boundReadFramebuffer;
|
private int _boundReadFramebuffer;
|
||||||
@ -111,7 +111,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||||||
(componentMask & 4) != 0,
|
(componentMask & 4) != 0,
|
||||||
(componentMask & 8) != 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))
|
if (layer != 0 || layerCount != _framebuffer.GetColorLayerCount(index))
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||||||
{
|
{
|
||||||
if (!_textures.TryGetValue(view.Info, out List<DisposedTexture> list))
|
if (!_textures.TryGetValue(view.Info, out List<DisposedTexture> list))
|
||||||
{
|
{
|
||||||
list = new List<DisposedTexture>();
|
list = [];
|
||||||
_textures.Add(view.Info, list);
|
_textures.Add(view.Info, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||||||
private ulong _firstHandle = 0;
|
private ulong _firstHandle = 0;
|
||||||
private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit;
|
private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit;
|
||||||
|
|
||||||
private readonly List<SyncHandle> _handles = new();
|
private readonly List<SyncHandle> _handles = [];
|
||||||
|
|
||||||
public void Create(ulong id)
|
public void Create(ulong id)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user