diff options
author | Romain Guy <romainguy@google.com> | 2010-11-11 12:06:27 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-11-11 12:06:27 -0800 |
commit | 01d065795794fa56be660d6346e4830eb7e90a41 (patch) | |
tree | bb20f3b363618cb6998aaaa26331e4459d79379c /libs/hwui/SkiaShader.cpp | |
parent | a6689ddbba5d7d5e9ad7a07ae84a187497f18121 (diff) | |
download | frameworks_base-01d065795794fa56be660d6346e4830eb7e90a41.zip frameworks_base-01d065795794fa56be660d6346e4830eb7e90a41.tar.gz frameworks_base-01d065795794fa56be660d6346e4830eb7e90a41.tar.bz2 |
Reduce number of GL calls when drawing with shaders.
Change-Id: I27aca9f6d381d5c7e363d90a93225d185f2ff4e3
Diffstat (limited to 'libs/hwui/SkiaShader.cpp')
-rw-r--r-- | libs/hwui/SkiaShader.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp index e7e1187..590a9d7 100644 --- a/libs/hwui/SkiaShader.cpp +++ b/libs/hwui/SkiaShader.cpp @@ -63,8 +63,7 @@ void SkiaShader::setupProgram(Program* program, const mat4& modelView, const Sna GLuint* textureUnit) { } -void SkiaShader::bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit) { - glActiveTexture(gTextureUnitsMap[textureUnit]); +void SkiaShader::bindTexture(Texture* texture, GLenum wrapS, GLenum wrapT) { glBindTexture(GL_TEXTURE_2D, texture->id); if (wrapS != texture->wrapS) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS); @@ -132,7 +131,7 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView, computeScreenSpaceMatrix(textureTransform, modelView); // Uniforms - bindTexture(texture, mWrapS, mWrapT, textureSlot); + bindTexture(texture, mWrapS, mWrapT); glUniform1i(program->getUniform("bitmapSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("textureTransform"), 1, GL_FALSE, &textureTransform.data[0]); @@ -204,7 +203,7 @@ void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelV computeScreenSpaceMatrix(screenSpace, modelView); // Uniforms - bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY], textureSlot); + bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY]); glUniform1i(program->getUniform("gradientSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]); } @@ -297,7 +296,7 @@ void SkiaSweepGradientShader::setupProgram(Program* program, const mat4& modelVi computeScreenSpaceMatrix(screenSpace, modelView); // Uniforms - bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY], textureSlot); + bindTexture(texture, gTileModes[mTileX], gTileModes[mTileY]); glUniform1i(program->getUniform("gradientSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("screenSpace"), 1, GL_FALSE, &screenSpace.data[0]); } |