diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-10-20 19:03:20 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 19:03:20 -0300 |
commit | 2dcc6333f8cbb959293832f52857bdaeab1918bf (patch) | |
tree | 1aefd3ff6abb23d1a4efc78ee14274283b9041a4 /Ryujinx.Graphics.OpenGL/FormatTable.cs | |
parent | 08332bdc041a594d389b0b732b3c4b5f8573e3fb (diff) |
Fix image binding format (#1625)
* Fix image binding format
* XML doc
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/FormatTable.cs')
-rw-r--r-- | Ryujinx.Graphics.OpenGL/FormatTable.cs | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.OpenGL/FormatTable.cs b/Ryujinx.Graphics.OpenGL/FormatTable.cs index 4200ea7e..4261b495 100644 --- a/Ryujinx.Graphics.OpenGL/FormatTable.cs +++ b/Ryujinx.Graphics.OpenGL/FormatTable.cs @@ -6,11 +6,15 @@ namespace Ryujinx.Graphics.OpenGL { struct FormatTable { - private static FormatInfo[] _table; + private static FormatInfo[] Table; + private static SizedInternalFormat[] TableImage; static FormatTable() { - _table = new FormatInfo[Enum.GetNames(typeof(Format)).Length]; + int tableSize = Enum.GetNames(typeof(Format)).Length; + + Table = new FormatInfo[tableSize]; + TableImage = new SizedInternalFormat[tableSize]; Add(Format.R8Unorm, new FormatInfo(1, true, false, All.R8, PixelFormat.Red, PixelType.UnsignedByte)); Add(Format.R8Snorm, new FormatInfo(1, true, false, All.R8Snorm, PixelFormat.Red, PixelType.Byte)); @@ -168,16 +172,66 @@ namespace Ryujinx.Graphics.OpenGL Add(Format.B8G8R8A8Unorm, new FormatInfo(4, true, false, All.Rgba8, PixelFormat.Rgba, PixelType.UnsignedByte)); Add(Format.B8G8R8X8Srgb, new FormatInfo(4, false, false, All.Srgb8, PixelFormat.Rgba, PixelType.UnsignedByte)); Add(Format.B8G8R8A8Srgb, new FormatInfo(4, false, false, All.Srgb8Alpha8, PixelFormat.Rgba, PixelType.UnsignedByte)); + + Add(Format.R8Unorm, SizedInternalFormat.R8); + Add(Format.R8Uint, SizedInternalFormat.R8ui); + Add(Format.R8Sint, SizedInternalFormat.R8i); + Add(Format.R16Float, SizedInternalFormat.R16f); + Add(Format.R16Unorm, SizedInternalFormat.R16); + Add(Format.R16Snorm, (SizedInternalFormat)All.R16Snorm); + Add(Format.R16Uint, SizedInternalFormat.R16ui); + Add(Format.R16Sint, SizedInternalFormat.R16i); + Add(Format.R32Float, SizedInternalFormat.R32f); + Add(Format.R32Uint, SizedInternalFormat.R32ui); + Add(Format.R32Sint, SizedInternalFormat.R32i); + Add(Format.R8G8Unorm, SizedInternalFormat.Rg8); + Add(Format.R8G8Snorm, (SizedInternalFormat)All.Rg8Snorm); + Add(Format.R8G8Uint, SizedInternalFormat.Rg8ui); + Add(Format.R8G8Sint, SizedInternalFormat.Rg8i); + Add(Format.R16G16Float, SizedInternalFormat.Rg16f); + Add(Format.R16G16Unorm, SizedInternalFormat.Rg16); + Add(Format.R16G16Snorm, (SizedInternalFormat)All.Rg16Snorm); + Add(Format.R16G16Uint, SizedInternalFormat.Rg16ui); + Add(Format.R16G16Sint, SizedInternalFormat.Rg16i); + Add(Format.R32G32Float, SizedInternalFormat.Rg32f); + Add(Format.R32G32Uint, SizedInternalFormat.Rg32ui); + Add(Format.R32G32Sint, SizedInternalFormat.Rg32i); + Add(Format.R8G8B8A8Unorm, SizedInternalFormat.Rgba8); + Add(Format.R8G8B8A8Snorm, (SizedInternalFormat)All.Rgba8Snorm); + Add(Format.R8G8B8A8Uint, SizedInternalFormat.Rgba8ui); + Add(Format.R8G8B8A8Sint, SizedInternalFormat.Rgba8i); + Add(Format.R16G16B16A16Float, SizedInternalFormat.Rgba16f); + Add(Format.R16G16B16A16Unorm, SizedInternalFormat.Rgba16); + Add(Format.R16G16B16A16Snorm, (SizedInternalFormat)All.Rgba16Snorm); + Add(Format.R16G16B16A16Uint, SizedInternalFormat.Rgba16ui); + Add(Format.R16G16B16A16Sint, SizedInternalFormat.Rgba16i); + Add(Format.R32G32B32A32Float, SizedInternalFormat.Rgba32f); + Add(Format.R32G32B32A32Uint, SizedInternalFormat.Rgba32ui); + Add(Format.R32G32B32A32Sint, SizedInternalFormat.Rgba32i); + Add(Format.R8G8B8A8Srgb, SizedInternalFormat.Rgba8); + Add(Format.R10G10B10A2Unorm, (SizedInternalFormat)All.Rgb10A2); + Add(Format.R10G10B10A2Uint, (SizedInternalFormat)All.Rgb10A2ui); + Add(Format.R11G11B10Float, (SizedInternalFormat)All.R11fG11fB10f); } private static void Add(Format format, FormatInfo info) { - _table[(int)format] = info; + Table[(int)format] = info; + } + + private static void Add(Format format, SizedInternalFormat sif) + { + TableImage[(int)format] = sif; } public static FormatInfo GetFormatInfo(Format format) { - return _table[(int)format]; + return Table[(int)format]; + } + + public static SizedInternalFormat GetImageFormat(Format format) + { + return TableImage[(int)format]; } } } |