[PATCH 01/15] glamor: Drop useless glEnable/glDisable(GL_TEXTURE_2D) calls.

Eric Anholt eric at anholt.net
Mon Feb 3 11:03:26 PST 2014


Those calls are only for enabling texture handling in the fixed
function pipeline, while everything we do is with shaders.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_copyarea.c  | 4 ----
 glamor/glamor_pixmap.c    | 6 ------
 glamor/glamor_putimage.c  | 2 --
 glamor/glamor_render.c    | 9 ---------
 glamor/glamor_tile.c      | 6 ------
 glamor/glamor_trapezoid.c | 6 ------
 6 files changed, 33 deletions(-)

diff --git a/glamor/glamor_copyarea.c b/glamor/glamor_copyarea.c
index 7279d34..498a06e 100644
--- a/glamor/glamor_copyarea.c
+++ b/glamor/glamor_copyarea.c
@@ -171,7 +171,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
     glActiveTexture(GL_TEXTURE0);
     glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex);
 #ifndef GLAMOR_GLES2
-    glEnable(GL_TEXTURE_2D);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
 #endif
@@ -208,9 +207,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-#ifndef GLAMOR_GLES2
-    glDisable(GL_TEXTURE_2D);
-#endif
     glUseProgram(0);
     /* The source texture is bound to a fbo, we have to flush it here. */
     glamor_put_context(glamor_priv);
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 4012755..9fe2b2e 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -538,18 +538,12 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
 
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-#ifndef GLAMOR_GLES2
-    glEnable(GL_TEXTURE_2D);
-#endif
     glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
     glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
     glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
 
     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
 
-#ifndef GLAMOR_GLES2
-    glDisable(GL_TEXTURE_2D);
-#endif
     glUseProgram(0);
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
diff --git a/glamor/glamor_putimage.c b/glamor/glamor_putimage.c
index 60ccd67..702e89f 100644
--- a/glamor/glamor_putimage.c
+++ b/glamor/glamor_putimage.c
@@ -170,7 +170,6 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
 
     glGenTextures(1, &tex);
     glActiveTexture(GL_TEXTURE0);
-    glEnable(GL_TEXTURE_2D);
     glBindTexture(GL_TEXTURE_2D, tex);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -220,7 +219,6 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
     glamor_set_alu(GXcopy);
     glamor_set_planemask(pixmap, ~0);
     glDeleteTextures(1, &tex);
-    glDisable(GL_TEXTURE_2D);
     glDisableClientState(GL_VERTEX_ARRAY);
     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
     return;
diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
index 34530f3..ecc4606 100644
--- a/glamor/glamor_render.c
+++ b/glamor/glamor_render.c
@@ -572,9 +572,6 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
         break;
     }
-#ifndef GLAMOR_GLES2
-    glEnable(GL_TEXTURE_2D);
-#endif
 
     /*
      *  GLES2 doesn't support RepeatNone. We need to fix it anyway.
@@ -1409,12 +1406,6 @@ glamor_composite_with_shader(CARD8 op,
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
     glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
     glDisable(GL_BLEND);
-#ifndef GLAMOR_GLES2
-    glActiveTexture(GL_TEXTURE0);
-    glDisable(GL_TEXTURE_2D);
-    glActiveTexture(GL_TEXTURE1);
-    glDisable(GL_TEXTURE_2D);
-#endif
     DEBUGF("finish rendering.\n");
     glUseProgram(0);
     glamor_priv->state = RENDER_STATE;
diff --git a/glamor/glamor_tile.c b/glamor/glamor_tile.c
index 5b58e80..9abb95d 100644
--- a/glamor/glamor_tile.c
+++ b/glamor/glamor_tile.c
@@ -135,9 +135,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-#ifndef GLAMOR_GLES2
-    glEnable(GL_TEXTURE_2D);
-#endif
     glamor_set_repeat_normalize_tcoords
         (src_pixmap_priv, RepeatNormal,
          src_xscale, src_yscale,
@@ -158,9 +155,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
 
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
-#ifndef GLAMOR_GLES2
-    glDisable(GL_TEXTURE_2D);
-#endif
     glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
     glUseProgram(0);
     glamor_put_context(glamor_priv);
diff --git a/glamor/glamor_trapezoid.c b/glamor/glamor_trapezoid.c
index 6ef0c1d..e64c19d 100644
--- a/glamor/glamor_trapezoid.c
+++ b/glamor/glamor_trapezoid.c
@@ -976,12 +976,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
     glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
     glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
     glDisable(GL_BLEND);
-#ifndef GLAMOR_GLES2
-    glActiveTexture(GL_TEXTURE0);
-    glDisable(GL_TEXTURE_2D);
-    glActiveTexture(GL_TEXTURE1);
-    glDisable(GL_TEXTURE_2D);
-#endif
     glUseProgram(0);
     glamor_put_context(glamor_priv);
 
-- 
1.9.rc1



More information about the xorg-devel mailing list