diff options
| author | Romain Guy <romainguy@google.com> | 2011-07-25 16:36:01 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2011-07-25 16:36:01 -0700 |
| commit | e3c26851dc315b730ea0fe5ef35bb1db81f6d675 (patch) | |
| tree | bc3fbae626f785fa38e40d4f5ab3737777d9a1ef /libs/hwui/SkiaShader.cpp | |
| parent | 29d23ecfd8612ecd4a7b2140acd344934b73a558 (diff) | |
| download | frameworks_base-e3c26851dc315b730ea0fe5ef35bb1db81f6d675.zip frameworks_base-e3c26851dc315b730ea0fe5ef35bb1db81f6d675.tar.gz frameworks_base-e3c26851dc315b730ea0fe5ef35bb1db81f6d675.tar.bz2 | |
Improve rendering performance on some GPUs
This change sets textures filtering to GL_NEAREST by default. GL_LINEAR
filtering is only used when textures are transformed with a scale or
a rotation. This helps save a couple of fps on some GPUs.
Change-Id: I1efaa452c2c79905f00238e54d886a37203a2ac1
Diffstat (limited to 'libs/hwui/SkiaShader.cpp')
| -rw-r--r-- | libs/hwui/SkiaShader.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp index 8878c70..1a60dca 100644 --- a/libs/hwui/SkiaShader.cpp +++ b/libs/hwui/SkiaShader.cpp @@ -77,14 +77,7 @@ void SkiaShader::setupProgram(Program* program, const mat4& modelView, const Sna 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); - texture->wrapS = wrapS; - } - if (wrapT != texture->wrapT) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT); - texture->wrapT = wrapT; - } + texture->setWrap(wrapS, wrapT); } void SkiaShader::computeScreenSpaceMatrix(mat4& screenSpace, const mat4& modelView) { @@ -151,6 +144,9 @@ void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView, // Uniforms bindTexture(texture, mWrapS, mWrapT); + GLenum filter = textureTransform.isPureTranslate() ? GL_NEAREST : GL_LINEAR; + texture->setFilter(filter, filter); + glUniform1i(program->getUniform("bitmapSampler"), textureSlot); glUniformMatrix4fv(program->getUniform("textureTransform"), 1, GL_FALSE, &textureTransform.data[0]); |
