Tidy up GL resources
Currently it's not safe to destroy and recreate RenderEngine because
certain GL resources are persisted in GLESRenderEngine, which is
imposing limitations on testing. This patch adds some cleanup steps,
including:
* Supporting destruction of glPrograms once they're unused.
* Purging the ProgramCache of shaders when RenderEngine is destroyed
* Tidy up Framebuffer destruction when backed by an EGLImage
* Make sure shadow resources are destroyed prior to display termination
* Disable vertex attribute used for positioning layers.
* Check that EGL objects are valid before display termination.
Bug: 173416417
Test: librenderengine_test, and observe logcat
Change-Id: Id5d858d21a400ef170788d917f0bc0ac5e318bdc
diff --git a/libs/renderengine/gl/ProgramCache.h b/libs/renderengine/gl/ProgramCache.h
index 37bb651..535d21c 100644
--- a/libs/renderengine/gl/ProgramCache.h
+++ b/libs/renderengine/gl/ProgramCache.h
@@ -203,6 +203,8 @@
// if none can be found.
void useProgram(const EGLContext context, const Description& description);
+ void purgeCaches() { mCaches.clear(); }
+
private:
// compute a cache Key from a Description
static Key computeKey(const Description& description);