* commit 'e709d53ff31c74a6abf2a27350966d18d8dad4f7': Fix the texture ID reuse issue in HWUI.
This commit is contained in:
@@ -554,11 +554,8 @@ void Caches::deleteTexture(GLuint texture) {
|
|||||||
// call, any texture operation will be performed on the default
|
// call, any texture operation will be performed on the default
|
||||||
// texture (name=0)
|
// texture (name=0)
|
||||||
|
|
||||||
for (int i = 0; i < REQUIRED_TEXTURE_UNITS_COUNT; i++) {
|
unbindTexture(texture);
|
||||||
if (mBoundTextures[i] == texture) {
|
|
||||||
mBoundTextures[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glDeleteTextures(1, &texture);
|
glDeleteTextures(1, &texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,6 +563,14 @@ void Caches::resetBoundTextures() {
|
|||||||
memset(mBoundTextures, 0, REQUIRED_TEXTURE_UNITS_COUNT * sizeof(GLuint));
|
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
|
// Scissor
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -263,6 +263,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void resetBoundTextures();
|
void resetBoundTextures();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the cache of bound textures.
|
||||||
|
*/
|
||||||
|
void unbindTexture(GLuint texture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the scissor for the current surface.
|
* Sets the scissor for the current surface.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ void Layer::deleteTexture() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Layer::clearTexture() {
|
void Layer::clearTexture() {
|
||||||
|
caches.unbindTexture(texture.id);
|
||||||
texture.id = 0;
|
texture.id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user