Vulkan: Add Render Pass / Framebuffer Cache (#6182)
* 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.
This commit is contained in:
parent
d1b30fbe08
commit
c94f0fbb83
12 changed files with 515 additions and 234 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue