fix segfault with i915 drivers in swrast drawpixels path when resizing windows
authorRoland Scheidegger <sroland@tungstengraphics.com>
Mon, 16 Jul 2007 16:09:30 +0000 (18:09 +0200)
committerRoland Scheidegger <sroland@tungstengraphics.com>
Mon, 16 Jul 2007 16:23:46 +0000 (18:23 +0200)
src/mesa/drivers/dri/i915/intel_pixel.c
src/mesa/drivers/dri/i915tex/intel_pixel_draw.c

index d175870a0c5e3c48bc660049afb70ffd6d98620a..c3030d42b04801944f3124c1eaf87d0d80715b62 100644 (file)
@@ -450,10 +450,16 @@ intelDrawPixels( GLcontext *ctx,
        * wise happily run the fragment program on each pixel in the image).
        */
       struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
+   /* can't just set current frag prog to 0 here as on buffer resize
+      we'll get new state checks which will segfault. Remains a hack. */
       ctx->FragmentProgram._Current = NULL;
+      ctx->FragmentProgram._UseTexEnvProgram = GL_FALSE;
+      ctx->FragmentProgram._Active = GL_FALSE;
       _swrast_DrawPixels( ctx, x, y, width, height, format, type,
                           unpack, pixels );
       ctx->FragmentProgram._Current = fpSave;
+      ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
+      ctx->FragmentProgram._Active = GL_TRUE;
    }
    else {
       _swrast_DrawPixels( ctx, x, y, width, height, format, type,
index 77c67c821eb07118df3fac7e85ba6bdf0af669c1..e4e57cb3a7e28c3bddbeb7c1a99d99a650be04d6 100644 (file)
@@ -370,10 +370,16 @@ intelDrawPixels(GLcontext * ctx,
        * wise happily run the fragment program on each pixel in the image).
        */
       struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
+   /* can't just set current frag prog to 0 here as on buffer resize
+      we'll get new state checks which will segfault. Remains a hack. */
       ctx->FragmentProgram._Current = NULL;
+      ctx->FragmentProgram._UseTexEnvProgram = GL_FALSE;
+      ctx->FragmentProgram._Active = GL_FALSE;
       _swrast_DrawPixels( ctx, x, y, width, height, format, type,
                           unpack, pixels );
       ctx->FragmentProgram._Current = fpSave;
+      ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
+      ctx->FragmentProgram._Active = GL_TRUE;
    }
    else {
       _swrast_DrawPixels( ctx, x, y, width, height, format, type,