Mesa (master): intel: Speed up glDrawPixels(GL_ALPHA) by using an alpha texture format.

Eric Anholt anholt at kemper.freedesktop.org
Wed Feb 11 02:45:37 UTC 2009


Module: Mesa
Branch: master
Commit: 0b63f6449e095fa3b5ef510e1c1eadc2e0e0ea36
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b63f6449e095fa3b5ef510e1c1eadc2e0e0ea36

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Feb  9 14:55:31 2009 +0100

intel: Speed up glDrawPixels(GL_ALPHA) by using an alpha texture format.

---

 src/mesa/drivers/dri/intel/intel_pixel_draw.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 0c9cf08..7be7ea8 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -73,6 +73,7 @@ intel_texture_drawpixels(GLcontext * ctx,
    GLfloat texcoords[4][2];
    GLfloat z;
    GLint old_active_texture;
+   GLenum internalFormat;
 
    /* We're going to mess with texturing with no regard to existing texture
     * state, so if there is some set up we have to bail.
@@ -134,11 +135,11 @@ intel_texture_drawpixels(GLcontext * ctx,
    _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-   /*
-   _mesa_TexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
-   _mesa_TexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
-   */
-   _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, format,
+   if (type == GL_ALPHA)
+      internalFormat = GL_ALPHA;
+   else
+      internalFormat = GL_RGBA;
+   _mesa_TexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format,
 		    type, pixels);
 
    intel_meta_set_passthrough_transform(intel);




More information about the mesa-commit mailing list