Effectively disable _TexEnvProgram before calling _swrast_DrawPixels().
authorBrian <brian@i915.localnet.net>
Wed, 20 Jun 2007 17:01:04 +0000 (11:01 -0600)
committerBrian <brian@i915.localnet.net>
Wed, 20 Jun 2007 17:01:04 +0000 (11:01 -0600)
It's OK to use _TexEnvProgram regardless of the texture state, but if fog
is also enabled, the fragment program is lacking the actual fog computation
so fogging doesn't appear.
Fixing this might involve a new _MaintainFogProgram field and related code.
For now, just disable the _TexEnvProgram and let swrast handle everything.

src/mesa/drivers/dri/i915/intel_pixel.c
src/mesa/drivers/dri/i915tex/intel_pixel_draw.c

index 535cbfcb26e3fc61356d2f9ecb26eb17ac6b8d28..a52a81bf131e1948eecf517022537d9ad3f2734f 100644 (file)
@@ -440,9 +440,21 @@ intelDrawPixels( GLcontext *ctx,
       fprintf(stderr, "%s\n", __FUNCTION__);
 
    if (!intelTryDrawPixels( ctx, x, y, width, height, format, type,
-                            unpack, pixels ))
-      _swrast_DrawPixels( ctx, x, y, width, height, format, type,
-                         unpack, pixels );
+                            unpack, pixels )) {
+      if (ctx->FragmentProgram._Current == 
+          ctx->FragmentProgram._TexEnvProgram) {
+         /* don't want the i915 texenv program to be applied to DrawPixels */
+         struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
+         ctx->FragmentProgram._Current = NULL;
+         _swrast_DrawPixels( ctx, x, y, width, height, format, type,
+                             unpack, pixels );
+         ctx->FragmentProgram._Current = fpSave;
+      }
+      else {
+         _swrast_DrawPixels( ctx, x, y, width, height, format, type,
+                             unpack, pixels );
+      }
+   }
 }
 
 
index 10a079896aef17facb1a561a3c37e0375f084274..46480da1b124eb6c509b02759b6fed945bb1a9b8 100644 (file)
@@ -363,5 +363,17 @@ intelDrawPixels(GLcontext * ctx,
    if (INTEL_DEBUG & DEBUG_PIXEL)
       _mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
 
-   _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels);
+   if (ctx->FragmentProgram._Current == 
+       ctx->FragmentProgram._TexEnvProgram) {
+      /* don't want the i915 texenv program to be applied to DrawPixels */
+      struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
+      ctx->FragmentProgram._Current = NULL;
+      _swrast_DrawPixels( ctx, x, y, width, height, format, type,
+                          unpack, pixels );
+      ctx->FragmentProgram._Current = fpSave;
+   }
+   else {
+      _swrast_DrawPixels( ctx, x, y, width, height, format, type,
+                          unpack, pixels );
+   }
 }