fix issue when only fragment shader or vertex shader is used
authorZou Nan hai <nanhai.zou@intel.com>
Thu, 27 Sep 2007 07:47:00 +0000 (15:47 +0800)
committerZou Nan hai <nanhai.zou@intel.com>
Thu, 27 Sep 2007 07:47:00 +0000 (15:47 +0800)
src/mesa/drivers/dri/i965/brw_context.c

index 8366f14dbead81e5d57aac8634b438b7dbf73f93..2031d556c1b5199983c7019782d439b8af9eb281 100644 (file)
@@ -69,11 +69,18 @@ static void brwUseProgram(GLcontext *ctx, GLuint program)
         _mesa_use_program(ctx, program);
         sh_prog = ctx->Shader.CurrentProgram;
         if (sh_prog) {
-            ctx->VertexProgram.Enabled = GL_TRUE;
-            ctx->FragmentProgram.Enabled = GL_TRUE;
-            brw->attribs.VertexProgram->Current = sh_prog->VertexProgram;
-            brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram;
-        }
+           if (sh_prog->VertexProgram) {
+               brw->attribs.VertexProgram->Current = sh_prog->VertexProgram;
+               ctx->VertexProgram.Enabled = GL_TRUE;
+           }else
+               ctx->VertexProgram.Enabled = GL_FALSE;
+               
+           if (sh_prog->FragmentProgram) {
+               brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram;
+               ctx->FragmentProgram.Enabled = GL_TRUE;
+           } else
+               ctx->VertexProgram.Enabled = GL_FALSE;
+       }
 }
 
 static void brwInitProgFuncs( struct dd_function_table *functions )