diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-01-15 19:12:52 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-15 23:12:52 +0100 |
commit | 065c4e520d1c8d9fc7de2097839976f9934ef8d0 (patch) | |
tree | 59dcc13f4828cc8fa06f111c6775300f3b665a5f /Ryujinx.Graphics.Vulkan/TextureStorage.cs | |
parent | 139a93040741ec78a4ee13035eab1b1b705bdcf8 (diff) |
Specify image view usage flags on Vulkan (#4283)1.1.561
* Specify image view usage flags on Vulkan
* PR feedback
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/TextureStorage.cs')
-rw-r--r-- | Ryujinx.Graphics.Vulkan/TextureStorage.cs | 37 |
1 files changed, 22 insertions, 15 deletions
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) |