Use ProgramStringNotify
authorZou Nan hai <nanhai.zou@intel.com>
Tue, 17 Jul 2007 03:19:52 +0000 (11:19 +0800)
committerZou Nan hai <nanhai.zou@intel.com>
Tue, 17 Jul 2007 03:19:52 +0000 (11:19 +0800)
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/shader/program.c

index badf178b68e938aa0e7ea83aedc350bbe78960f5..8366f14dbead81e5d57aac8634b438b7dbf73f93 100644 (file)
@@ -62,30 +62,6 @@ static const struct dri_extension brw_extensions[] =
     { NULL,                                NULL }
 };
 
-static void brwLinkProgram(GLcontext *ctx, GLuint program)
-{
-        struct brw_context *brw = brw_context(ctx);
-        struct brw_vertex_program *vert_prog;
-        struct brw_fragment_program *frag_prog;
-        struct gl_shader_program *sh_prog;
-        _mesa_link_program(ctx, program);
-
-        sh_prog = _mesa_lookup_shader_program(ctx, program);
-       if (sh_prog) {
-           sh_prog->FragmentProgram = 
-               _mesa_realloc(sh_prog->FragmentProgram,
-                       sizeof(struct gl_fragment_program),
-                       sizeof(struct brw_fragment_program));
-           frag_prog = (struct brw_fragment_program *)sh_prog->FragmentProgram;
-           frag_prog->id = brw->program_id++;
-           sh_prog->VertexProgram = _mesa_realloc(sh_prog->VertexProgram,
-                   sizeof(struct gl_vertex_program),
-                   sizeof(struct brw_vertex_program));
-           vert_prog = (struct brw_vertex_program *)sh_prog->VertexProgram;
-           vert_prog->id = brw->program_id++;
-       }
-}
-
 static void brwUseProgram(GLcontext *ctx, GLuint program)
 {
         struct brw_context *brw = brw_context(ctx);
@@ -97,15 +73,12 @@ static void brwUseProgram(GLcontext *ctx, GLuint program)
             ctx->FragmentProgram.Enabled = GL_TRUE;
             brw->attribs.VertexProgram->Current = sh_prog->VertexProgram;
             brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram;
-            brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
-            brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
         }
 }
 
 static void brwInitProgFuncs( struct dd_function_table *functions )
 {
    functions->UseProgram = brwUseProgram;
-   functions->LinkProgram = brwLinkProgram;
 }
 static void brwInitDriverFunctions( struct dd_function_table *functions )
 {
index 420591982825d95fc8401f784032b44a726da747..03be368a922063a975b94a775913137a9636bcea 100644 (file)
@@ -242,6 +242,8 @@ _mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog,
 struct gl_program *
 _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
 {
+   if (ctx->Driver.NewProgram)
+        return ctx->Driver.NewProgram(ctx, target, id);
    switch (target) {
    case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
       return _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program),