diff options
author | 2011-12-13 22:00:19 -0800 | |
---|---|---|
committer | 2011-12-13 22:00:19 -0800 | |
commit | 2d4fd364843d3efc6e6ee59ccc5beb513a86d789 (patch) | |
tree | e6314681f94a7fcd0355a5700ecf65d9e3e0c5bb /libs/hwui/Program.cpp | |
parent | ec31f83bd3af1f900d1ee9116b15f56904c66dcd (diff) |
Reduce the number of active texture changes
Change-Id: I94046bdfe20740c26c8183822e3002d692fde7c4
Diffstat (limited to 'libs/hwui/Program.cpp')
-rw-r--r-- | libs/hwui/Program.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp index cbea843acf04..701314d3c0b8 100644 --- a/libs/hwui/Program.cpp +++ b/libs/hwui/Program.cpp @@ -29,6 +29,7 @@ namespace uirenderer { 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::setColor(const float r, const float g, const float b, const float void Program::use() { glUseProgram(mProgramId); + if (texCoords >= 0 && !mHasSampler) { + glUniform1i(getUniform("sampler"), 0); + mHasSampler = true; + } mUse = true; } |