summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2010-10-25 18:36:13 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-10-25 18:36:13 -0700
commit2c94ba7405394f5ea5e9440e8c4740ca4bb62fc3 (patch)
tree24fc98faabc23c830f40bf2aefa7f0afc49a566b
parente6b80989b808d5c2be10e6dbba1cef2a3be65df1 (diff)
parent3e3ba155fc0ef7a7f40f06762240d9ba22f62b19 (diff)
Merge "Don't change texture unit when not needed."
-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 9c37983fbb0b..859251186b28 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;
}