From 065c4e520d1c8d9fc7de2097839976f9934ef8d0 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 15 Jan 2023 19:12:52 -0300 Subject: Specify image view usage flags on Vulkan (#4283) * Specify image view usage flags on Vulkan * PR feedback --- Ryujinx.Graphics.Vulkan/TextureStorage.cs | 37 ++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'Ryujinx.Graphics.Vulkan/TextureStorage.cs') diff --git a/Ryujinx.Graphics.Vulkan/TextureStorage.cs b/Ryujinx.Graphics.Vulkan/TextureStorage.cs index 28fabb4f..92209997 100644 --- a/Ryujinx.Graphics.Vulkan/TextureStorage.cs +++ b/Ryujinx.Graphics.Vulkan/TextureStorage.cs @@ -79,21 +79,7 @@ namespace Ryujinx.Graphics.Vulkan var sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples); - var usage = DefaultUsageFlags; - - if (info.Format.IsDepthOrStencil()) - { - usage |= ImageUsageFlags.DepthStencilAttachmentBit; - } - else if (info.Format.IsRtColorCompatible()) - { - usage |= ImageUsageFlags.ColorAttachmentBit; - } - - if (info.Format.IsImageCompatible()) - { - usage |= ImageUsageFlags.StorageBit; - } + var usage = GetImageUsageFromFormat(info.Format); var flags = ImageCreateFlags.CreateMutableFormatBit; @@ -306,6 +292,27 @@ namespace Ryujinx.Graphics.Vulkan } } + public static ImageUsageFlags GetImageUsageFromFormat(GAL.Format format) + { + var usage = DefaultUsageFlags; + + if (format.IsDepthOrStencil()) + { + usage |= ImageUsageFlags.DepthStencilAttachmentBit; + } + else if (format.IsRtColorCompatible()) + { + usage |= ImageUsageFlags.ColorAttachmentBit; + } + + if (format.IsImageCompatible()) + { + usage |= ImageUsageFlags.StorageBit; + } + + return usage; + } + public static SampleCountFlags ConvertToSampleCountFlags(SampleCountFlags supportedSampleCounts, uint samples) { if (samples == 0 || samples > (uint)SampleCountFlags.Count64Bit) -- cgit v1.2.3