summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-02-09 15:25:30 +0100
committerEric Anholt <eric@anholt.net>2009-02-10 18:45:17 -0800
commitd11981e0d722282894b5012d37b2960ee3fbfac2 (patch)
tree97bdb46ed247cf9ce2a15fd772c47fb2ceedfa31
parentf82f1ffba9f2e5971a6a3f3927ae3b22b798bab2 (diff)
intel: Fix some state leakage of {Client,}ActiveTexture in metaops.
Found while debugging cairo-gl.
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 3a01f63dc7..1db7f5594e 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -495,6 +495,7 @@ intel_texture_bitmap(GLcontext * ctx,
texcoords[3][1] = 1.0;
_mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices);
+ _mesa_ClientActiveTextureARB(GL_TEXTURE0);
_mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
_mesa_Enable(GL_VERTEX_ARRAY);
_mesa_Enable(GL_TEXTURE_COORD_ARRAY);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index bb36649dac..0c9cf08ab9 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -72,6 +72,7 @@ intel_texture_drawpixels(GLcontext * ctx,
GLfloat vertices[4][4];
GLfloat texcoords[4][2];
GLfloat z;
+ GLint old_active_texture;
/* 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.
@@ -125,6 +126,7 @@ intel_texture_drawpixels(GLcontext * ctx,
/* XXX: pixel store stuff */
_mesa_Disable(GL_POLYGON_STIPPLE);
+ old_active_texture = ctx->Texture.CurrentUnit;
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB);
_mesa_Enable(GL_TEXTURE_2D);
_mesa_GenTextures(1, &texname);
@@ -176,12 +178,15 @@ intel_texture_drawpixels(GLcontext * ctx,
texcoords[3][1] = 1.0;
_mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices);
+ _mesa_ClientActiveTextureARB(GL_TEXTURE0);
_mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
_mesa_Enable(GL_VERTEX_ARRAY);
_mesa_Enable(GL_TEXTURE_COORD_ARRAY);
CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4));
intel_meta_restore_transform(intel);
+
+ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
_mesa_PopClientAttrib();
_mesa_PopAttrib();
@@ -209,6 +214,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
struct gl_pixelstore_attrib old_unpack;
GLstencil *stencil_pixels;
int row;
+ GLint old_active_texture;
if (format != GL_STENCIL_INDEX)
return GL_FALSE;
@@ -270,6 +276,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
_mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
old_fb_name = ctx->DrawBuffer->Name;
+ old_active_texture = ctx->Texture.CurrentUnit;
_mesa_Disable(GL_POLYGON_STIPPLE);
_mesa_Disable(GL_DEPTH_TEST);
@@ -355,6 +362,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
texcoords[3][1] = 1.0;
_mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices);
+ _mesa_ClientActiveTextureARB(GL_TEXTURE0);
_mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
_mesa_Enable(GL_VERTEX_ARRAY);
_mesa_Enable(GL_TEXTURE_COORD_ARRAY);
@@ -362,6 +370,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
intel_meta_restore_transform(intel);
+ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
_mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fb_name);
_mesa_PopClientAttrib();