Texture/Vertex/Index data cache (#132)

* Initial implementation of the texture cache

* Cache vertex and index data aswell, some cleanup

* Improve handling of the cache by storing cached ranges on a list for each page

* Delete old data from the caches automatically, ensure that the cache is cleaned when the mapping/size changes, and some general cleanup
This commit is contained in:
gdkchan 2018-06-08 21:15:56 -03:00 committed by GitHub
parent 6fe51f9705
commit 231fae1a4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 837 additions and 819 deletions

View file

@ -5,7 +5,7 @@ namespace Ryujinx.Core.Gpu
{
static class TextureFactory
{
public static GalTexture MakeTexture(NvGpu Gpu, NvGpuVmm Vmm, long TicPosition)
public static GalTexture MakeTexture(NvGpuVmm Vmm, long TicPosition)
{
int[] Tic = ReadWords(Vmm, TicPosition, 8);
@ -16,6 +16,25 @@ namespace Ryujinx.Core.Gpu
GalTextureSource ZSource = (GalTextureSource)((Tic[0] >> 25) & 7);
GalTextureSource WSource = (GalTextureSource)((Tic[0] >> 28) & 7);
int Width = (Tic[4] & 0xffff) + 1;
int Height = (Tic[5] & 0xffff) + 1;
return new GalTexture(
Width,
Height,
Format,
XSource,
YSource,
ZSource,
WSource);
}
public static byte[] GetTextureData(NvGpuVmm Vmm, long TicPosition)
{
int[] Tic = ReadWords(Vmm, TicPosition, 8);
GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f);
long TextureAddress = (uint)Tic[1];
TextureAddress |= (long)((ushort)Tic[2]) << 32;
@ -40,17 +59,7 @@ namespace Ryujinx.Core.Gpu
Swizzle,
Format);
byte[] Data = TextureReader.Read(Vmm, Texture);
return new GalTexture(
Data,
Width,
Height,
Format,
XSource,
YSource,
ZSource,
WSource);
return TextureReader.Read(Vmm, Texture);
}
public static GalTextureSampler MakeSampler(NvGpu Gpu, NvGpuVmm Vmm, long TscPosition)