mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Fix image leak bug when pausing and we're just displaying a framebuffer in memory
This commit is contained in:
1 parent
364c205d95
commit
49ecc01556
7 files changed
+45
-7
No files matched your search
@@ -1402,16 +1402,19 @@ Draw::Texture *FramebufferManagerCommon::MakePixelTexture(const u8 *srcPixels, G
|
||||
|
||||
Draw::DataFormat texFormat = srcPixelFormat == GE_FORMAT_DEPTH16 ? depthFormat : preferredPixelsFormat_;
|
||||
|
||||
int frameNumber = draw_->GetFrameCount();
|
||||
|
||||
// Look for a matching texture we can re-use.
|
||||
for (auto &iter : drawPixelsCache_) {
|
||||
if (iter.frameNumber > gpuStats.numFlips - 3 || iter.tex->Width() != width || iter.tex->Height() != height || iter.tex->Format() != texFormat) {
|
||||
if (iter.frameNumber >= frameNumber - 3 || iter.tex->Width() != width || iter.tex->Height() != height || iter.tex->Format() != texFormat) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// OK, current one seems good, let's use it (and mark it used).
|
||||
gpuStats.numDrawPixels++;
|
||||
draw_->UpdateTextureLevels(iter.tex, &srcPixels, generateTexture, 1);
|
||||
iter.frameNumber = gpuStats.numFlips;
|
||||
// NOTE: numFlips is no good - this is called every frame when paused sometimes!
|
||||
iter.frameNumber = frameNumber;
|
||||
return iter.tex;
|
||||
}
|
||||
|
||||
@@ -1442,7 +1445,7 @@ Draw::Texture *FramebufferManagerCommon::MakePixelTexture(const u8 *srcPixels, G
|
||||
|
||||
INFO_LOG(G3D, "Creating drawPixelsCache texture: %dx%d", tex->Width(), tex->Height());
|
||||
|
||||
DrawPixelsEntry entry{ tex, gpuStats.numFlips };
|
||||
DrawPixelsEntry entry{ tex, frameNumber };
|
||||
drawPixelsCache_.push_back(entry);
|
||||
return tex;
|
||||
}
|
||||
@@ -1695,7 +1698,7 @@ void FramebufferManagerCommon::DecimateFBOs() {
|
||||
// And DrawPixels cached textures.
|
||||
|
||||
for (auto it = drawPixelsCache_.begin(); it != drawPixelsCache_.end(); ) {
|
||||
int age = gpuStats.numFlips - it->frameNumber;
|
||||
int age = draw_->GetFrameCount() - it->frameNumber;
|
||||
if (age > 10) {
|
||||
INFO_LOG(G3D, "Releasing drawPixelsCache texture: %dx%d", it->tex->Width(), it->tex->Height());
|
||||
it->tex->Release();
|
||||
|
||||
Reference in new issue
Block a user