Reduce the number of active texture changes

Change-Id: I94046bdfe20740c26c8183822e3002d692fde7c4
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index cbea843..701314d 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -29,6 +29,7 @@
 Program::Program(const ProgramDescription& description, const char* vertex, const char* fragment) {
     mInitialized = false;
     mHasColorUniform = false;
+    mHasSampler = false;
     mUse = false;
 
     // No need to cache compiled shaders, rely instead on Android's
@@ -176,6 +177,10 @@
 
 void Program::use() {
     glUseProgram(mProgramId);
+    if (texCoords >= 0 && !mHasSampler) {
+        glUniform1i(getUniform("sampler"), 0);
+        mHasSampler = true;
+    }
     mUse = true;
 }