diff options
| -rw-r--r-- | libs/hwui/Caches.cpp | 15 | ||||
| -rw-r--r-- | libs/hwui/Caches.h | 5 | ||||
| -rw-r--r-- | libs/hwui/Layer.cpp | 1 |
3 files changed, 16 insertions, 5 deletions
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index 6fd9999d132d..402f28bd3c5a 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -565,11 +565,8 @@ void Caches::deleteTexture(GLuint texture) { // call, any texture operation will be performed on the default // texture (name=0) - for (int i = 0; i < REQUIRED_TEXTURE_UNITS_COUNT; i++) { - if (mBoundTextures[i] == texture) { - mBoundTextures[i] = 0; - } - } + unbindTexture(texture); + glDeleteTextures(1, &texture); } @@ -577,6 +574,14 @@ void Caches::resetBoundTextures() { memset(mBoundTextures, 0, REQUIRED_TEXTURE_UNITS_COUNT * sizeof(GLuint)); } +void Caches::unbindTexture(GLuint texture) { + for (int i = 0; i < REQUIRED_TEXTURE_UNITS_COUNT; i++) { + if (mBoundTextures[i] == texture) { + mBoundTextures[i] = 0; + } + } +} + /////////////////////////////////////////////////////////////////////////////// // Scissor /////////////////////////////////////////////////////////////////////////////// diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h index b4b5927b6511..83a5d9aafa3c 100644 --- a/libs/hwui/Caches.h +++ b/libs/hwui/Caches.h @@ -261,6 +261,11 @@ public: void resetBoundTextures(); /** + * Clear the cache of bound textures. + */ + void unbindTexture(GLuint texture); + + /** * Sets the scissor for the current surface. */ bool setScissor(GLint x, GLint y, GLint width, GLint height); diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 6a2ef2a8f4d1..1002e1374e32 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -185,6 +185,7 @@ void Layer::deleteTexture() { } void Layer::clearTexture() { + caches.unbindTexture(texture.id); texture.id = 0; } |