aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Vulkan/TextureStorage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Vulkan/TextureStorage.cs')
-rw-r--r--src/Ryujinx.Graphics.Vulkan/TextureStorage.cs39
1 files changed, 20 insertions, 19 deletions
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<MemoryAllocation> _allocationAuto;
private Auto<MemoryAllocation> _foreignAllocationAuto;
- private Dictionary<GAL.Format, TextureStorage> _aliasedStorages;
+ private Dictionary<Format, TextureStorage> _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<GAL.Format, TextureStorage>();
+ _aliasedStorages ??= new Dictionary<Format, TextureStorage>();
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;