Merge "Textured text calls could be invisible Bug #6597730" into jb-dev
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index a0bf8e3..0d6e62a 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -598,6 +598,7 @@
         glGenTextures(1, &cacheTexture->mTextureId);
     }
 
+    Caches::getInstance().activeTexture(0);
     glBindTexture(GL_TEXTURE_2D, cacheTexture->mTextureId);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     // Initialize texture dimensions
@@ -826,6 +827,7 @@
         }
     }
 
+    caches.activeTexture(0);
     glBindTexture(GL_TEXTURE_2D, mCurrentCacheTexture->mTextureId);
     if (mLinearFiltering != mCurrentCacheTexture->mLinearFiltering) {
         const GLenum filtering = mLinearFiltering ? GL_LINEAR : GL_NEAREST;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 0d857bf..c92bead 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2422,6 +2422,7 @@
         linearFilter = fabs(y - (int) y) > 0.0f || fabs(x - (int) x) > 0.0f;
     }
 
+    // The font renderer will always use texture unit 0
     mCaches.activeTexture(0);
     setupDraw();
     setupDrawDirtyRegionsDisabled();
@@ -2432,6 +2433,8 @@
     setupDrawBlending(true, mode);
     setupDrawProgram();
     setupDrawModelView(x, y, x, y, pureTranslate, true);
+    // See comment above; the font renderer must use texture unit 0
+    // assert(mTextureUnit == 0)
     setupDrawTexture(fontRenderer.getTexture(linearFilter));
     setupDrawPureColorUniforms();
     setupDrawColorFilterUniforms();