[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
|
@ -2,8 +2,11 @@
|
|||
using Ryujinx.Graphics.Shader;
|
||||
using Silk.NET.Vulkan;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Buffer = Silk.NET.Vulkan.Buffer;
|
||||
using CompareOp = Ryujinx.Graphics.GAL.CompareOp;
|
||||
using Format = Ryujinx.Graphics.GAL.Format;
|
||||
using SamplerCreateInfo = Ryujinx.Graphics.GAL.SamplerCreateInfo;
|
||||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
|
@ -14,25 +17,25 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
private ShaderCollection _program;
|
||||
|
||||
private Auto<DisposableBuffer>[] _uniformBufferRefs;
|
||||
private Auto<DisposableBuffer>[] _storageBufferRefs;
|
||||
private Auto<DisposableImageView>[] _textureRefs;
|
||||
private Auto<DisposableSampler>[] _samplerRefs;
|
||||
private Auto<DisposableImageView>[] _imageRefs;
|
||||
private TextureBuffer[] _bufferTextureRefs;
|
||||
private TextureBuffer[] _bufferImageRefs;
|
||||
private GAL.Format[] _bufferImageFormats;
|
||||
private readonly Auto<DisposableBuffer>[] _uniformBufferRefs;
|
||||
private readonly Auto<DisposableBuffer>[] _storageBufferRefs;
|
||||
private readonly Auto<DisposableImageView>[] _textureRefs;
|
||||
private readonly Auto<DisposableSampler>[] _samplerRefs;
|
||||
private readonly Auto<DisposableImageView>[] _imageRefs;
|
||||
private readonly TextureBuffer[] _bufferTextureRefs;
|
||||
private readonly TextureBuffer[] _bufferImageRefs;
|
||||
private readonly Format[] _bufferImageFormats;
|
||||
|
||||
private DescriptorBufferInfo[] _uniformBuffers;
|
||||
private DescriptorBufferInfo[] _storageBuffers;
|
||||
private DescriptorImageInfo[] _textures;
|
||||
private DescriptorImageInfo[] _images;
|
||||
private BufferView[] _bufferTextures;
|
||||
private BufferView[] _bufferImages;
|
||||
private readonly DescriptorBufferInfo[] _uniformBuffers;
|
||||
private readonly DescriptorBufferInfo[] _storageBuffers;
|
||||
private readonly DescriptorImageInfo[] _textures;
|
||||
private readonly DescriptorImageInfo[] _images;
|
||||
private readonly BufferView[] _bufferTextures;
|
||||
private readonly BufferView[] _bufferImages;
|
||||
|
||||
private bool[] _uniformSet;
|
||||
private bool[] _storageSet;
|
||||
private Silk.NET.Vulkan.Buffer _cachedSupportBuffer;
|
||||
private readonly bool[] _uniformSet;
|
||||
private readonly bool[] _storageSet;
|
||||
private Buffer _cachedSupportBuffer;
|
||||
|
||||
[Flags]
|
||||
private enum DirtyFlags
|
||||
|
@ -42,7 +45,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Storage = 1 << 1,
|
||||
Texture = 1 << 2,
|
||||
Image = 1 << 3,
|
||||
All = Uniform | Storage | Texture | Image
|
||||
All = Uniform | Storage | Texture | Image,
|
||||
}
|
||||
|
||||
private DirtyFlags _dirty;
|
||||
|
@ -66,7 +69,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_imageRefs = new Auto<DisposableImageView>[Constants.MaxImageBindings * 2];
|
||||
_bufferTextureRefs = new TextureBuffer[Constants.MaxTextureBindings * 2];
|
||||
_bufferImageRefs = new TextureBuffer[Constants.MaxImageBindings * 2];
|
||||
_bufferImageFormats = new GAL.Format[Constants.MaxImageBindings * 2];
|
||||
_bufferImageFormats = new Format[Constants.MaxImageBindings * 2];
|
||||
|
||||
_uniformBuffers = new DescriptorBufferInfo[Constants.MaxUniformBufferBindings];
|
||||
_storageBuffers = new DescriptorBufferInfo[Constants.MaxStorageBufferBindings];
|
||||
|
@ -75,9 +78,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_bufferTextures = new BufferView[Constants.MaxTexturesPerStage];
|
||||
_bufferImages = new BufferView[Constants.MaxImagesPerStage];
|
||||
|
||||
var initialImageInfo = new DescriptorImageInfo()
|
||||
var initialImageInfo = new DescriptorImageInfo
|
||||
{
|
||||
ImageLayout = ImageLayout.General
|
||||
ImageLayout = ImageLayout.General,
|
||||
};
|
||||
|
||||
_textures.AsSpan().Fill(initialImageInfo);
|
||||
|
@ -106,7 +109,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
1,
|
||||
1,
|
||||
4,
|
||||
GAL.Format.R8G8B8A8Unorm,
|
||||
Format.R8G8B8A8Unorm,
|
||||
DepthStencilMode.Depth,
|
||||
Target.Texture2D,
|
||||
SwizzleComponent.Red,
|
||||
|
@ -114,7 +117,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
SwizzleComponent.Blue,
|
||||
SwizzleComponent.Alpha), 1f);
|
||||
|
||||
_dummySampler = (SamplerHolder)gd.CreateSampler(new GAL.SamplerCreateInfo(
|
||||
_dummySampler = (SamplerHolder)gd.CreateSampler(new SamplerCreateInfo(
|
||||
MinFilter.Nearest,
|
||||
MagFilter.Nearest,
|
||||
false,
|
||||
|
@ -122,7 +125,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
AddressMode.Repeat,
|
||||
AddressMode.Repeat,
|
||||
CompareMode.None,
|
||||
GAL.CompareOp.Always,
|
||||
CompareOp.Always,
|
||||
new ColorF(0, 0, 0, 0),
|
||||
0,
|
||||
0,
|
||||
|
@ -142,7 +145,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_dirty = DirtyFlags.All;
|
||||
}
|
||||
|
||||
public void SetImage(int binding, ITexture image, GAL.Format imageFormat)
|
||||
public void SetImage(int binding, ITexture image, Format imageFormat)
|
||||
{
|
||||
if (image is TextureBuffer imageBuffer)
|
||||
{
|
||||
|
@ -181,10 +184,10 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Auto<DisposableBuffer> vkBuffer = _gd.BufferManager.GetBuffer(commandBuffer, buffer.Handle, false, isSSBO: true);
|
||||
ref Auto<DisposableBuffer> currentVkBuffer = ref _storageBufferRefs[index];
|
||||
|
||||
DescriptorBufferInfo info = new DescriptorBufferInfo()
|
||||
DescriptorBufferInfo info = new()
|
||||
{
|
||||
Offset = (ulong)buffer.Offset,
|
||||
Range = (ulong)buffer.Size
|
||||
Range = (ulong)buffer.Size,
|
||||
};
|
||||
ref DescriptorBufferInfo currentInfo = ref _storageBuffers[index];
|
||||
|
||||
|
@ -209,10 +212,10 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
ref Auto<DisposableBuffer> currentVkBuffer = ref _storageBufferRefs[index];
|
||||
|
||||
DescriptorBufferInfo info = new DescriptorBufferInfo()
|
||||
DescriptorBufferInfo info = new()
|
||||
{
|
||||
Offset = 0,
|
||||
Range = Vk.WholeSize
|
||||
Range = Vk.WholeSize,
|
||||
};
|
||||
ref DescriptorBufferInfo currentInfo = ref _storageBuffers[index];
|
||||
|
||||
|
@ -289,10 +292,10 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Auto<DisposableBuffer> vkBuffer = _gd.BufferManager.GetBuffer(commandBuffer, buffer.Handle, false);
|
||||
ref Auto<DisposableBuffer> currentVkBuffer = ref _uniformBufferRefs[index];
|
||||
|
||||
DescriptorBufferInfo info = new DescriptorBufferInfo()
|
||||
DescriptorBufferInfo info = new()
|
||||
{
|
||||
Offset = (ulong)buffer.Offset,
|
||||
Range = (ulong)buffer.Size
|
||||
Range = (ulong)buffer.Size,
|
||||
};
|
||||
ref DescriptorBufferInfo currentInfo = ref _uniformBuffers[index];
|
||||
|
||||
|
@ -400,11 +403,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
_uniformSet[0] = true;
|
||||
}
|
||||
|
||||
uniformBuffer[0] = new DescriptorBufferInfo()
|
||||
uniformBuffer[0] = new DescriptorBufferInfo
|
||||
{
|
||||
Offset = 0,
|
||||
Range = (ulong)SupportBuffer.RequiredSize,
|
||||
Buffer = _cachedSupportBuffer
|
||||
Buffer = _cachedSupportBuffer,
|
||||
};
|
||||
|
||||
dsc.UpdateBuffers(0, 0, uniformBuffer, DescriptorType.UniformBuffer);
|
||||
|
@ -474,7 +477,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
}
|
||||
|
||||
dsc.UpdateImages(0, binding, textures.Slice(0, count), DescriptorType.CombinedImageSampler);
|
||||
dsc.UpdateImages(0, binding, textures[..count], DescriptorType.CombinedImageSampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -485,7 +488,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
bufferTextures[i] = _bufferTextureRefs[binding + i]?.GetBufferView(cbs) ?? default;
|
||||
}
|
||||
|
||||
dsc.UpdateBufferImages(0, binding, bufferTextures.Slice(0, count), DescriptorType.UniformTexelBuffer);
|
||||
dsc.UpdateBufferImages(0, binding, bufferTextures[..count], DescriptorType.UniformTexelBuffer);
|
||||
}
|
||||
}
|
||||
else if (setIndex == PipelineBase.ImageSetIndex)
|
||||
|
@ -499,7 +502,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
images[i].ImageView = _imageRefs[binding + i]?.Get(cbs).Value ?? default;
|
||||
}
|
||||
|
||||
dsc.UpdateImages(0, binding, images.Slice(0, count), DescriptorType.StorageImage);
|
||||
dsc.UpdateImages(0, binding, images[..count], DescriptorType.StorageImage);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -510,7 +513,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
bufferImages[i] = _bufferImageRefs[binding + i]?.GetBufferView(cbs, _bufferImageFormats[binding + i]) ?? default;
|
||||
}
|
||||
|
||||
dsc.UpdateBufferImages(0, binding, bufferImages.Slice(0, count), DescriptorType.StorageTexelBuffer);
|
||||
dsc.UpdateBufferImages(0, binding, bufferImages[..count], DescriptorType.StorageTexelBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +543,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
DstBinding = (uint)baseBinding,
|
||||
DescriptorType = type,
|
||||
DescriptorCount = (uint)bufferInfo.Length,
|
||||
PBufferInfo = pBufferInfo
|
||||
PBufferInfo = pBufferInfo,
|
||||
};
|
||||
|
||||
_gd.PushDescriptorApi.CmdPushDescriptorSet(cbs.CommandBuffer, pbp, _program.PipelineLayout, 0, 1, &writeDescriptorSet);
|
||||
|
@ -554,11 +557,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
Span<DescriptorBufferInfo> uniformBuffer = stackalloc DescriptorBufferInfo[1];
|
||||
|
||||
uniformBuffer[0] = new DescriptorBufferInfo()
|
||||
uniformBuffer[0] = new DescriptorBufferInfo
|
||||
{
|
||||
Offset = 0,
|
||||
Range = (ulong)SupportBuffer.RequiredSize,
|
||||
Buffer = _gd.BufferManager.GetBuffer(cbs.CommandBuffer, _pipeline.SupportBufferUpdater.Handle, false).Get(cbs, 0, SupportBuffer.RequiredSize).Value
|
||||
Buffer = _gd.BufferManager.GetBuffer(cbs.CommandBuffer, _pipeline.SupportBufferUpdater.Handle, false).Get(cbs, 0, SupportBuffer.RequiredSize).Value,
|
||||
};
|
||||
|
||||
_uniformSet[0] = true;
|
||||
|
@ -620,7 +623,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Array.Clear(_storageSet);
|
||||
}
|
||||
|
||||
private void SwapBuffer(Auto<DisposableBuffer>[] list, Auto<DisposableBuffer> from, Auto<DisposableBuffer> to)
|
||||
private static void SwapBuffer(Auto<DisposableBuffer>[] list, Auto<DisposableBuffer> from, Auto<DisposableBuffer> to)
|
||||
{
|
||||
for (int i = 0; i < list.Length; i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue