aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.GAL')
-rw-r--r--Ryujinx.Graphics.GAL/BlendDescriptor.cs2
-rw-r--r--Ryujinx.Graphics.GAL/BufferAssignment.cs2
-rw-r--r--Ryujinx.Graphics.GAL/BufferHandle.cs12
-rw-r--r--Ryujinx.Graphics.GAL/BufferRange.cs2
-rw-r--r--Ryujinx.Graphics.GAL/Capabilities.cs2
-rw-r--r--Ryujinx.Graphics.GAL/ColorF.cs30
-rw-r--r--Ryujinx.Graphics.GAL/DepthTestDescriptor.cs2
-rw-r--r--Ryujinx.Graphics.GAL/DeviceInfo.cs2
-rw-r--r--Ryujinx.Graphics.GAL/Extents2D.cs2
-rw-r--r--Ryujinx.Graphics.GAL/Extents2DF.cs2
-rw-r--r--Ryujinx.Graphics.GAL/HardwareInfo.cs2
-rw-r--r--Ryujinx.Graphics.GAL/ImageCrop.cs2
-rw-r--r--Ryujinx.Graphics.GAL/MultisampleDescriptor.cs2
-rw-r--r--Ryujinx.Graphics.GAL/ProgramPipelineState.cs2
-rw-r--r--Ryujinx.Graphics.GAL/Rectangle.cs2
-rw-r--r--Ryujinx.Graphics.GAL/SamplerCreateInfo.cs2
-rw-r--r--Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs2
-rw-r--r--Ryujinx.Graphics.GAL/ShaderBindings.cs2
-rw-r--r--Ryujinx.Graphics.GAL/ShaderSource.cs2
-rw-r--r--Ryujinx.Graphics.GAL/StencilTestDescriptor.cs2
-rw-r--r--Ryujinx.Graphics.GAL/TextureCreateInfo.cs20
-rw-r--r--Ryujinx.Graphics.GAL/VertexAttribDescriptor.cs38
-rw-r--r--Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs2
-rw-r--r--Ryujinx.Graphics.GAL/Viewport.cs2
24 files changed, 34 insertions, 106 deletions
diff --git a/Ryujinx.Graphics.GAL/BlendDescriptor.cs b/Ryujinx.Graphics.GAL/BlendDescriptor.cs
index cc1e17c7..83b8afe2 100644
--- a/Ryujinx.Graphics.GAL/BlendDescriptor.cs
+++ b/Ryujinx.Graphics.GAL/BlendDescriptor.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct BlendDescriptor
+ public readonly struct BlendDescriptor
{
public bool Enable { get; }
diff --git a/Ryujinx.Graphics.GAL/BufferAssignment.cs b/Ryujinx.Graphics.GAL/BufferAssignment.cs
index 9f0f56c5..d803d90b 100644
--- a/Ryujinx.Graphics.GAL/BufferAssignment.cs
+++ b/Ryujinx.Graphics.GAL/BufferAssignment.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct BufferAssignment
+ public readonly struct BufferAssignment
{
public readonly int Binding;
public readonly BufferRange Range;
diff --git a/Ryujinx.Graphics.GAL/BufferHandle.cs b/Ryujinx.Graphics.GAL/BufferHandle.cs
index 49f83442..5ba50d19 100644
--- a/Ryujinx.Graphics.GAL/BufferHandle.cs
+++ b/Ryujinx.Graphics.GAL/BufferHandle.cs
@@ -1,22 +1,14 @@
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.GAL
{
[StructLayout(LayoutKind.Sequential, Size = 8)]
- public struct BufferHandle : IEquatable<BufferHandle>
+ public readonly record struct BufferHandle
{
private readonly ulong _value;
public static BufferHandle Null => new BufferHandle(0);
private BufferHandle(ulong value) => _value = value;
-
- public override bool Equals(object obj) => obj is BufferHandle handle && Equals(handle);
- public bool Equals([AllowNull] BufferHandle other) => other._value == _value;
- public override int GetHashCode() => _value.GetHashCode();
- public static bool operator ==(BufferHandle left, BufferHandle right) => left.Equals(right);
- public static bool operator !=(BufferHandle left, BufferHandle right) => !(left == right);
}
}
diff --git a/Ryujinx.Graphics.GAL/BufferRange.cs b/Ryujinx.Graphics.GAL/BufferRange.cs
index 9a030c80..ad9ebee4 100644
--- a/Ryujinx.Graphics.GAL/BufferRange.cs
+++ b/Ryujinx.Graphics.GAL/BufferRange.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct BufferRange
+ public readonly struct BufferRange
{
private static readonly BufferRange _empty = new BufferRange(BufferHandle.Null, 0, 0);
diff --git a/Ryujinx.Graphics.GAL/Capabilities.cs b/Ryujinx.Graphics.GAL/Capabilities.cs
index c4428f17..2d38eccc 100644
--- a/Ryujinx.Graphics.GAL/Capabilities.cs
+++ b/Ryujinx.Graphics.GAL/Capabilities.cs
@@ -2,7 +2,7 @@ using Ryujinx.Graphics.Shader.Translation;
namespace Ryujinx.Graphics.GAL
{
- public struct Capabilities
+ public readonly struct Capabilities
{
public readonly TargetApi Api;
public readonly string VendorName;
diff --git a/Ryujinx.Graphics.GAL/ColorF.cs b/Ryujinx.Graphics.GAL/ColorF.cs
index b3002f8c..235f4229 100644
--- a/Ryujinx.Graphics.GAL/ColorF.cs
+++ b/Ryujinx.Graphics.GAL/ColorF.cs
@@ -1,32 +1,4 @@
-using System;
-
namespace Ryujinx.Graphics.GAL
{
- public struct ColorF : IEquatable<ColorF>
- {
- public float Red { get; }
- public float Green { get; }
- public float Blue { get; }
- public float Alpha { get; }
-
- public ColorF(float red, float green, float blue, float alpha)
- {
- Red = red;
- Green = green;
- Blue = blue;
- Alpha = alpha;
- }
-
- public bool Equals(ColorF color) => Red == color.Red &&
- Green == color.Green &&
- Blue == color.Blue &&
- Alpha == color.Alpha;
-
- public override bool Equals(object obj) => (obj is ColorF color) && Equals(color);
-
- public override int GetHashCode() => HashCode.Combine(Red, Green, Blue, Alpha);
-
- public static bool operator ==(ColorF l, ColorF r) => l.Equals(r);
- public static bool operator !=(ColorF l, ColorF r) => !l.Equals(r);
- }
+ public readonly record struct ColorF(float Red, float Green, float Blue, float Alpha);
}
diff --git a/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs b/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs
index c835e941..4c593392 100644
--- a/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs
+++ b/Ryujinx.Graphics.GAL/DepthTestDescriptor.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct DepthTestDescriptor
+ public readonly struct DepthTestDescriptor
{
public bool TestEnable { get; }
public bool WriteEnable { get; }
diff --git a/Ryujinx.Graphics.GAL/DeviceInfo.cs b/Ryujinx.Graphics.GAL/DeviceInfo.cs
index c525eb60..eb4a016f 100644
--- a/Ryujinx.Graphics.GAL/DeviceInfo.cs
+++ b/Ryujinx.Graphics.GAL/DeviceInfo.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct DeviceInfo
+ public readonly struct DeviceInfo
{
public readonly string Id;
public readonly string Vendor;
diff --git a/Ryujinx.Graphics.GAL/Extents2D.cs b/Ryujinx.Graphics.GAL/Extents2D.cs
index 05b0ce63..bac44f83 100644
--- a/Ryujinx.Graphics.GAL/Extents2D.cs
+++ b/Ryujinx.Graphics.GAL/Extents2D.cs
@@ -2,7 +2,7 @@ using Ryujinx.Common;
namespace Ryujinx.Graphics.GAL
{
- public struct Extents2D
+ public readonly struct Extents2D
{
public int X1 { get; }
public int Y1 { get; }
diff --git a/Ryujinx.Graphics.GAL/Extents2DF.cs b/Ryujinx.Graphics.GAL/Extents2DF.cs
index 8fb263c4..43f0e25e 100644
--- a/Ryujinx.Graphics.GAL/Extents2DF.cs
+++ b/Ryujinx.Graphics.GAL/Extents2DF.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct Extents2DF
+ public readonly struct Extents2DF
{
public float X1 { get; }
public float Y1 { get; }
diff --git a/Ryujinx.Graphics.GAL/HardwareInfo.cs b/Ryujinx.Graphics.GAL/HardwareInfo.cs
index 9baf1924..4dd6849b 100644
--- a/Ryujinx.Graphics.GAL/HardwareInfo.cs
+++ b/Ryujinx.Graphics.GAL/HardwareInfo.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct HardwareInfo
+ public readonly struct HardwareInfo
{
public string GpuVendor { get; }
public string GpuModel { get; }
diff --git a/Ryujinx.Graphics.GAL/ImageCrop.cs b/Ryujinx.Graphics.GAL/ImageCrop.cs
index a7d571de..e8220974 100644
--- a/Ryujinx.Graphics.GAL/ImageCrop.cs
+++ b/Ryujinx.Graphics.GAL/ImageCrop.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct ImageCrop
+ public readonly struct ImageCrop
{
public int Left { get; }
public int Right { get; }
diff --git a/Ryujinx.Graphics.GAL/MultisampleDescriptor.cs b/Ryujinx.Graphics.GAL/MultisampleDescriptor.cs
index 76e56987..a6fb65aa 100644
--- a/Ryujinx.Graphics.GAL/MultisampleDescriptor.cs
+++ b/Ryujinx.Graphics.GAL/MultisampleDescriptor.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct MultisampleDescriptor
+ public readonly struct MultisampleDescriptor
{
public bool AlphaToCoverageEnable { get; }
public bool AlphaToCoverageDitherEnable { get; }
diff --git a/Ryujinx.Graphics.GAL/ProgramPipelineState.cs b/Ryujinx.Graphics.GAL/ProgramPipelineState.cs
index 88728207..41afb34b 100644
--- a/Ryujinx.Graphics.GAL/ProgramPipelineState.cs
+++ b/Ryujinx.Graphics.GAL/ProgramPipelineState.cs
@@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL
/// <summary>
/// Descriptor for a pipeline buffer binding.
/// </summary>
- public struct BufferPipelineDescriptor
+ public readonly struct BufferPipelineDescriptor
{
public bool Enable { get; }
public int Stride { get; }
diff --git a/Ryujinx.Graphics.GAL/Rectangle.cs b/Ryujinx.Graphics.GAL/Rectangle.cs
index 1e207926..c8fa93d9 100644
--- a/Ryujinx.Graphics.GAL/Rectangle.cs
+++ b/Ryujinx.Graphics.GAL/Rectangle.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct Rectangle<T> where T : unmanaged
+ public readonly struct Rectangle<T> where T : unmanaged
{
public T X { get; }
public T Y { get; }
diff --git a/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs b/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs
index fe711c3a..4c514671 100644
--- a/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs
+++ b/Ryujinx.Graphics.GAL/SamplerCreateInfo.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct SamplerCreateInfo
+ public readonly struct SamplerCreateInfo
{
public MinFilter MinFilter { get; }
public MagFilter MagFilter { get; }
diff --git a/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs b/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs
index 227d64b6..129913ec 100644
--- a/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs
+++ b/Ryujinx.Graphics.GAL/ScreenCaptureImageInfo.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct ScreenCaptureImageInfo
+ public readonly struct ScreenCaptureImageInfo
{
public ScreenCaptureImageInfo(int width, int height, bool isBgra, byte[] data, bool flipX, bool flipY)
{
diff --git a/Ryujinx.Graphics.GAL/ShaderBindings.cs b/Ryujinx.Graphics.GAL/ShaderBindings.cs
index ea8e1749..6ab29382 100644
--- a/Ryujinx.Graphics.GAL/ShaderBindings.cs
+++ b/Ryujinx.Graphics.GAL/ShaderBindings.cs
@@ -2,7 +2,7 @@
namespace Ryujinx.Graphics.GAL
{
- public struct ShaderBindings
+ public readonly struct ShaderBindings
{
public IReadOnlyCollection<int> UniformBufferBindings { get; }
public IReadOnlyCollection<int> StorageBufferBindings { get; }
diff --git a/Ryujinx.Graphics.GAL/ShaderSource.cs b/Ryujinx.Graphics.GAL/ShaderSource.cs
index c68ba80d..91d3a632 100644
--- a/Ryujinx.Graphics.GAL/ShaderSource.cs
+++ b/Ryujinx.Graphics.GAL/ShaderSource.cs
@@ -3,7 +3,7 @@ using Ryujinx.Graphics.Shader.Translation;
namespace Ryujinx.Graphics.GAL
{
- public struct ShaderSource
+ public readonly struct ShaderSource
{
public string Code { get; }
public byte[] BinaryCode { get; }
diff --git a/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs b/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs
index 8c9d1644..db46c957 100644
--- a/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs
+++ b/Ryujinx.Graphics.GAL/StencilTestDescriptor.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct StencilTestDescriptor
+ public readonly struct StencilTestDescriptor
{
public bool TestEnable { get; }
diff --git a/Ryujinx.Graphics.GAL/TextureCreateInfo.cs b/Ryujinx.Graphics.GAL/TextureCreateInfo.cs
index 3ccfb700..52b3b11f 100644
--- a/Ryujinx.Graphics.GAL/TextureCreateInfo.cs
+++ b/Ryujinx.Graphics.GAL/TextureCreateInfo.cs
@@ -4,7 +4,7 @@ using System.Numerics;
namespace Ryujinx.Graphics.GAL
{
- public struct TextureCreateInfo : IEquatable<TextureCreateInfo>
+ public readonly struct TextureCreateInfo : IEquatable<TextureCreateInfo>
{
public int Width { get; }
public int Height { get; }
@@ -62,42 +62,42 @@ namespace Ryujinx.Graphics.GAL
SwizzleA = swizzleA;
}
- public readonly int GetMipSize(int level)
+ public int GetMipSize(int level)
{
return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level);
}
- public readonly int GetMipSize2D(int level)
+ public int GetMipSize2D(int level)
{
return GetMipStride(level) * GetLevelHeight(level);
}
- public readonly int GetMipStride(int level)
+ public int GetMipStride(int level)
{
return BitUtils.AlignUp(GetLevelWidth(level) * BytesPerPixel, 4);
}
- private readonly int GetLevelWidth(int level)
+ private int GetLevelWidth(int level)
{
return BitUtils.DivRoundUp(GetLevelSize(Width, level), BlockWidth);
}
- private readonly int GetLevelHeight(int level)
+ private int GetLevelHeight(int level)
{
return BitUtils.DivRoundUp(GetLevelSize(Height, level), BlockHeight);
}
- private readonly int GetLevelDepth(int level)
+ private int GetLevelDepth(int level)
{
return Target == Target.Texture3D ? GetLevelSize(Depth, level) : GetLayers();
}
- public readonly int GetDepthOrLayers()
+ public int GetDepthOrLayers()
{
return Target == Target.Texture3D ? Depth : GetLayers();
}
- public readonly int GetLayers()
+ public int GetLayers()
{
if (Target == Target.Texture2DArray ||
Target == Target.Texture2DMultisampleArray ||
@@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.GAL
return 1;
}
- public readonly int GetLevelsClamped()
+ public int GetLevelsClamped()
{
int maxSize = Width;
diff --git a/Ryujinx.Graphics.GAL/VertexAttribDescriptor.cs b/Ryujinx.Graphics.GAL/VertexAttribDescriptor.cs
index b3248b62..4f5ea6a6 100644
--- a/Ryujinx.Graphics.GAL/VertexAttribDescriptor.cs
+++ b/Ryujinx.Graphics.GAL/VertexAttribDescriptor.cs
@@ -1,40 +1,4 @@
-using System;
-
namespace Ryujinx.Graphics.GAL
{
- public struct VertexAttribDescriptor : IEquatable<VertexAttribDescriptor>
- {
- public int BufferIndex { get; }
- public int Offset { get; }
-
- public bool IsZero { get; }
-
- public Format Format { get; }
-
- public VertexAttribDescriptor(int bufferIndex, int offset, bool isZero, Format format)
- {
- BufferIndex = bufferIndex;
- Offset = offset;
- IsZero = isZero;
- Format = format;
- }
-
- public override bool Equals(object obj)
- {
- return obj is VertexAttribDescriptor other && Equals(other);
- }
-
- public bool Equals(VertexAttribDescriptor other)
- {
- return BufferIndex == other.BufferIndex &&
- Offset == other.Offset &&
- IsZero == other.IsZero &&
- Format == other.Format;
- }
-
- public override int GetHashCode()
- {
- return HashCode.Combine(BufferIndex, Offset, IsZero, Format);
- }
- }
+ public readonly record struct VertexAttribDescriptor(int BufferIndex, int Offset, bool IsZero, Format Format);
}
diff --git a/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs b/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs
index bcd3b28f..15f0dff8 100644
--- a/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs
+++ b/Ryujinx.Graphics.GAL/VertexBufferDescriptor.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct VertexBufferDescriptor
+ public readonly struct VertexBufferDescriptor
{
public BufferRange Buffer { get; }
diff --git a/Ryujinx.Graphics.GAL/Viewport.cs b/Ryujinx.Graphics.GAL/Viewport.cs
index 58135db2..94012c00 100644
--- a/Ryujinx.Graphics.GAL/Viewport.cs
+++ b/Ryujinx.Graphics.GAL/Viewport.cs
@@ -1,6 +1,6 @@
namespace Ryujinx.Graphics.GAL
{
- public struct Viewport
+ public readonly struct Viewport
{
public Rectangle<float> Region { get; }