diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu')
22 files changed, 27 insertions, 42 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/MME/IMacroEE.cs b/Ryujinx.Graphics.Gpu/Engine/MME/IMacroEE.cs index 640687f0..117961db 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MME/IMacroEE.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MME/IMacroEE.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME /// <summary> /// FIFO word. /// </summary> - struct FifoWord + readonly struct FifoWord { /// <summary> /// GPU virtual address where the word is located in memory. diff --git a/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs b/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs index ab6f54ef..719e170f 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME /// <summary> /// Macroo High-level implementation table entry. /// </summary> - struct TableEntry + readonly struct TableEntry { /// <summary> /// Name of the Macro function. diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs index 2af7a402..628eb46a 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// <summary> /// State update callback entry, with the callback function and associated field names. /// </summary> - struct StateUpdateCallbackEntry + readonly struct StateUpdateCallbackEntry { /// <summary> /// Callback function, to be called if the register was written as the state needs to be updated. diff --git a/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs b/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs index 62f41cbb..9ee649d2 100644 --- a/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs +++ b/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// <summary> /// Represents texture format information. /// </summary> - struct FormatInfo + readonly struct FormatInfo { /// <summary> /// A default, generic RGBA8 texture format. diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs index be94f310..febe508b 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingInfo.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// Texture binding information. /// This is used for textures that needs to be accessed from shaders. /// </summary> - struct TextureBindingInfo + readonly struct TextureBindingInfo { /// <summary> /// Shader sampler target type. diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index a6bb5741..16bfc693 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> class TextureCache : IDisposable { - private struct OverlapInfo + private readonly struct OverlapInfo { public TextureViewCompatibility Compatibility { get; } public int FirstLayer { get; } diff --git a/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs b/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs index 9efd1802..ca54dc2f 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// <summary> /// An overlapping texture group with a given view compatibility. /// </summary> - struct TextureIncompatibleOverlap + readonly struct TextureIncompatibleOverlap { public readonly TextureGroup Group; public readonly TextureViewCompatibility Compatibility; diff --git a/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs b/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs index 571f440e..65cc698b 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs @@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// <summary> /// Texture information. /// </summary> - struct TextureInfo + readonly struct TextureInfo { /// <summary> /// Address of the texture in GPU mapped memory. diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferBounds.cs b/Ryujinx.Graphics.Gpu/Memory/BufferBounds.cs index 5569b947..d513b7ad 100644 --- a/Ryujinx.Graphics.Gpu/Memory/BufferBounds.cs +++ b/Ryujinx.Graphics.Gpu/Memory/BufferBounds.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// <summary> /// Memory range used for buffers. /// </summary> - struct BufferBounds + readonly struct BufferBounds { /// <summary> /// Region virtual address. diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs b/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs index 2a140870..b7a0e726 100644 --- a/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs +++ b/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// <summary> /// A buffer binding to apply to a buffer texture. /// </summary> - struct BufferTextureBinding + readonly struct BufferTextureBinding { /// <summary> /// Shader stage accessing the texture. diff --git a/Ryujinx.Graphics.Gpu/Memory/CounterCache.cs b/Ryujinx.Graphics.Gpu/Memory/CounterCache.cs index 90b9187b..e763a899 100644 --- a/Ryujinx.Graphics.Gpu/Memory/CounterCache.cs +++ b/Ryujinx.Graphics.Gpu/Memory/CounterCache.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// </summary> class CounterCache { - private struct CounterEntry + private readonly struct CounterEntry { public ulong Address { get; } public ICounterEvent Event { get; } diff --git a/Ryujinx.Graphics.Gpu/Shader/DiskCache/BackgroundDiskCacheWriter.cs b/Ryujinx.Graphics.Gpu/Shader/DiskCache/BackgroundDiskCacheWriter.cs index 98655ed6..568fe968 100644 --- a/Ryujinx.Graphics.Gpu/Shader/DiskCache/BackgroundDiskCacheWriter.cs +++ b/Ryujinx.Graphics.Gpu/Shader/DiskCache/BackgroundDiskCacheWriter.cs @@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <summary> /// Represents an operation to perform on the <see cref="_fileWriterWorkerQueue"/>. /// </summary> - private struct CacheFileOperationTask + private readonly struct CacheFileOperationTask { /// <summary> /// The type of operation to perform. @@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <summary> /// Background shader cache write information. /// </summary> - private struct AddShaderData + private readonly struct AddShaderData { /// <summary> /// Cached shader program. diff --git a/Ryujinx.Graphics.Gpu/Shader/DiskCache/GuestCodeAndCbData.cs b/Ryujinx.Graphics.Gpu/Shader/DiskCache/GuestCodeAndCbData.cs index 0096533d..959d6e18 100644 --- a/Ryujinx.Graphics.Gpu/Shader/DiskCache/GuestCodeAndCbData.cs +++ b/Ryujinx.Graphics.Gpu/Shader/DiskCache/GuestCodeAndCbData.cs @@ -3,7 +3,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <summary> /// Guest shader code and constant buffer data accessed by the shader. /// </summary> - struct GuestCodeAndCbData + readonly struct GuestCodeAndCbData { /// <summary> /// Maxwell binary shader code. diff --git a/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs b/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs index 9261cb0d..722e66b3 100644 --- a/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs +++ b/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs @@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <summary> /// Program validation entry. /// </summary> - private struct ProgramEntry + private readonly struct ProgramEntry { /// <summary> /// Cached shader program. @@ -90,7 +90,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <summary> /// Translated shader compilation entry. /// </summary> - private struct ProgramCompilation + private readonly struct ProgramCompilation { /// <summary> /// Translated shader stages. @@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache /// <summary> /// Program translation entry. /// </summary> - private struct AsyncProgramTranslation + private readonly struct AsyncProgramTranslation { /// <summary> /// Guest code for each active stage. diff --git a/Ryujinx.Graphics.Gpu/Shader/GpuChannelComputeState.cs b/Ryujinx.Graphics.Gpu/Shader/GpuChannelComputeState.cs index 356d3f3e..b65dd75e 100644 --- a/Ryujinx.Graphics.Gpu/Shader/GpuChannelComputeState.cs +++ b/Ryujinx.Graphics.Gpu/Shader/GpuChannelComputeState.cs @@ -3,7 +3,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// State used by the <see cref="GpuAccessor"/>. /// </summary> - struct GpuChannelComputeState + readonly struct GpuChannelComputeState { // New fields should be added to the end of the struct to keep disk shader cache compatibility. diff --git a/Ryujinx.Graphics.Gpu/Shader/GpuChannelPoolState.cs b/Ryujinx.Graphics.Gpu/Shader/GpuChannelPoolState.cs index b894c57e..1e34c5de 100644 --- a/Ryujinx.Graphics.Gpu/Shader/GpuChannelPoolState.cs +++ b/Ryujinx.Graphics.Gpu/Shader/GpuChannelPoolState.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// State used by the <see cref="GpuAccessor"/>. /// </summary> - struct GpuChannelPoolState : IEquatable<GpuChannelPoolState> + readonly struct GpuChannelPoolState : IEquatable<GpuChannelPoolState> { /// <summary> /// GPU virtual address of the texture pool. diff --git a/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs b/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs index f26fbdbb..e9a4f654 100644 --- a/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs +++ b/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.HashTable /// <summary> /// Entry for a given data size. /// </summary> - private struct SizeEntry + private readonly struct SizeEntry { /// <summary> /// Size for the data that will be stored on the hash table on this entry. diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 23b213b4..5c045d9b 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// </summary> public const TranslationFlags DefaultFlags = TranslationFlags.DebugMode; - private struct TranslatedShader + private readonly struct TranslatedShader { public readonly CachedShaderStage Shader; public readonly ShaderProgram Program; @@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gpu.Shader } } - private struct TranslatedShaderVertexPair + private readonly struct TranslatedShaderVertexPair { public readonly CachedShaderStage VertexA; public readonly CachedShaderStage VertexB; @@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Gpu.Shader private readonly Dictionary<ulong, CachedShaderProgram> _cpPrograms; private readonly Dictionary<ShaderAddresses, CachedShaderProgram> _gpPrograms; - private struct ProgramToSave + private readonly struct ProgramToSave { public readonly CachedShaderProgram CachedProgram; public readonly IProgram HostProgram; diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCodeAccessor.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCodeAccessor.cs index dbb33d22..e896493c 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCodeAccessor.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCodeAccessor.cs @@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// Shader code accessor. /// </summary> - struct ShaderCodeAccessor : IDataAccessor + readonly struct ShaderCodeAccessor : IDataAccessor { private readonly MemoryManager _memoryManager; private readonly ulong _baseAddress; diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs index f96a8ce1..6ca7daef 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// Paths where shader code was dumped on disk. /// </summary> - struct ShaderDumpPaths + readonly struct ShaderDumpPaths { /// <summary> /// Path where the full shader code with header was dumped, or null if not dumped. diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs index 14f64bbf..872aaf67 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs @@ -121,7 +121,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// Texture binding information, used to identify each texture accessed by the shader. /// </summary> - private struct TextureKey : IEquatable<TextureKey> + private readonly record struct TextureKey { // New fields should be added to the end of the struct to keep disk shader cache compatibility. @@ -152,21 +152,6 @@ namespace Ryujinx.Graphics.Gpu.Shader Handle = handle; CbufSlot = cbufSlot; } - - public override bool Equals(object obj) - { - return obj is TextureKey textureKey && Equals(textureKey); - } - - public bool Equals(TextureKey other) - { - return StageIndex == other.StageIndex && Handle == other.Handle && CbufSlot == other.CbufSlot; - } - - public override int GetHashCode() - { - return HashCode.Combine(StageIndex, Handle, CbufSlot); - } } private readonly Dictionary<TextureKey, Box<TextureSpecializationState>> _textureSpecialization; diff --git a/Ryujinx.Graphics.Gpu/Window.cs b/Ryujinx.Graphics.Gpu/Window.cs index 18320c74..c116d946 100644 --- a/Ryujinx.Graphics.Gpu/Window.cs +++ b/Ryujinx.Graphics.Gpu/Window.cs @@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Gpu /// <summary> /// Texture presented on the window. /// </summary> - private struct PresentationTexture + private readonly struct PresentationTexture { /// <summary> /// Texture cache where the texture might be located. |
