From 9f3208ffa87bc7f05d0f48a051ec530c891f6eed Mon Sep 17 00:00:00 2001 From: BUP <39006831+yourmothergay@users.noreply.github.com> Date: Sat, 11 Aug 2018 22:42:53 +0900 Subject: [PATCH] Implement R32B24G8, A4B4G4R4, Z16 texture formats --- Ryujinx.Graphics/Gal/GalTextureFormat.cs | 3 +++ Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs | 3 +++ Ryujinx.HLE/Gpu/Texture/TextureHelper.cs | 3 +++ Ryujinx.HLE/Gpu/Texture/TextureReader.cs | 3 +++ 4 files changed, 12 insertions(+) diff --git a/Ryujinx.Graphics/Gal/GalTextureFormat.cs b/Ryujinx.Graphics/Gal/GalTextureFormat.cs index 7e3e65e82f..ab79b5b15f 100644 --- a/Ryujinx.Graphics/Gal/GalTextureFormat.cs +++ b/Ryujinx.Graphics/Gal/GalTextureFormat.cs @@ -4,11 +4,13 @@ namespace Ryujinx.Graphics.Gal { R32G32B32A32 = 0x1, R16G16B16A16 = 0x3, + R32B24G8 = 0x5, A8B8G8R8 = 0x8, A2B10G10R10 = 0x9, R32 = 0xf, BC6H_SF16 = 0x10, BC6H_UF16 = 0x11, + A4B4G4R4 = 0x12, A1B5G5R5 = 0x14, B5G6R5 = 0x15, BC7U = 0x17, @@ -23,6 +25,7 @@ namespace Ryujinx.Graphics.Gal BC5 = 0x28, Z24S8 = 0x29, ZF32 = 0x2f, + Z16 = 0x3a, Astc2D4x4 = 0x40, Astc2D5x5 = 0x41, Astc2D6x6 = 0x42, diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs index 3c42e5d387..db9b66f494 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLEnumConverter.cs @@ -131,9 +131,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL { case GalTextureFormat.R32G32B32A32: return (PixelFormat.Rgba, PixelType.Float); 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.A2B10G10R10: return (PixelFormat.Rgba, PixelType.UnsignedInt2101010Reversed); 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.B5G6R5: return (PixelFormat.Rgb, PixelType.UnsignedShort565); 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.BF10GF11RF11: return (PixelFormat.Rgb, PixelType.UnsignedInt10F11F11FRev); case GalTextureFormat.Z24S8: return (PixelFormat.DepthStencil, PixelType.UnsignedInt248); + case GalTextureFormat.Z16: return (PixelFormat.DepthComponent, PixelType.HalfFloat); } throw new NotImplementedException(Format.ToString()); diff --git a/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs b/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs index 1d621c9226..f2f12658a2 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureHelper.cs @@ -38,6 +38,7 @@ namespace Ryujinx.HLE.Gpu.Texture return Texture.Width * Texture.Height * 16; case GalTextureFormat.R16G16B16A16: + case GalTextureFormat.R32B24G8: return Texture.Width * Texture.Height * 8; case GalTextureFormat.A8B8G8R8: @@ -48,10 +49,12 @@ namespace Ryujinx.HLE.Gpu.Texture case GalTextureFormat.Z24S8: return Texture.Width * Texture.Height * 4; + case GalTextureFormat.A4B4G4R4: case GalTextureFormat.A1B5G5R5: case GalTextureFormat.B5G6R5: case GalTextureFormat.G8R8: case GalTextureFormat.R16: + case GalTextureFormat.Z16: return Texture.Width * Texture.Height * 2; case GalTextureFormat.R8: diff --git a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs index f8cd676597..f035b3c009 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs @@ -12,11 +12,13 @@ namespace Ryujinx.HLE.Gpu.Texture { case GalTextureFormat.R32G32B32A32: return Read16Bpp (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.A2B10G10R10: return Read4Bpp (Memory, Texture); case GalTextureFormat.R32: return Read4Bpp (Memory, Texture); case GalTextureFormat.BF10GF11RF11: 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.B5G6R5: return Read565 (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.BC5: return Read16BptCompressedTexture(Memory, Texture, 4, 4); 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.Astc2D5x5: return Read16BptCompressedTexture(Memory, Texture, 5, 5); case GalTextureFormat.Astc2D6x6: return Read16BptCompressedTexture(Memory, Texture, 6, 6);