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
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 3c2d80d..0c536b0 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -51,8 +51,6 @@
texture.width = layerWidth;
texture.height = layerHeight;
colorFilter = NULL;
- firstFilter = true;
- firstWrap = true;
}
~Layer() {
@@ -150,27 +148,11 @@
}
void setWrap(GLenum wrapS, GLenum wrapT, bool bindTexture = false, bool force = false) {
- if (firstWrap || force || wrapS != texture.wrapS || wrapT != texture.wrapT) {
- firstWrap = true;
- texture.setWrap(wrapS, wrapT);
- if (bindTexture) {
- glBindTexture(renderTarget, texture.id);
- }
- glTexParameteri(renderTarget, GL_TEXTURE_WRAP_S, wrapS);
- glTexParameteri(renderTarget, GL_TEXTURE_WRAP_T, wrapT);
- }
+ texture.setWrap(wrapS, wrapT, bindTexture, force, renderTarget);
}
void setFilter(GLenum min, GLenum mag, bool bindTexture = false, bool force = false) {
- if (firstFilter || force || min != texture.minFilter || mag != texture.magFilter) {
- firstFilter = false;
- texture.setFilter(min, mag);
- if (bindTexture) {
- glBindTexture(renderTarget, texture.id);
- }
- glTexParameteri(renderTarget, GL_TEXTURE_MIN_FILTER, min);
- glTexParameteri(renderTarget, GL_TEXTURE_MAG_FILTER, mag);
- }
+ texture.setFilter(min, mag,bindTexture, force, renderTarget);
}
inline bool isCacheable() {
@@ -296,8 +278,6 @@
*/
mat4 texTransform;
- bool firstFilter;
- bool firstWrap;
}; // struct Layer
}; // namespace uirenderer