aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Vulkan/TextureView.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-01 12:31:42 +0200
committerGitHub <noreply@github.com>2023-07-01 12:31:42 +0200
commit801b71a12883f8a104c699a92a9aa997e2a6d609 (patch)
tree65a93c437abe7f598726e2654103ebfa0e62f477 /src/Ryujinx.Graphics.Vulkan/TextureView.cs
parent12c5f6ee89a2e93814d144a2c92acbf3f8a4788f (diff)
[Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378)1.1.946
* 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
Diffstat (limited to 'src/Ryujinx.Graphics.Vulkan/TextureView.cs')
-rw-r--r--src/Ryujinx.Graphics.Vulkan/TextureView.cs55
1 files changed, 25 insertions, 30 deletions
diff --git a/src/Ryujinx.Graphics.Vulkan/TextureView.cs b/src/Ryujinx.Graphics.Vulkan/TextureView.cs
index eb094b3e..6151d5a9 100644
--- a/src/Ryujinx.Graphics.Vulkan/TextureView.cs
+++ b/src/Ryujinx.Graphics.Vulkan/TextureView.cs
@@ -3,6 +3,7 @@ using Ryujinx.Graphics.GAL;
using Silk.NET.Vulkan;
using System;
using System.Collections.Generic;
+using Format = Ryujinx.Graphics.GAL.Format;
using VkBuffer = Silk.NET.Vulkan.Buffer;
using VkFormat = Silk.NET.Vulkan.Format;
@@ -18,9 +19,9 @@ namespace Ryujinx.Graphics.Vulkan
private readonly Auto<DisposableImageView> _imageViewDraw;
private readonly Auto<DisposableImageView> _imageViewIdentity;
private readonly Auto<DisposableImageView> _imageView2dArray;
- private Dictionary<GAL.Format, TextureView> _selfManagedViews;
+ private Dictionary<Format, TextureView> _selfManagedViews;
- private TextureCreateInfo _info;
+ private readonly TextureCreateInfo _info;
public TextureCreateInfo Info => _info;
@@ -68,16 +69,13 @@ namespace Ryujinx.Graphics.Vulkan
var swizzleB = info.SwizzleB.Convert();
var swizzleA = info.SwizzleA.Convert();
- if (info.Format == GAL.Format.R5G5B5A1Unorm ||
- info.Format == GAL.Format.R5G5B5X1Unorm ||
- info.Format == GAL.Format.R5G6B5Unorm)
+ if (info.Format == Format.R5G5B5A1Unorm ||
+ info.Format == Format.R5G5B5X1Unorm ||
+ info.Format == Format.R5G6B5Unorm)
{
- var temp = swizzleR;
-
- swizzleR = swizzleB;
- swizzleB = temp;
+ (swizzleB, swizzleR) = (swizzleR, swizzleB);
}
- else if (VkFormat == VkFormat.R4G4B4A4UnormPack16 || info.Format == GAL.Format.A1B5G5R5Unorm)
+ else if (VkFormat == VkFormat.R4G4B4A4UnormPack16 || info.Format == Format.A1B5G5R5Unorm)
{
var tempB = swizzleB;
var tempA = swizzleA;
@@ -98,13 +96,13 @@ namespace Ryujinx.Graphics.Vulkan
unsafe Auto<DisposableImageView> CreateImageView(ComponentMapping cm, ImageSubresourceRange sr, ImageViewType viewType, ImageUsageFlags usageFlags)
{
- var usage = new ImageViewUsageCreateInfo()
+ var usage = new ImageViewUsageCreateInfo
{
SType = StructureType.ImageViewUsageCreateInfo,
- Usage = usageFlags
+ Usage = usageFlags,
};
- var imageCreateInfo = new ImageViewCreateInfo()
+ var imageCreateInfo = new ImageViewCreateInfo
{
SType = StructureType.ImageViewCreateInfo,
Image = storage.GetImageForViewCreation(),
@@ -112,7 +110,7 @@ namespace Ryujinx.Graphics.Vulkan
Format = format,
Components = cm,
SubresourceRange = sr,
- PNext = &usage
+ PNext = &usage,
};
gd.Api.CreateImageView(device, imageCreateInfo, null, out var imageView).ThrowOnError();
@@ -354,8 +352,9 @@ namespace Ryujinx.Graphics.Vulkan
return;
}
- else if (_gd.FormatCapabilities.OptimalFormatSupports(FormatFeatureFlags.BlitSrcBit, srcFormat) &&
- _gd.FormatCapabilities.OptimalFormatSupports(FormatFeatureFlags.BlitDstBit, dstFormat))
+
+ if (_gd.FormatCapabilities.OptimalFormatSupports(FormatFeatureFlags.BlitSrcBit, srcFormat) &&
+ _gd.FormatCapabilities.OptimalFormatSupports(FormatFeatureFlags.BlitDstBit, dstFormat))
{
TextureCopy.Blit(
_gd.Api,
@@ -444,7 +443,7 @@ namespace Ryujinx.Graphics.Vulkan
int layers,
int levels)
{
- ImageMemoryBarrier memoryBarrier = new ImageMemoryBarrier()
+ ImageMemoryBarrier memoryBarrier = new()
{
SType = StructureType.ImageMemoryBarrier,
SrcAccessMask = srcAccessMask,
@@ -454,7 +453,7 @@ namespace Ryujinx.Graphics.Vulkan
Image = image,
OldLayout = ImageLayout.General,
NewLayout = ImageLayout.General,
- SubresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, (uint)levels, (uint)firstLayer, (uint)layers)
+ SubresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, (uint)levels, (uint)firstLayer, (uint)layers),
};
api.CmdPipelineBarrier(
@@ -470,7 +469,7 @@ namespace Ryujinx.Graphics.Vulkan
memoryBarrier);
}
- public TextureView GetView(GAL.Format format)
+ public TextureView GetView(Format format)
{
if (format == Info.Format)
{
@@ -499,7 +498,7 @@ namespace Ryujinx.Graphics.Vulkan
Info.SwizzleB,
Info.SwizzleA), 0, 0);
- (_selfManagedViews ??= new Dictionary<GAL.Format, TextureView>()).Add(format, view);
+ (_selfManagedViews ??= new Dictionary<Format, TextureView>()).Add(format, view);
return view;
}
@@ -543,10 +542,8 @@ namespace Ryujinx.Graphics.Vulkan
return PinnedSpan<byte>.UnsafeFromSpan(GetData(_gd.CommandBufferPool, resources.GetFlushBuffer()));
}
- else
- {
- return PinnedSpan<byte>.UnsafeFromSpan(GetData(resources.GetPool(), resources.GetFlushBuffer()));
- }
+
+ return PinnedSpan<byte>.UnsafeFromSpan(GetData(resources.GetPool(), resources.GetFlushBuffer()));
}
public PinnedSpan<byte> GetData(int layer, int level)
@@ -559,10 +556,8 @@ namespace Ryujinx.Graphics.Vulkan
return PinnedSpan<byte>.UnsafeFromSpan(GetData(_gd.CommandBufferPool, resources.GetFlushBuffer(), layer, level));
}
- else
- {
- return PinnedSpan<byte>.UnsafeFromSpan(GetData(resources.GetPool(), resources.GetFlushBuffer(), layer, level));
- }
+
+ return PinnedSpan<byte>.UnsafeFromSpan(GetData(resources.GetPool(), resources.GetFlushBuffer(), layer, level));
}
public void CopyTo(BufferRange range, int layer, int level, int stride)
@@ -686,11 +681,11 @@ namespace Ryujinx.Graphics.Vulkan
return length;
}
- private GAL.Format GetCompatibleGalFormat(GAL.Format format)
+ private Format GetCompatibleGalFormat(Format format)
{
if (NeedsD24S8Conversion())
{
- return GAL.Format.D32FloatS8Uint;
+ return Format.D32FloatS8Uint;
}
return format;