diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-06-08 21:15:56 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-08 21:15:56 -0300 |
| commit | 231fae1a4c97d7588655e9775f37c1dc9bd55fb0 (patch) | |
| tree | 1c0e7b298ec33d5bf5b6a5693dd69a8c7e0bd23b /Ryujinx.Core/Gpu/TextureFactory.cs | |
| parent | 6fe51f970501fe732276c17ed0dacb564b92a73d (diff) | |
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
Diffstat (limited to 'Ryujinx.Core/Gpu/TextureFactory.cs')
| -rw-r--r-- | Ryujinx.Core/Gpu/TextureFactory.cs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/Ryujinx.Core/Gpu/TextureFactory.cs b/Ryujinx.Core/Gpu/TextureFactory.cs index 5206c125..9262b947 100644 --- a/Ryujinx.Core/Gpu/TextureFactory.cs +++ b/Ryujinx.Core/Gpu/TextureFactory.cs @@ -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) |
