[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
This commit is contained in:
parent
12c5f6ee89
commit
801b71a128
72 changed files with 1134 additions and 1230 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue