i965: need to disable current shader, if any, in intel_clear_tris()
authorBrian Paul <brianp@vmware.com>
Mon, 9 Feb 2009 19:12:09 +0000 (12:12 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 9 Feb 2009 19:12:29 +0000 (12:12 -0700)
Fixes bad background in all the progs/glsl/ tests.

src/mesa/drivers/dri/intel/intel_clear.c

index f95d055e6212a2a45187f58c2747db93ea302d0a..a47c4d4050e3193115e9e7048badb49b6e488658 100644 (file)
@@ -39,6 +39,7 @@
 #include "main/macros.h"
 #include "main/matrix.h"
 #include "main/texstate.h"
+#include "main/shaders.h"
 #include "main/stencil.h"
 #include "main/varray.h"
 #include "glapi/dispatch.h"
@@ -71,6 +72,7 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
    struct gl_framebuffer *fb = ctx->DrawBuffer;
    int i;
    GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE;
+   GLboolean saved_shader_program = 0;
    unsigned int saved_active_texture;
 
    assert((mask & ~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT |
@@ -109,6 +111,10 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
       saved_vp_enable = GL_TRUE;
       _mesa_Disable(GL_VERTEX_PROGRAM_ARB);
    }
+   if (ctx->Extensions.ARB_shader_objects && ctx->Shader.CurrentProgram) {
+      saved_shader_program = ctx->Shader.CurrentProgram->Name;
+      _mesa_UseProgramObjectARB(0);
+   }
 
    if (ctx->Texture._EnabledUnits != 0) {
       int i;
@@ -215,6 +221,9 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask)
    if (saved_vp_enable)
       _mesa_Enable(GL_VERTEX_PROGRAM_ARB);
 
+   if (saved_shader_program)
+      _mesa_UseProgramObjectARB(saved_shader_program);
+
    _mesa_PopClientAttrib();
    _mesa_PopAttrib();
 }