[GPU] Add support for the BC4/5 texture formats

This commit is contained in:
gdkchan 2018-04-10 18:54:50 -03:00
parent f57fd95fd9
commit 7b2f471d4f
5 changed files with 20 additions and 4 deletions

View file

@ -316,6 +316,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv
int Padding = Reader.ReadInt32(); int Padding = Reader.ReadInt32();
int Offset = Reader.ReadInt32(); int Offset = Reader.ReadInt32();
int Pages = Reader.ReadInt32(); int Pages = Reader.ReadInt32();
System.Console.WriteLine("remap " + Offset.ToString("x8") + " " + Pages.ToString("x8"));
} }
//TODO //TODO

View file

@ -7,6 +7,8 @@ namespace Ryujinx.Graphics.Gal
B5G6R5 = 0x15, B5G6R5 = 0x15,
BC1 = 0x24, BC1 = 0x24,
BC2 = 0x25, BC2 = 0x25,
BC3 = 0x26 BC3 = 0x26,
BC4 = 0x27,
BC5 = 0x28
} }
} }

View file

@ -74,6 +74,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
case GalTextureFormat.BC1: return PixelInternalFormat.CompressedRgbaS3tcDxt1Ext; case GalTextureFormat.BC1: return PixelInternalFormat.CompressedRgbaS3tcDxt1Ext;
case GalTextureFormat.BC2: return PixelInternalFormat.CompressedRgbaS3tcDxt3Ext; case GalTextureFormat.BC2: return PixelInternalFormat.CompressedRgbaS3tcDxt3Ext;
case GalTextureFormat.BC3: return PixelInternalFormat.CompressedRgbaS3tcDxt5Ext; case GalTextureFormat.BC3: return PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
case GalTextureFormat.BC4: return PixelInternalFormat.CompressedRedRgtc1;
case GalTextureFormat.BC5: return PixelInternalFormat.CompressedRgRgtc2;
} }
throw new NotImplementedException(Format.ToString()); throw new NotImplementedException(Format.ToString());

View file

@ -85,9 +85,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
private static bool IsCompressedTextureFormat(GalTextureFormat Format) private static bool IsCompressedTextureFormat(GalTextureFormat Format)
{ {
return Format == GalTextureFormat.BC1 || switch (Format)
Format == GalTextureFormat.BC2 || {
Format == GalTextureFormat.BC3; case GalTextureFormat.BC1:
case GalTextureFormat.BC2:
case GalTextureFormat.BC3:
case GalTextureFormat.BC4:
case GalTextureFormat.BC5:
return true;
}
return false;
} }
private int EnsureTextureInitialized(int TexIndex) private int EnsureTextureInitialized(int TexIndex)

View file

@ -16,6 +16,8 @@ namespace Ryujinx.Graphics.Gpu
case GalTextureFormat.BC1: return Read8Bpt4x4 (Memory, Texture); case GalTextureFormat.BC1: return Read8Bpt4x4 (Memory, Texture);
case GalTextureFormat.BC2: return Read16Bpt4x4(Memory, Texture); case GalTextureFormat.BC2: return Read16Bpt4x4(Memory, Texture);
case GalTextureFormat.BC3: return Read16Bpt4x4(Memory, Texture); case GalTextureFormat.BC3: return Read16Bpt4x4(Memory, Texture);
case GalTextureFormat.BC4: return Read8Bpt4x4 (Memory, Texture);
case GalTextureFormat.BC5: return Read16Bpt4x4(Memory, Texture);
} }
throw new NotImplementedException(Texture.Format.ToString()); throw new NotImplementedException(Texture.Format.ToString());