Browse Source

Implement BGR10A2 render target format (#6273)

gdkchan 2 years ago
parent
commit
609de33b0b

+ 4 - 0
src/Ryujinx.Graphics.GAL/Format.cs

@@ -147,6 +147,7 @@ namespace Ryujinx.Graphics.GAL
         A1B5G5R5Unorm,
         B8G8R8A8Unorm,
         B8G8R8A8Srgb,
+        B10G10R10A2Unorm,
     }
 
     public static class FormatExtensions
@@ -260,6 +261,7 @@ namespace Ryujinx.Graphics.GAL
                 case Format.R10G10B10A2Sint:
                 case Format.R10G10B10A2Uscaled:
                 case Format.R10G10B10A2Sscaled:
+                case Format.B10G10R10A2Unorm:
                     return 4;
 
                 case Format.S8Uint:
@@ -451,6 +453,7 @@ namespace Ryujinx.Graphics.GAL
                 case Format.R32G32Uint:
                 case Format.B8G8R8A8Unorm:
                 case Format.B8G8R8A8Srgb:
+                case Format.B10G10R10A2Unorm:
                 case Format.R10G10B10A2Unorm:
                 case Format.R10G10B10A2Uint:
                 case Format.R8G8B8A8Unorm:
@@ -611,6 +614,7 @@ namespace Ryujinx.Graphics.GAL
                 case Format.B5G5R5A1Unorm:
                 case Format.B8G8R8A8Unorm:
                 case Format.B8G8R8A8Srgb:
+                case Format.B10G10R10A2Unorm:
                     return true;
             }
 

+ 2 - 0
src/Ryujinx.Graphics.Gpu/Engine/Types/ColorFormat.cs

@@ -37,6 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
         R16G16Sint = 0xdc,
         R16G16Uint = 0xdd,
         R16G16Float = 0xde,
+        B10G10R10A2Unorm = 0xdf,
         R11G11B10Float = 0xe0,
         R32Sint = 0xe3,
         R32Uint = 0xe4,
@@ -104,6 +105,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Types
                 ColorFormat.R16G16Sint        => new FormatInfo(Format.R16G16Sint,        1, 1, 4,  2),
                 ColorFormat.R16G16Uint        => new FormatInfo(Format.R16G16Uint,        1, 1, 4,  2),
                 ColorFormat.R16G16Float       => new FormatInfo(Format.R16G16Float,       1, 1, 4,  2),
+                ColorFormat.B10G10R10A2Unorm  => new FormatInfo(Format.B10G10R10A2Unorm,  1, 1, 4,  4),
                 ColorFormat.R11G11B10Float    => new FormatInfo(Format.R11G11B10Float,    1, 1, 4,  3),
                 ColorFormat.R32Sint           => new FormatInfo(Format.R32Sint,           1, 1, 4,  1),
                 ColorFormat.R32Uint           => new FormatInfo(Format.R32Uint,           1, 1, 4,  1),

+ 1 - 0
src/Ryujinx.Graphics.OpenGL/FormatTable.cs

@@ -161,6 +161,7 @@ namespace Ryujinx.Graphics.OpenGL
             Add(Format.A1B5G5R5Unorm,       new FormatInfo(4, true,  false, All.Rgb5A1,            PixelFormat.Rgba,           PixelType.UnsignedShort5551));
             Add(Format.B8G8R8A8Unorm,       new FormatInfo(4, true,  false, All.Rgba8,             PixelFormat.Rgba,           PixelType.UnsignedByte));
             Add(Format.B8G8R8A8Srgb,        new FormatInfo(4, false, false, All.Srgb8Alpha8,       PixelFormat.Rgba,           PixelType.UnsignedByte));
+            Add(Format.B10G10R10A2Unorm,    new FormatInfo(4, false, false, All.Rgb10A2,           PixelFormat.Rgba,           PixelType.UnsignedInt2101010Reversed));
 
             Add(Format.R8Unorm,           SizedInternalFormat.R8);
             Add(Format.R8Uint,            SizedInternalFormat.R8ui);

+ 1 - 0
src/Ryujinx.Graphics.Vulkan/FormatTable.cs

@@ -161,6 +161,7 @@ namespace Ryujinx.Graphics.Vulkan
             Add(Format.A1B5G5R5Unorm,       VkFormat.R5G5B5A1UnormPack16);
             Add(Format.B8G8R8A8Unorm,       VkFormat.B8G8R8A8Unorm);
             Add(Format.B8G8R8A8Srgb,        VkFormat.B8G8R8A8Srgb);
+            Add(Format.B10G10R10A2Unorm,    VkFormat.A2R10G10B10UnormPack32);
 #pragma warning restore IDE0055
         }