summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-10-25 18:33:16 -0700
committerRomain Guy <romainguy@google.com>2010-10-25 18:33:16 -0700
commit3e3ba155fc0ef7a7f40f06762240d9ba22f62b19 (patch)
treeceaa261fca5f5be2a171e25ecef3376fc24021bd
parent8164c2d338781c3a3c4a443941070dca5d88f2a7 (diff)
downloadframeworks_base-3e3ba155fc0ef7a7f40f06762240d9ba22f62b19.zip
frameworks_base-3e3ba155fc0ef7a7f40f06762240d9ba22f62b19.tar.gz
frameworks_base-3e3ba155fc0ef7a7f40f06762240d9ba22f62b19.tar.bz2
Don't change texture unit when not needed.
Change-Id: Ifa84426d234f2122402cb13533cb5964f1ce95ec
-rw-r--r--libs/hwui/OpenGLRenderer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 9c37983..8592511 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1391,16 +1391,19 @@ void OpenGLRenderer::bindTexture(GLuint texture, GLuint textureUnit) {
void OpenGLRenderer::setTextureWrapModes(Texture* texture, GLenum wrapS, GLenum wrapT,
GLuint textureUnit) {
- glActiveTexture(gTextureUnits[textureUnit]);
bool bound = false;
if (wrapS != texture->wrapS) {
+ glActiveTexture(gTextureUnits[textureUnit]);
glBindTexture(GL_TEXTURE_2D, texture->id);
bound = true;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS);
texture->wrapS = wrapS;
}
if (wrapT != texture->wrapT) {
- if (!bound) glBindTexture(GL_TEXTURE_2D, texture->id);
+ if (!bound) {
+ glActiveTexture(gTextureUnits[textureUnit]);
+ glBindTexture(GL_TEXTURE_2D, texture->id);
+ }
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT);
texture->wrapT = wrapT;
}