Implement R32B24G8, A4B4G4R4, Z16 texture formats

This commit is contained in:
BUP 2018-08-11 22:42:53 +09:00
parent 02a6fdcd13
commit 9f3208ffa8
4 changed files with 12 additions and 0 deletions

View file

@ -4,11 +4,13 @@ namespace Ryujinx.Graphics.Gal
{ {
R32G32B32A32 = 0x1, R32G32B32A32 = 0x1,
R16G16B16A16 = 0x3, R16G16B16A16 = 0x3,
R32B24G8 = 0x5,
A8B8G8R8 = 0x8, A8B8G8R8 = 0x8,
A2B10G10R10 = 0x9, A2B10G10R10 = 0x9,
R32 = 0xf, R32 = 0xf,
BC6H_SF16 = 0x10, BC6H_SF16 = 0x10,
BC6H_UF16 = 0x11, BC6H_UF16 = 0x11,
A4B4G4R4 = 0x12,
A1B5G5R5 = 0x14, A1B5G5R5 = 0x14,
B5G6R5 = 0x15, B5G6R5 = 0x15,
BC7U = 0x17, BC7U = 0x17,
@ -23,6 +25,7 @@ namespace Ryujinx.Graphics.Gal
BC5 = 0x28, BC5 = 0x28,
Z24S8 = 0x29, Z24S8 = 0x29,
ZF32 = 0x2f, ZF32 = 0x2f,
Z16 = 0x3a,
Astc2D4x4 = 0x40, Astc2D4x4 = 0x40,
Astc2D5x5 = 0x41, Astc2D5x5 = 0x41,
Astc2D6x6 = 0x42, Astc2D6x6 = 0x42,

View file

@ -131,9 +131,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{ {
case GalTextureFormat.R32G32B32A32: return (PixelFormat.Rgba, PixelType.Float); case GalTextureFormat.R32G32B32A32: return (PixelFormat.Rgba, PixelType.Float);
case GalTextureFormat.R16G16B16A16: return (PixelFormat.Rgba, PixelType.HalfFloat); case GalTextureFormat.R16G16B16A16: return (PixelFormat.Rgba, PixelType.HalfFloat);
case GalTextureFormat.R32B24G8: return (PixelFormat.Rgb, PixelType.Float32UnsignedInt248Rev);
case GalTextureFormat.A8B8G8R8: return (PixelFormat.Rgba, PixelType.UnsignedByte); case GalTextureFormat.A8B8G8R8: return (PixelFormat.Rgba, PixelType.UnsignedByte);
case GalTextureFormat.A2B10G10R10: return (PixelFormat.Rgba, PixelType.UnsignedInt2101010Reversed); case GalTextureFormat.A2B10G10R10: return (PixelFormat.Rgba, PixelType.UnsignedInt2101010Reversed);
case GalTextureFormat.R32: return (PixelFormat.Red, PixelType.Float); case GalTextureFormat.R32: return (PixelFormat.Red, PixelType.Float);
case GalTextureFormat.A4B4G4R4: return (PixelFormat.Rgba, PixelType.UnsignedShort4444Reversed);
case GalTextureFormat.A1B5G5R5: return (PixelFormat.Rgba, PixelType.UnsignedShort5551); case GalTextureFormat.A1B5G5R5: return (PixelFormat.Rgba, PixelType.UnsignedShort5551);
case GalTextureFormat.B5G6R5: return (PixelFormat.Rgb, PixelType.UnsignedShort565); case GalTextureFormat.B5G6R5: return (PixelFormat.Rgb, PixelType.UnsignedShort565);
case GalTextureFormat.G8R8: return (PixelFormat.Rg, PixelType.UnsignedByte); case GalTextureFormat.G8R8: return (PixelFormat.Rg, PixelType.UnsignedByte);
@ -142,6 +144,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
case GalTextureFormat.ZF32: return (PixelFormat.DepthComponent, PixelType.Float); case GalTextureFormat.ZF32: return (PixelFormat.DepthComponent, PixelType.Float);
case GalTextureFormat.BF10GF11RF11: return (PixelFormat.Rgb, PixelType.UnsignedInt10F11F11FRev); case GalTextureFormat.BF10GF11RF11: return (PixelFormat.Rgb, PixelType.UnsignedInt10F11F11FRev);
case GalTextureFormat.Z24S8: return (PixelFormat.DepthStencil, PixelType.UnsignedInt248); case GalTextureFormat.Z24S8: return (PixelFormat.DepthStencil, PixelType.UnsignedInt248);
case GalTextureFormat.Z16: return (PixelFormat.DepthComponent, PixelType.HalfFloat);
} }
throw new NotImplementedException(Format.ToString()); throw new NotImplementedException(Format.ToString());

View file

@ -38,6 +38,7 @@ namespace Ryujinx.HLE.Gpu.Texture
return Texture.Width * Texture.Height * 16; return Texture.Width * Texture.Height * 16;
case GalTextureFormat.R16G16B16A16: case GalTextureFormat.R16G16B16A16:
case GalTextureFormat.R32B24G8:
return Texture.Width * Texture.Height * 8; return Texture.Width * Texture.Height * 8;
case GalTextureFormat.A8B8G8R8: case GalTextureFormat.A8B8G8R8:
@ -48,10 +49,12 @@ namespace Ryujinx.HLE.Gpu.Texture
case GalTextureFormat.Z24S8: case GalTextureFormat.Z24S8:
return Texture.Width * Texture.Height * 4; return Texture.Width * Texture.Height * 4;
case GalTextureFormat.A4B4G4R4:
case GalTextureFormat.A1B5G5R5: case GalTextureFormat.A1B5G5R5:
case GalTextureFormat.B5G6R5: case GalTextureFormat.B5G6R5:
case GalTextureFormat.G8R8: case GalTextureFormat.G8R8:
case GalTextureFormat.R16: case GalTextureFormat.R16:
case GalTextureFormat.Z16:
return Texture.Width * Texture.Height * 2; return Texture.Width * Texture.Height * 2;
case GalTextureFormat.R8: case GalTextureFormat.R8:

View file

@ -12,11 +12,13 @@ namespace Ryujinx.HLE.Gpu.Texture
{ {
case GalTextureFormat.R32G32B32A32: return Read16Bpp (Memory, Texture); case GalTextureFormat.R32G32B32A32: return Read16Bpp (Memory, Texture);
case GalTextureFormat.R16G16B16A16: return Read8Bpp (Memory, Texture); case GalTextureFormat.R16G16B16A16: return Read8Bpp (Memory, Texture);
case GalTextureFormat.R32B24G8: return Read8Bpp (Memory, Texture);
case GalTextureFormat.A8B8G8R8: return Read4Bpp (Memory, Texture); case GalTextureFormat.A8B8G8R8: return Read4Bpp (Memory, Texture);
case GalTextureFormat.A2B10G10R10: return Read4Bpp (Memory, Texture); case GalTextureFormat.A2B10G10R10: return Read4Bpp (Memory, Texture);
case GalTextureFormat.R32: return Read4Bpp (Memory, Texture); case GalTextureFormat.R32: return Read4Bpp (Memory, Texture);
case GalTextureFormat.BF10GF11RF11: return Read4Bpp (Memory, Texture); case GalTextureFormat.BF10GF11RF11: return Read4Bpp (Memory, Texture);
case GalTextureFormat.Z24S8: return Read4Bpp (Memory, Texture); case GalTextureFormat.Z24S8: return Read4Bpp (Memory, Texture);
case GalTextureFormat.A4B4G4R4: return Read2Bpp (Memory, Texture);
case GalTextureFormat.A1B5G5R5: return Read5551 (Memory, Texture); case GalTextureFormat.A1B5G5R5: return Read5551 (Memory, Texture);
case GalTextureFormat.B5G6R5: return Read565 (Memory, Texture); case GalTextureFormat.B5G6R5: return Read565 (Memory, Texture);
case GalTextureFormat.G8R8: return Read2Bpp (Memory, Texture); case GalTextureFormat.G8R8: return Read2Bpp (Memory, Texture);
@ -31,6 +33,7 @@ namespace Ryujinx.HLE.Gpu.Texture
case GalTextureFormat.BC4: return Read8Bpt4x4 (Memory, Texture); case GalTextureFormat.BC4: return Read8Bpt4x4 (Memory, Texture);
case GalTextureFormat.BC5: return Read16BptCompressedTexture(Memory, Texture, 4, 4); case GalTextureFormat.BC5: return Read16BptCompressedTexture(Memory, Texture, 4, 4);
case GalTextureFormat.ZF32: return Read4Bpp (Memory, Texture); case GalTextureFormat.ZF32: return Read4Bpp (Memory, Texture);
case GalTextureFormat.Z16: return Read2Bpp (Memory, Texture);
case GalTextureFormat.Astc2D4x4: return Read16BptCompressedTexture(Memory, Texture, 4, 4); case GalTextureFormat.Astc2D4x4: return Read16BptCompressedTexture(Memory, Texture, 4, 4);
case GalTextureFormat.Astc2D5x5: return Read16BptCompressedTexture(Memory, Texture, 5, 5); case GalTextureFormat.Astc2D5x5: return Read16BptCompressedTexture(Memory, Texture, 5, 5);
case GalTextureFormat.Astc2D6x6: return Read16BptCompressedTexture(Memory, Texture, 6, 6); case GalTextureFormat.Astc2D6x6: return Read16BptCompressedTexture(Memory, Texture, 6, 6);