mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-24 19:27:11 +02:00
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
This commit is contained in:
parent
ae13f0ab4d
commit
4da44e09cb
133 changed files with 156 additions and 378 deletions
|
@ -1,6 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct BitMap
|
||||
readonly struct BitMap
|
||||
{
|
||||
public const int IntSize = 64;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct BufferState : IDisposable
|
||||
readonly struct BufferState : IDisposable
|
||||
{
|
||||
public static BufferState Null => new BufferState(null, 0, 0);
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
}
|
||||
|
||||
struct TopologyConversionIndirectCacheKey : ICacheKey
|
||||
readonly struct TopologyConversionIndirectCacheKey : ICacheKey
|
||||
{
|
||||
private readonly TopologyConversionCacheKey _baseKey;
|
||||
private readonly BufferHolder _indirectDataBuffer;
|
||||
|
@ -178,7 +178,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
}
|
||||
|
||||
struct Dependency
|
||||
readonly struct Dependency
|
||||
{
|
||||
private readonly BufferHolder _buffer;
|
||||
private readonly int _offset;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct CommandBufferScoped : IDisposable
|
||||
readonly struct CommandBufferScoped : IDisposable
|
||||
{
|
||||
private readonly CommandBufferPool _pool;
|
||||
public CommandBuffer CommandBuffer { get; }
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableBuffer : IDisposable
|
||||
readonly struct DisposableBuffer : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableBufferView : System.IDisposable
|
||||
readonly struct DisposableBufferView : System.IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableFramebuffer : IDisposable
|
||||
readonly struct DisposableFramebuffer : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableImage : IDisposable
|
||||
readonly struct DisposableImage : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableImageView : IDisposable
|
||||
readonly struct DisposableImageView : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableMemory : IDisposable
|
||||
readonly struct DisposableMemory : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposablePipeline : IDisposable
|
||||
readonly struct DisposablePipeline : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableRenderPass : IDisposable
|
||||
readonly struct DisposableRenderPass : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct DisposableSampler : IDisposable
|
||||
readonly struct DisposableSampler : IDisposable
|
||||
{
|
||||
private readonly Vk _api;
|
||||
private readonly Device _device;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct HardwareCapabilities
|
||||
readonly struct HardwareCapabilities
|
||||
{
|
||||
public readonly bool SupportsIndexTypeUint8;
|
||||
public readonly bool SupportsCustomBorderColor;
|
||||
|
|
|
@ -3,7 +3,7 @@ using System;
|
|||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
struct MemoryAllocation : IDisposable
|
||||
readonly struct MemoryAllocation : IDisposable
|
||||
{
|
||||
private readonly MemoryAllocatorBlockList _owner;
|
||||
private readonly MemoryAllocatorBlockList.Block _block;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
public ulong Size { get; }
|
||||
public bool Mapped => HostPointer != IntPtr.Zero;
|
||||
|
||||
private struct Range : IComparable<Range>
|
||||
private readonly struct Range : IComparable<Range>
|
||||
{
|
||||
public ulong Offset { get; }
|
||||
public ulong Size { get; }
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
private readonly VulkanRenderer _gd;
|
||||
private readonly BufferHolder _buffer;
|
||||
|
||||
private struct PendingCopy
|
||||
private readonly struct PendingCopy
|
||||
{
|
||||
public FenceHolder Fence { get; }
|
||||
public int Size { get; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue