mirror of
https://github.com/izzy2lost/ppsspp.git
synced 2026-03-10 12:43:04 -07:00
Use sceKernelDcache*() to invalidate the texcache.
Also in the block transfer code.
This commit is contained in:
@@ -1259,7 +1259,7 @@ void GLES_GPU::DoBlockTransfer()
|
||||
{
|
||||
// TODO: This is used a lot to copy data around between render targets and textures,
|
||||
// and also to quickly load textures from RAM to VRAM. So we should do checks like the following:
|
||||
// * Does dstBasePtr point to an existing texture? If so invalidate it and reload it immediately.
|
||||
// * Does dstBasePtr point to an existing texture? If so maybe reload it immediately.
|
||||
//
|
||||
// * Does srcBasePtr point to a render target, and dstBasePtr to a texture? If so
|
||||
// either copy between rt and texture or reassign the texture to point to the render target
|
||||
@@ -1293,4 +1293,14 @@ void GLES_GPU::DoBlockTransfer()
|
||||
}
|
||||
|
||||
// TODO: Notify all overlapping textures that it's time to die/reload.
|
||||
|
||||
TextureCache_Invalidate(srcBasePtr + srcY * srcStride + srcX, height * srcStride + width * bpp);
|
||||
}
|
||||
|
||||
void GLES_GPU::InvalidateCache(u32 addr, int size)
|
||||
{
|
||||
if (size > 0)
|
||||
TextureCache_Invalidate(addr, size);
|
||||
else
|
||||
TextureCache_Clear(true);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
virtual void CopyDisplayToOutput();
|
||||
virtual void BeginFrame();
|
||||
virtual void UpdateStats();
|
||||
virtual void InvalidateCache(u32 addr, int size);
|
||||
|
||||
private:
|
||||
// TransformPipeline.cpp
|
||||
|
||||
@@ -106,6 +106,26 @@ void TextureCache_Decimate()
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache_Invalidate(u32 addr, int size)
|
||||
{
|
||||
u32 addr_end = addr + size;
|
||||
|
||||
for (TexCache::iterator iter = cache.begin(); iter != cache.end(); )
|
||||
{
|
||||
// Clear if either the addr or clutaddr is in the range.
|
||||
bool invalidate = iter->second.addr >= addr && iter->second.addr < addr_end;
|
||||
invalidate |= iter->second.clutaddr >= addr && iter->second.clutaddr < addr_end;
|
||||
|
||||
if (invalidate)
|
||||
{
|
||||
glDeleteTextures(1, &iter->second.texture);
|
||||
cache.erase(iter++);
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
int TextureCache_NumLoadedTextures()
|
||||
{
|
||||
return cache.size();
|
||||
|
||||
@@ -25,4 +25,5 @@ void TextureCache_Init();
|
||||
void TextureCache_Shutdown();
|
||||
void TextureCache_Clear(bool delete_them);
|
||||
void TextureCache_Decimate(); // Run this once per frame to get rid of old textures.
|
||||
void TextureCache_Invalidate(u32 addr, int size);
|
||||
int TextureCache_NumLoadedTextures();
|
||||
|
||||
Reference in New Issue
Block a user