mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
Fix R4G4B4A4 format on Vulkan (#3696)
This commit is contained in:
parent
36172ab43b
commit
2492e7e808
3 changed files with 10 additions and 16 deletions
|
@ -108,6 +108,10 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
format = VkFormat.D32SfloatS8Uint;
|
||||
}
|
||||
else if (srcFormat == GAL.Format.R4G4B4A4Unorm)
|
||||
{
|
||||
format = VkFormat.R4G4B4A4UnormPack16;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Gpu, $"Format {srcFormat} is not supported by the host.");
|
||||
|
|
|
@ -6,11 +6,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
static class FormatTable
|
||||
{
|
||||
private static readonly VkFormat[] Table;
|
||||
private static readonly VkFormat[] _table;
|
||||
|
||||
static FormatTable()
|
||||
{
|
||||
Table = new VkFormat[Enum.GetNames(typeof(Format)).Length];
|
||||
_table = new VkFormat[Enum.GetNames(typeof(Format)).Length];
|
||||
|
||||
Add(Format.R8Unorm, VkFormat.R8Unorm);
|
||||
Add(Format.R8Snorm, VkFormat.R8SNorm);
|
||||
|
@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
Add(Format.D32FloatS8Uint, VkFormat.D32SfloatS8Uint);
|
||||
Add(Format.R8G8B8A8Srgb, VkFormat.R8G8B8A8Srgb);
|
||||
Add(Format.R4G4Unorm, VkFormat.R4G4UnormPack8);
|
||||
Add(Format.R4G4B4A4Unorm, VkFormat.R4G4B4A4UnormPack16);
|
||||
Add(Format.R4G4B4A4Unorm, VkFormat.A4B4G4R4UnormPack16Ext);
|
||||
Add(Format.R5G5B5X1Unorm, VkFormat.A1R5G5B5UnormPack16);
|
||||
Add(Format.R5G5B5A1Unorm, VkFormat.A1R5G5B5UnormPack16);
|
||||
Add(Format.R5G6B5Unorm, VkFormat.R5G6B5UnormPack16);
|
||||
|
@ -161,12 +161,12 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
private static void Add(Format format, VkFormat vkFormat)
|
||||
{
|
||||
Table[(int)format] = vkFormat;
|
||||
_table[(int)format] = vkFormat;
|
||||
}
|
||||
|
||||
public static VkFormat GetFormat(Format format)
|
||||
{
|
||||
return Table[(int)format];
|
||||
return _table[(int)format];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,17 +74,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
swizzleR = swizzleB;
|
||||
swizzleB = temp;
|
||||
}
|
||||
else if (info.Format == GAL.Format.R4G4B4A4Unorm)
|
||||
{
|
||||
var tempG = swizzleG;
|
||||
var tempB = swizzleB;
|
||||
|
||||
swizzleB = swizzleA;
|
||||
swizzleG = swizzleR;
|
||||
swizzleR = tempG;
|
||||
swizzleA = tempB;
|
||||
}
|
||||
else if (info.Format == GAL.Format.A1B5G5R5Unorm)
|
||||
else if (VkFormat == VkFormat.R4G4B4A4UnormPack16 || info.Format == GAL.Format.A1B5G5R5Unorm)
|
||||
{
|
||||
var tempB = swizzleB;
|
||||
var tempA = swizzleA;
|
||||
|
|
Loading…
Reference in a new issue