mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-12 04:11:56 +00:00
Plug a memory leak in the GLES texture cache. Fixes #9089
This commit is contained in:
parent
8eb668ea59
commit
98763655e7
@ -601,11 +601,10 @@ void TextureCacheCommon::AttachFramebufferInvalid(TexCacheEntry *entry, VirtualF
|
||||
}
|
||||
|
||||
void TextureCacheCommon::DetachFramebuffer(TexCacheEntry *entry, u32 address, VirtualFramebuffer *framebuffer) {
|
||||
const u64 cachekey = entry->CacheKey();
|
||||
|
||||
if (entry->framebuffer == framebuffer) {
|
||||
const u64 cachekey = entry->CacheKey();
|
||||
cacheSizeEstimate_ += EstimateTexMemoryUsage(entry);
|
||||
entry->framebuffer = 0;
|
||||
entry->framebuffer = nullptr;
|
||||
fbTexInfo_.erase(cachekey);
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
|
@ -71,8 +71,11 @@ void TextureCacheGLES::SetFramebufferManager(FramebufferManagerGLES *fbManager)
|
||||
|
||||
void TextureCacheGLES::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
|
||||
DEBUG_LOG(G3D, "Deleting texture %i", entry->textureName);
|
||||
if (delete_them)
|
||||
glDeleteTextures(1, &entry->textureName);
|
||||
if (delete_them) {
|
||||
if (entry->textureName != 0) {
|
||||
glDeleteTextures(1, &entry->textureName);
|
||||
}
|
||||
}
|
||||
entry->textureName = 0;
|
||||
}
|
||||
|
||||
@ -539,16 +542,18 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
|
||||
// For the estimate, we assume cluts always point to 8888 for simplicity.
|
||||
cacheSizeEstimate_ += EstimateTexMemoryUsage(entry);
|
||||
|
||||
// Always generate a texture name, we might need it if the texture is replaced later.
|
||||
if (!replaceImages) {
|
||||
entry->textureName = AllocTextureName();
|
||||
}
|
||||
|
||||
if (entry->framebuffer) {
|
||||
// Nothing else to do here.
|
||||
return;
|
||||
}
|
||||
|
||||
// Always generate a texture name unless it's a framebuffer, we might need it if the texture is replaced later.
|
||||
if (!replaceImages) {
|
||||
if (!entry->textureName) {
|
||||
entry->textureName = AllocTextureName();
|
||||
}
|
||||
}
|
||||
|
||||
if ((entry->bufw == 0 || (gstate.texbufwidth[0] & 0xf800) != 0) && entry->addr >= PSP_GetKernelMemoryEnd()) {
|
||||
ERROR_LOG_REPORT(G3D, "Texture with unexpected bufw (full=%d)", gstate.texbufwidth[0] & 0xffff);
|
||||
// Proceeding here can cause a crash.
|
||||
|
Loading…
x
Reference in New Issue
Block a user