aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Texture/ImageUtils.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-10-17 18:02:23 -0300
committerGitHub <noreply@github.com>2018-10-17 18:02:23 -0300
commit0e1e094b7a8f0134831fc4cebdb0841b9c10fe6a (patch)
tree81ba6446851a033f27adeafbfb94751032108047 /Ryujinx.Graphics/Texture/ImageUtils.cs
parent02a8e7fc9369d7882db08a69d108beefb0f98677 (diff)
Improve texture tables (#457)
* Improve texture tables * More renaming and other tweaks * Minor tweaks
Diffstat (limited to 'Ryujinx.Graphics/Texture/ImageUtils.cs')
-rw-r--r--Ryujinx.Graphics/Texture/ImageUtils.cs279
1 files changed, 138 insertions, 141 deletions
diff --git a/Ryujinx.Graphics/Texture/ImageUtils.cs b/Ryujinx.Graphics/Texture/ImageUtils.cs
index 2c4e7b4b..d2172c2e 100644
--- a/Ryujinx.Graphics/Texture/ImageUtils.cs
+++ b/Ryujinx.Graphics/Texture/ImageUtils.cs
@@ -35,106 +35,105 @@ namespace Ryujinx.Graphics.Texture
}
}
- private const GalImageFormat Snorm = GalImageFormat.Snorm;
- private const GalImageFormat Unorm = GalImageFormat.Unorm;
- private const GalImageFormat Sint = GalImageFormat.Sint;
- private const GalImageFormat Uint = GalImageFormat.Uint;
- private const GalImageFormat Sfloat = GalImageFormat.Sfloat;
+ private const GalImageFormat Snorm = GalImageFormat.Snorm;
+ private const GalImageFormat Unorm = GalImageFormat.Unorm;
+ private const GalImageFormat Sint = GalImageFormat.Sint;
+ private const GalImageFormat Uint = GalImageFormat.Uint;
+ private const GalImageFormat Float = GalImageFormat.Float;
+ private const GalImageFormat Srgb = GalImageFormat.Srgb;
private static readonly Dictionary<GalTextureFormat, GalImageFormat> s_TextureTable =
new Dictionary<GalTextureFormat, GalImageFormat>()
- {
- { GalTextureFormat.R32G32B32A32, GalImageFormat.R32G32B32A32 | Sint | Uint | Sfloat },
- { GalTextureFormat.R16G16B16A16, GalImageFormat.R16G16B16A16 | Snorm | Unorm | Sint | Uint | Sfloat },
- { GalTextureFormat.R32G32, GalImageFormat.R32G32 | Sint | Uint | Sfloat },
- { GalTextureFormat.A8B8G8R8, GalImageFormat.A8B8G8R8 | Snorm | Unorm | Sint | Uint },
- { GalTextureFormat.A2B10G10R10, GalImageFormat.A2B10G10R10 | Snorm | Unorm | Sint | Uint },
- { GalTextureFormat.G8R8, GalImageFormat.G8R8 | Snorm | Unorm | Sint | Uint },
- { GalTextureFormat.R16, GalImageFormat.R16 | Snorm | Unorm | Sint | Uint | Sfloat },
- { GalTextureFormat.R8, GalImageFormat.R8 | Snorm | Unorm | Sint | Uint },
- { GalTextureFormat.R16G16, GalImageFormat.R16G16 | Snorm | Unorm | Sfloat },
- { GalTextureFormat.R32, GalImageFormat.R32 | Sint | Uint | Sfloat },
- { GalTextureFormat.A4B4G4R4, GalImageFormat.A4B4G4R4 | Unorm },
- { GalTextureFormat.A1B5G5R5, GalImageFormat.A1R5G5B5 | Unorm },
- { GalTextureFormat.B5G6R5, GalImageFormat.B5G6R5 | Unorm },
- { GalTextureFormat.BF10GF11RF11, GalImageFormat.B10G11R11 | Sfloat },
- { GalTextureFormat.Z24S8, GalImageFormat.D24_S8 | Unorm | Uint },
- { GalTextureFormat.ZF32, GalImageFormat.D32 | Sfloat },
- { GalTextureFormat.ZF32_X24S8, GalImageFormat.D32_S8 | Unorm },
- { GalTextureFormat.Z16, GalImageFormat.D16 | Unorm },
-
- //Compressed formats
- { GalTextureFormat.BC6H_SF16, GalImageFormat.BC6H_SF16 | Unorm },
- { GalTextureFormat.BC6H_UF16, GalImageFormat.BC6H_UF16 | Sfloat },
- { GalTextureFormat.BC7U, GalImageFormat.BC7 | Unorm },
- { GalTextureFormat.BC1, GalImageFormat.BC1_RGBA | Unorm },
- { GalTextureFormat.BC2, GalImageFormat.BC2 | Unorm },
- { GalTextureFormat.BC3, GalImageFormat.BC3 | Unorm },
- { GalTextureFormat.BC4, GalImageFormat.BC4 | Unorm | Snorm },
- { GalTextureFormat.BC5, GalImageFormat.BC5 | Unorm | Snorm },
- { GalTextureFormat.Astc2D4x4, GalImageFormat.ASTC_4x4 | Unorm },
- { GalTextureFormat.Astc2D5x5, GalImageFormat.ASTC_5x5 | Unorm },
- { GalTextureFormat.Astc2D6x6, GalImageFormat.ASTC_6x6 | Unorm },
- { GalTextureFormat.Astc2D8x8, GalImageFormat.ASTC_8x8 | Unorm },
- { GalTextureFormat.Astc2D10x10, GalImageFormat.ASTC_10x10 | Unorm },
- { GalTextureFormat.Astc2D12x12, GalImageFormat.ASTC_12x12 | Unorm },
- { GalTextureFormat.Astc2D5x4, GalImageFormat.ASTC_5x4 | Unorm },
- { GalTextureFormat.Astc2D6x5, GalImageFormat.ASTC_6x5 | Unorm },
- { GalTextureFormat.Astc2D8x6, GalImageFormat.ASTC_8x6 | Unorm },
- { GalTextureFormat.Astc2D10x8, GalImageFormat.ASTC_10x8 | Unorm },
- { GalTextureFormat.Astc2D12x10, GalImageFormat.ASTC_12x10 | Unorm },
- { GalTextureFormat.Astc2D8x5, GalImageFormat.ASTC_8x5 | Unorm },
- { GalTextureFormat.Astc2D10x5, GalImageFormat.ASTC_10x5 | Unorm },
- { GalTextureFormat.Astc2D10x6, GalImageFormat.ASTC_10x6 | Unorm }
- };
+ {
+ { GalTextureFormat.RGBA32, GalImageFormat.RGBA32 | Sint | Uint | Float },
+ { GalTextureFormat.RGBA16, GalImageFormat.RGBA16 | Snorm | Unorm | Sint | Uint | Float },
+ { GalTextureFormat.RG32, GalImageFormat.RG32 | Sint | Uint | Float },
+ { GalTextureFormat.RGBA8, GalImageFormat.RGBA8 | Snorm | Unorm | Sint | Uint | Srgb },
+ { GalTextureFormat.RGB10A2, GalImageFormat.RGB10A2 | Snorm | Unorm | Sint | Uint },
+ { GalTextureFormat.RG8, GalImageFormat.RG8 | Snorm | Unorm | Sint | Uint },
+ { GalTextureFormat.R16, GalImageFormat.R16 | Snorm | Unorm | Sint | Uint | Float },
+ { GalTextureFormat.R8, GalImageFormat.R8 | Snorm | Unorm | Sint | Uint },
+ { GalTextureFormat.RG16, GalImageFormat.RG16 | Snorm | Unorm | Float },
+ { GalTextureFormat.R32, GalImageFormat.R32 | Sint | Uint | Float },
+ { GalTextureFormat.RGBA4, GalImageFormat.RGBA4 | Unorm },
+ { GalTextureFormat.RGB5A1, GalImageFormat.RGB5A1 | Unorm },
+ { GalTextureFormat.RGB565, GalImageFormat.RGB565 | Unorm },
+ { GalTextureFormat.R11G11B10F, GalImageFormat.R11G11B10 | Float },
+ { GalTextureFormat.D24S8, GalImageFormat.D24S8 | Unorm | Uint },
+ { GalTextureFormat.D32F, GalImageFormat.D32 | Float },
+ { GalTextureFormat.D32FX24S8, GalImageFormat.D32S8 | Unorm },
+ { GalTextureFormat.D16, GalImageFormat.D16 | Unorm },
+
+ //Compressed formats
+ { GalTextureFormat.BptcSfloat, GalImageFormat.BptcSfloat | Float },
+ { GalTextureFormat.BptcUfloat, GalImageFormat.BptcUfloat | Float },
+ { GalTextureFormat.BptcUnorm, GalImageFormat.BptcUnorm | Unorm | Srgb },
+ { GalTextureFormat.BC1, GalImageFormat.BC1 | Unorm | Srgb },
+ { GalTextureFormat.BC2, GalImageFormat.BC2 | Unorm | Srgb },
+ { GalTextureFormat.BC3, GalImageFormat.BC3 | Unorm | Srgb },
+ { GalTextureFormat.BC4, GalImageFormat.BC4 | Unorm | Snorm },
+ { GalTextureFormat.BC5, GalImageFormat.BC5 | Unorm | Snorm },
+ { GalTextureFormat.Astc2D4x4, GalImageFormat.Astc2D4x4 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D5x5, GalImageFormat.Astc2D5x5 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D6x6, GalImageFormat.Astc2D6x6 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D8x8, GalImageFormat.Astc2D8x8 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D10x10, GalImageFormat.Astc2D10x10 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D12x12, GalImageFormat.Astc2D12x12 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D5x4, GalImageFormat.Astc2D5x4 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D6x5, GalImageFormat.Astc2D6x5 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D8x6, GalImageFormat.Astc2D8x6 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D10x8, GalImageFormat.Astc2D10x8 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D12x10, GalImageFormat.Astc2D12x10 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D8x5, GalImageFormat.Astc2D8x5 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D10x5, GalImageFormat.Astc2D10x5 | Unorm | Srgb },
+ { GalTextureFormat.Astc2D10x6, GalImageFormat.Astc2D10x6 | Unorm | Srgb }
+ };
private static readonly Dictionary<GalImageFormat, ImageDescriptor> s_ImageTable =
new Dictionary<GalImageFormat, ImageDescriptor>()
{
- { GalImageFormat.R32G32B32A32, new ImageDescriptor(16, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.R16G16B16A16, new ImageDescriptor(8, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.R32G32, new ImageDescriptor(8, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.B8G8R8A8, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.A8B8G8R8, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.A2B10G10R10, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.R32, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.A4B4G4R4, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.BC6H_SF16, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.BC6H_UF16, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.A1R5G5B5, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.B5G6R5, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.BC7, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.R16G16, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.R8G8, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.G8R8, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.R16, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.R8, new ImageDescriptor(1, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.B10G11R11, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.A8B8G8R8_SRGB, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
- { GalImageFormat.BC1_RGBA, new ImageDescriptor(8, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.BC2, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.BC3, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.BC4, new ImageDescriptor(8, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.BC5, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.ASTC_4x4, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
- { GalImageFormat.ASTC_5x5, new ImageDescriptor(16, 5, 5, TargetBuffer.Color) },
- { GalImageFormat.ASTC_6x6, new ImageDescriptor(16, 6, 6, TargetBuffer.Color) },
- { GalImageFormat.ASTC_8x8, new ImageDescriptor(16, 8, 8, TargetBuffer.Color) },
- { GalImageFormat.ASTC_10x10, new ImageDescriptor(16, 10, 10, TargetBuffer.Color) },
- { GalImageFormat.ASTC_12x12, new ImageDescriptor(16, 12, 12, TargetBuffer.Color) },
- { GalImageFormat.ASTC_5x4, new ImageDescriptor(16, 5, 4, TargetBuffer.Color) },
- { GalImageFormat.ASTC_6x5, new ImageDescriptor(16, 6, 5, TargetBuffer.Color) },
- { GalImageFormat.ASTC_8x6, new ImageDescriptor(16, 8, 6, TargetBuffer.Color) },
- { GalImageFormat.ASTC_10x8, new ImageDescriptor(16, 10, 8, TargetBuffer.Color) },
- { GalImageFormat.ASTC_12x10, new ImageDescriptor(16, 12, 10, TargetBuffer.Color) },
- { GalImageFormat.ASTC_8x5, new ImageDescriptor(16, 8, 5, TargetBuffer.Color) },
- { GalImageFormat.ASTC_10x5, new ImageDescriptor(16, 10, 5, TargetBuffer.Color) },
- { GalImageFormat.ASTC_10x6, new ImageDescriptor(16, 10, 6, TargetBuffer.Color) },
-
- { GalImageFormat.D24_S8, new ImageDescriptor(4, 1, 1, TargetBuffer.DepthStencil) },
- { GalImageFormat.D32, new ImageDescriptor(4, 1, 1, TargetBuffer.Depth) },
- { GalImageFormat.D16, new ImageDescriptor(2, 1, 1, TargetBuffer.Depth) },
- { GalImageFormat.D32_S8, new ImageDescriptor(8, 1, 1, TargetBuffer.DepthStencil) },
+ { GalImageFormat.RGBA32, new ImageDescriptor(16, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RGBA16, new ImageDescriptor(8, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RG32, new ImageDescriptor(8, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RGBA8, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.BGRA8, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RGB10A2, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.R32, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RGBA4, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.BptcSfloat, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.BptcUfloat, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.RGB5A1, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RGB565, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.BptcUnorm, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.RG16, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.RG8, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.R16, new ImageDescriptor(2, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.R8, new ImageDescriptor(1, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.R11G11B10, new ImageDescriptor(4, 1, 1, TargetBuffer.Color) },
+ { GalImageFormat.BC1, new ImageDescriptor(8, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.BC2, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.BC3, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.BC4, new ImageDescriptor(8, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.BC5, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D4x4, new ImageDescriptor(16, 4, 4, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D5x5, new ImageDescriptor(16, 5, 5, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D6x6, new ImageDescriptor(16, 6, 6, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D8x8, new ImageDescriptor(16, 8, 8, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D10x10, new ImageDescriptor(16, 10, 10, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D12x12, new ImageDescriptor(16, 12, 12, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D5x4, new ImageDescriptor(16, 5, 4, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D6x5, new ImageDescriptor(16, 6, 5, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D8x6, new ImageDescriptor(16, 8, 6, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D10x8, new ImageDescriptor(16, 10, 8, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D12x10, new ImageDescriptor(16, 12, 10, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D8x5, new ImageDescriptor(16, 8, 5, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D10x5, new ImageDescriptor(16, 10, 5, TargetBuffer.Color) },
+ { GalImageFormat.Astc2D10x6, new ImageDescriptor(16, 10, 6, TargetBuffer.Color) },
+
+ { GalImageFormat.D24S8, new ImageDescriptor(4, 1, 1, TargetBuffer.DepthStencil) },
+ { GalImageFormat.D32, new ImageDescriptor(4, 1, 1, TargetBuffer.Depth) },
+ { GalImageFormat.D16, new ImageDescriptor(2, 1, 1, TargetBuffer.Depth) },
+ { GalImageFormat.D32S8, new ImageDescriptor(8, 1, 1, TargetBuffer.DepthStencil) }
};
public static GalImageFormat ConvertTexture(
@@ -142,64 +141,62 @@ namespace Ryujinx.Graphics.Texture
GalTextureType RType,
GalTextureType GType,
GalTextureType BType,
- GalTextureType AType)
+ GalTextureType AType,
+ bool ConvSrgb)
{
if (RType != GType || RType != BType || RType != AType)
{
- throw new NotImplementedException("Per component types are not implemented");
+ throw new NotImplementedException("Per component types are not implemented!");
}
if (!s_TextureTable.TryGetValue(Format, out GalImageFormat ImageFormat))
{
- throw new NotImplementedException("Texture with format " + ((int)Format).ToString("x2") + " not implemented");
+ throw new NotImplementedException($"Format 0x{((int)Format):x} not implemented!");
}
- GalTextureType Type = RType;
+ GalImageFormat FormatType = ConvSrgb ? Srgb : GetFormatType(RType);
- GalImageFormat FormatType = GetFormatType(RType);
+ GalImageFormat CombinedFormat = (ImageFormat & GalImageFormat.FormatMask) | FormatType;
- if (ImageFormat.HasFlag(FormatType))
+ if (!ImageFormat.HasFlag(FormatType))
{
- return (ImageFormat & GalImageFormat.FormatMask) | FormatType;
- }
- else
- {
- throw new NotImplementedException("Texture with format " + Format +
- " and component type " + Type + " is not implemented");
+ throw new NotImplementedException($"Format \"{CombinedFormat}\" not implemented!");
}
+
+ return CombinedFormat;
}
public static GalImageFormat ConvertSurface(GalSurfaceFormat Format)
{
switch (Format)
{
- case GalSurfaceFormat.RGBA32Float: return GalImageFormat.R32G32B32A32 | Sfloat;
- case GalSurfaceFormat.RGBA32Uint: return GalImageFormat.R32G32B32A32 | Uint;
- case GalSurfaceFormat.RGBA16Float: return GalImageFormat.R16G16B16A16 | Sfloat;
- case GalSurfaceFormat.RG32Float: return GalImageFormat.R32G32 | Sfloat;
- case GalSurfaceFormat.RG32Sint: return GalImageFormat.R32G32 | Sint;
- case GalSurfaceFormat.RG32Uint: return GalImageFormat.R32G32 | Uint;
- case GalSurfaceFormat.BGRA8Unorm: return GalImageFormat.B8G8R8A8 | Unorm;
- case GalSurfaceFormat.BGRA8Srgb: return GalImageFormat.A8B8G8R8_SRGB; //This one might be wrong
- case GalSurfaceFormat.RGB10A2Unorm: return GalImageFormat.A2B10G10R10 | Unorm;
- case GalSurfaceFormat.RGBA8Unorm: return GalImageFormat.A8B8G8R8 | Unorm;
- case GalSurfaceFormat.RGBA8Srgb: return GalImageFormat.A8B8G8R8_SRGB;
- case GalSurfaceFormat.RGBA8Snorm: return GalImageFormat.A8B8G8R8 | Snorm;
- case GalSurfaceFormat.RG16Snorm: return GalImageFormat.R16G16 | Snorm;
- case GalSurfaceFormat.RG16Unorm: return GalImageFormat.R16G16 | Unorm;
- case GalSurfaceFormat.RG16Float: return GalImageFormat.R16G16 | Sfloat;
- case GalSurfaceFormat.R11G11B10Float: return GalImageFormat.B10G11R11 | Sfloat;
- case GalSurfaceFormat.R32Float: return GalImageFormat.R32 | Sfloat;
- case GalSurfaceFormat.R32Uint: return GalImageFormat.R32 | Uint;
- case GalSurfaceFormat.RG8Unorm: return GalImageFormat.R8G8 | Unorm;
- case GalSurfaceFormat.RG8Snorm: return GalImageFormat.R8G8 | Snorm;
- case GalSurfaceFormat.R16Float: return GalImageFormat.R16 | Sfloat;
- case GalSurfaceFormat.R16Unorm: return GalImageFormat.R16 | Unorm;
- case GalSurfaceFormat.R16Uint: return GalImageFormat.R16 | Uint;
- case GalSurfaceFormat.R8Unorm: return GalImageFormat.R8 | Unorm;
- case GalSurfaceFormat.R8Uint: return GalImageFormat.R8 | Uint;
- case GalSurfaceFormat.B5G6R5Unorm: return GalImageFormat.B5G6R5 | Unorm;
- case GalSurfaceFormat.BGR5A1Unorm: return GalImageFormat.A1R5G5B5 | Unorm;
+ case GalSurfaceFormat.RGBA32Float: return GalImageFormat.RGBA32 | Float;
+ case GalSurfaceFormat.RGBA32Uint: return GalImageFormat.RGBA32 | Uint;
+ case GalSurfaceFormat.RGBA16Float: return GalImageFormat.RGBA16 | Float;
+ case GalSurfaceFormat.RG32Float: return GalImageFormat.RG32 | Float;
+ case GalSurfaceFormat.RG32Sint: return GalImageFormat.RG32 | Sint;
+ case GalSurfaceFormat.RG32Uint: return GalImageFormat.RG32 | Uint;
+ case GalSurfaceFormat.BGRA8Unorm: return GalImageFormat.BGRA8 | Unorm;
+ case GalSurfaceFormat.BGRA8Srgb: return GalImageFormat.BGRA8 | Srgb;
+ case GalSurfaceFormat.RGB10A2Unorm: return GalImageFormat.RGB10A2 | Unorm;
+ case GalSurfaceFormat.RGBA8Unorm: return GalImageFormat.RGBA8 | Unorm;
+ case GalSurfaceFormat.RGBA8Srgb: return GalImageFormat.RGBA8 | Srgb;
+ case GalSurfaceFormat.RGBA8Snorm: return GalImageFormat.RGBA8 | Snorm;
+ case GalSurfaceFormat.RG16Snorm: return GalImageFormat.RG16 | Snorm;
+ case GalSurfaceFormat.RG16Unorm: return GalImageFormat.RG16 | Unorm;
+ case GalSurfaceFormat.RG16Float: return GalImageFormat.RG16 | Float;
+ case GalSurfaceFormat.R11G11B10Float: return GalImageFormat.R11G11B10 | Float;
+ case GalSurfaceFormat.R32Float: return GalImageFormat.R32 | Float;
+ case GalSurfaceFormat.R32Uint: return GalImageFormat.R32 | Uint;
+ case GalSurfaceFormat.RG8Unorm: return GalImageFormat.RG8 | Unorm;
+ case GalSurfaceFormat.RG8Snorm: return GalImageFormat.RG8 | Snorm;
+ case GalSurfaceFormat.R16Float: return GalImageFormat.R16 | Float;
+ case GalSurfaceFormat.R16Unorm: return GalImageFormat.R16 | Unorm;
+ case GalSurfaceFormat.R16Uint: return GalImageFormat.R16 | Uint;
+ case GalSurfaceFormat.R8Unorm: return GalImageFormat.R8 | Unorm;
+ case GalSurfaceFormat.R8Uint: return GalImageFormat.R8 | Uint;
+ case GalSurfaceFormat.B5G6R5Unorm: return GalImageFormat.RGB565 | Unorm;
+ case GalSurfaceFormat.BGR5A1Unorm: return GalImageFormat.BGR5A1 | Unorm;
}
throw new NotImplementedException(Format.ToString());
@@ -209,11 +206,11 @@ namespace Ryujinx.Graphics.Texture
{
switch (Format)
{
- case GalZetaFormat.Z32Float: return GalImageFormat.D32 | Sfloat;
- case GalZetaFormat.S8Z24Unorm: return GalImageFormat.D24_S8 | Unorm;
- case GalZetaFormat.Z16Unorm: return GalImageFormat.D16 | Unorm;
- case GalZetaFormat.Z24S8Unorm: return GalImageFormat.D24_S8 | Unorm;
- case GalZetaFormat.Z32S8X24Float: return GalImageFormat.D32_S8 | Sfloat;
+ case GalZetaFormat.D32Float: return GalImageFormat.D32 | Float;
+ case GalZetaFormat.S8D24Unorm: return GalImageFormat.D24S8 | Unorm;
+ case GalZetaFormat.D16Unorm: return GalImageFormat.D16 | Unorm;
+ case GalZetaFormat.D24S8Unorm: return GalImageFormat.D24S8 | Unorm;
+ case GalZetaFormat.D32S8X24Float: return GalImageFormat.D32S8 | Float;
}
throw new NotImplementedException(Format.ToString());
@@ -376,14 +373,14 @@ namespace Ryujinx.Graphics.Texture
private static ImageDescriptor GetImageDescriptor(GalImageFormat Format)
{
- GalImageFormat TypeLess = (Format & GalImageFormat.FormatMask);
+ GalImageFormat PixelFormat = Format & GalImageFormat.FormatMask;
- if (s_ImageTable.TryGetValue(TypeLess, out ImageDescriptor Descriptor))
+ if (s_ImageTable.TryGetValue(PixelFormat, out ImageDescriptor Descriptor))
{
return Descriptor;
}
- throw new NotImplementedException("Image with format " + TypeLess.ToString() + " not implemented");
+ throw new NotImplementedException($"Format \"{PixelFormat}\" not implemented!");
}
private static GalImageFormat GetFormatType(GalTextureType Type)
@@ -394,7 +391,7 @@ namespace Ryujinx.Graphics.Texture
case GalTextureType.Unorm: return Unorm;
case GalTextureType.Sint: return Sint;
case GalTextureType.Uint: return Uint;
- case GalTextureType.Float: return Sfloat;
+ case GalTextureType.Float: return Float;
default: throw new NotImplementedException(((int)Type).ToString());
}