aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/TextureCreateInfo.cs
diff options
context:
space:
mode:
authorAndrey Sukharev <SukharevAndrey@users.noreply.github.com>2022-12-05 16:47:39 +0300
committerGitHub <noreply@github.com>2022-12-05 14:47:39 +0100
commit4da44e09cb2a32f69b4a6b47221117b78e4618dc (patch)
treec3648a09202374dabff6fac472fe341bf9e1f0ee /Ryujinx.Graphics.GAL/TextureCreateInfo.cs
parentae13f0ab4da5b371bba746c1bd6598baaa44585d (diff)
Make structs readonly when applicable (#4002)
* Make all structs readonly when applicable. It should reduce amount of needless defensive copies * Make structs with trivial boilerplate equality code record structs * Remove unnecessary readonly modifiers from TextureCreateInfo * Make BitMap structs readonly too
Diffstat (limited to 'Ryujinx.Graphics.GAL/TextureCreateInfo.cs')
-rw-r--r--Ryujinx.Graphics.GAL/TextureCreateInfo.cs20
1 files changed, 10 insertions, 10 deletions
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;