aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Vulkan/FormatTable.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2024-01-31 22:49:50 +0000
committerGitHub <noreply@github.com>2024-01-31 23:49:50 +0100
commitc94f0fbb8307873f68df982c100d3fb01aa6ccf5 (patch)
tree327a039f016b3e0ae45713e0f5dd413a04d673ae /src/Ryujinx.Graphics.Vulkan/FormatTable.cs
parentd1b30fbe08d79ad81167358779d77cf4e7167386 (diff)
Vulkan: Add Render Pass / Framebuffer Cache (#6182)1.1.1154
* Vulkan: Add Render Pass / Framebuffer Cache Cache is owned by each texture view. - Window's way of getting framebuffer cache for swapchain images is really messy - it creates a TextureView out of just a vk image view, with invalid info and no storage. * Clear up limited use of alternate TextureView constructor * Formatting and messages * More formatting and messages I apologize for `_colorsCanonical[index]?.Storage?.InsertReadToWriteBarrier`, the compiler made me do it * Self review, change GetFramebuffer to GetPassAndFramebuffer * Avoid allocations on Remove for HashTableSlim * Member can be readonly * Generate texture create info for swapchain images * Improve hashcode * Remove format, samples, size and isDepthStencil when possible Tested in a number of games, seems fine. * Removed load op barriers These can be introduced later. * Reintroduce UpdateModifications Technically meant to be replaced by load op stuff.
Diffstat (limited to 'src/Ryujinx.Graphics.Vulkan/FormatTable.cs')
-rw-r--r--src/Ryujinx.Graphics.Vulkan/FormatTable.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs
index 5f767df1..a12e3efd 100644
--- a/src/Ryujinx.Graphics.Vulkan/FormatTable.cs
+++ b/src/Ryujinx.Graphics.Vulkan/FormatTable.cs
@@ -1,5 +1,6 @@
using Ryujinx.Graphics.GAL;
using System;
+using System.Collections.Generic;
using VkFormat = Silk.NET.Vulkan.Format;
namespace Ryujinx.Graphics.Vulkan
@@ -7,10 +8,12 @@ namespace Ryujinx.Graphics.Vulkan
static class FormatTable
{
private static readonly VkFormat[] _table;
+ private static readonly Dictionary<VkFormat, Format> _reverseMap;
static FormatTable()
{
_table = new VkFormat[Enum.GetNames(typeof(Format)).Length];
+ _reverseMap = new Dictionary<VkFormat, Format>();
#pragma warning disable IDE0055 // Disable formatting
Add(Format.R8Unorm, VkFormat.R8Unorm);
@@ -164,6 +167,7 @@ namespace Ryujinx.Graphics.Vulkan
private static void Add(Format format, VkFormat vkFormat)
{
_table[(int)format] = vkFormat;
+ _reverseMap[vkFormat] = format;
}
public static VkFormat GetFormat(Format format)
@@ -171,6 +175,16 @@ namespace Ryujinx.Graphics.Vulkan
return _table[(int)format];
}
+ public static Format GetFormat(VkFormat format)
+ {
+ if (!_reverseMap.TryGetValue(format, out Format result))
+ {
+ return Format.B8G8R8A8Unorm;
+ }
+
+ return result;
+ }
+
public static Format ConvertRgba8SrgbToUnorm(Format format)
{
return format switch