GLES: Free textures on device lost, and unsubmitted step data at exit

- The texture and fragment test caches dropped their GLRTexture objects on
  DeviceLost without queueing them for deletion, leaking them on every
  Android background/resume. The deleter already skips the GL calls when
  the context is gone.
- GLRenderManager::ThreadEnd cleared unsubmitted init and render steps
  without freeing the data they own. Run them through the dry run instead,
  which now also frees stereo matrices and shader code.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-29 10:33:32 -06:00
1 parent b72927bbeb
commit 39049a67fd
5 files changed
+15 -10

No files matched your search

+1 -1
View File
@@ -144,7 +144,7 @@ GLRTexture *FragmentTestCacheGLES::CreateTestTexture(const GEComparison funcs[4]
}
void FragmentTestCacheGLES::Clear(bool deleteThem) {
if (deleteThem) {
if (deleteThem && render_) {
for (const auto &[_, v] : cache_) {
render_->DeleteTexture(v.texture);
}
+2 -1
View File
@@ -68,7 +68,8 @@ public:
void BindTestTexture(int slot);
void DeviceLost() {
Clear(false);
// Queue the deletes anyway, the deleter frees the GLRTexture objects and skips the GL calls if needed.
Clear(true);
render_ = nullptr;
}
void DeviceRestore(Draw::DrawContext *draw);
+4 -4
View File
@@ -51,10 +51,10 @@ void TextureCacheGLES::SetFramebufferManager(FramebufferManagerGLES *fbManager)
}
void TextureCacheGLES::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
if (delete_them) {
if (entry->textureName) {
render_->DeleteTexture(entry->textureName);
}
// Delete even when !delete_them (device lost): the GLRTexture is a heap object that only the deleter
// frees, and the deleter skips the GL calls itself once the context is gone.
if (entry->textureName && render_) {
render_->DeleteTexture(entry->textureName);
}
entry->textureName = nullptr;
}