From 801b71a12883f8a104c699a92a9aa997e2a6d609 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 1 Jul 2023 12:31:42 +0200 Subject: [Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378) * dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0059 warnings * Address dotnet format CA1816 warnings * Fix new dotnet-format issues after rebase * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Another rebase, another dotnet format run * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Run dotnet format after rebase * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Remove redundant code * Rename generics * Address review feedback * Remove SetOrigin --- src/Ryujinx.Graphics.Vulkan/TextureStorage.cs | 39 ++++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/Ryujinx.Graphics.Vulkan/TextureStorage.cs') diff --git a/src/Ryujinx.Graphics.Vulkan/TextureStorage.cs b/src/Ryujinx.Graphics.Vulkan/TextureStorage.cs index 4edb6f2f..2a51c132 100644 --- a/src/Ryujinx.Graphics.Vulkan/TextureStorage.cs +++ b/src/Ryujinx.Graphics.Vulkan/TextureStorage.cs @@ -4,6 +4,7 @@ using Silk.NET.Vulkan; using System; using System.Collections.Generic; using System.Numerics; +using Format = Ryujinx.Graphics.GAL.Format; using VkBuffer = Silk.NET.Vulkan.Buffer; using VkFormat = Silk.NET.Vulkan.Format; @@ -42,7 +43,7 @@ namespace Ryujinx.Graphics.Vulkan private readonly Auto _allocationAuto; private Auto _foreignAllocationAuto; - private Dictionary _aliasedStorages; + private Dictionary _aliasedStorages; private AccessFlags _lastModificationAccess; private PipelineStageFlags _lastModificationStage; @@ -50,7 +51,7 @@ namespace Ryujinx.Graphics.Vulkan private PipelineStageFlags _lastReadStage; private int _viewsCount; - private ulong _size; + private readonly ulong _size; public VkFormat VkFormat { get; } public float ScaleFactor { get; } @@ -98,7 +99,7 @@ namespace Ryujinx.Graphics.Vulkan flags |= ImageCreateFlags.Create2DArrayCompatibleBit; } - var imageCreateInfo = new ImageCreateInfo() + var imageCreateInfo = new ImageCreateInfo { SType = StructureType.ImageCreateInfo, ImageType = type, @@ -111,7 +112,7 @@ namespace Ryujinx.Graphics.Vulkan Usage = usage, SharingMode = SharingMode.Exclusive, InitialLayout = ImageLayout.Undefined, - Flags = flags + Flags = flags, }; gd.Api.CreateImage(device, imageCreateInfo, null, out _image).ThrowOnError(); @@ -150,27 +151,27 @@ namespace Ryujinx.Graphics.Vulkan } } - public TextureStorage CreateAliasedColorForDepthStorageUnsafe(GAL.Format format) + public TextureStorage CreateAliasedColorForDepthStorageUnsafe(Format format) { var colorFormat = format switch { - GAL.Format.S8Uint => GAL.Format.R8Unorm, - GAL.Format.D16Unorm => GAL.Format.R16Unorm, - GAL.Format.S8UintD24Unorm => GAL.Format.R8G8B8A8Unorm, - GAL.Format.D32Float => GAL.Format.R32Float, - GAL.Format.D24UnormS8Uint => GAL.Format.R8G8B8A8Unorm, - GAL.Format.D32FloatS8Uint => GAL.Format.R32G32Float, - _ => throw new ArgumentException($"\"{format}\" is not a supported depth or stencil format.") + Format.S8Uint => Format.R8Unorm, + Format.D16Unorm => Format.R16Unorm, + Format.S8UintD24Unorm => Format.R8G8B8A8Unorm, + Format.D32Float => Format.R32Float, + Format.D24UnormS8Uint => Format.R8G8B8A8Unorm, + Format.D32FloatS8Uint => Format.R32G32Float, + _ => throw new ArgumentException($"\"{format}\" is not a supported depth or stencil format."), }; return CreateAliasedStorageUnsafe(colorFormat); } - public TextureStorage CreateAliasedStorageUnsafe(GAL.Format format) + public TextureStorage CreateAliasedStorageUnsafe(Format format) { if (_aliasedStorages == null || !_aliasedStorages.TryGetValue(format, out var storage)) { - _aliasedStorages ??= new Dictionary(); + _aliasedStorages ??= new Dictionary(); var info = NewCreateInfoWith(ref _info, format, _info.BytesPerPixel); @@ -182,14 +183,14 @@ namespace Ryujinx.Graphics.Vulkan return storage; } - public static TextureCreateInfo NewCreateInfoWith(ref TextureCreateInfo info, GAL.Format format, int bytesPerPixel) + public static TextureCreateInfo NewCreateInfoWith(ref TextureCreateInfo info, Format format, int bytesPerPixel) { return NewCreateInfoWith(ref info, format, bytesPerPixel, info.Width, info.Height); } public static TextureCreateInfo NewCreateInfoWith( ref TextureCreateInfo info, - GAL.Format format, + Format format, int bytesPerPixel, int width, int height) @@ -262,7 +263,7 @@ namespace Ryujinx.Graphics.Vulkan var subresourceRange = new ImageSubresourceRange(aspectFlags, 0, (uint)_info.Levels, 0, (uint)_info.GetLayers()); - var barrier = new ImageMemoryBarrier() + var barrier = new ImageMemoryBarrier { SType = StructureType.ImageMemoryBarrier, SrcAccessMask = 0, @@ -272,7 +273,7 @@ namespace Ryujinx.Graphics.Vulkan SrcQueueFamilyIndex = Vk.QueueFamilyIgnored, DstQueueFamilyIndex = Vk.QueueFamilyIgnored, Image = _imageAuto.Get(cbs).Value, - SubresourceRange = subresourceRange + SubresourceRange = subresourceRange, }; _gd.Api.CmdPipelineBarrier( @@ -293,7 +294,7 @@ namespace Ryujinx.Graphics.Vulkan } } - public static ImageUsageFlags GetImageUsage(GAL.Format format, Target target, bool supportsMsStorage) + public static ImageUsageFlags GetImageUsage(Format format, Target target, bool supportsMsStorage) { var usage = DefaultUsageFlags; -- cgit v1.2.3