fix double free issue(bug#14710). It also corrects glsl/bitmap demo behavior.
static void brwUseProgram(GLcontext *ctx, GLuint program)
{
- struct brw_context *brw = brw_context(ctx);
- struct gl_shader_program *sh_prog;
- _mesa_use_program(ctx, program);
- sh_prog = ctx->Shader.CurrentProgram;
- if (sh_prog) {
- if (sh_prog->VertexProgram) {
- brw->attribs.VertexProgram->Current = sh_prog->VertexProgram;
- sh_prog->VertexProgram->Base.RefCount++;
- ctx->VertexProgram.Enabled = GL_TRUE;
- }else
- ctx->VertexProgram.Enabled = GL_FALSE;
-
- if (sh_prog->FragmentProgram) {
- brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram;
- sh_prog->FragmentProgram->Base.RefCount++;
- ctx->FragmentProgram.Enabled = GL_TRUE;
- } else
- ctx->FragmentProgram.Enabled = GL_FALSE;
- }
+ _mesa_use_program(ctx, program);
}
static void brwInitProgFuncs( struct dd_function_table *functions )
vp_prog, strlen(vp_prog),
brw->metaops.vp);
- brw->metaops.attribs.VertexProgram->Current = brw->metaops.vp;
+ brw->metaops.attribs.VertexProgram->_Current = brw->metaops.vp;
brw->metaops.attribs.VertexProgram->_Enabled = GL_TRUE;
brw->metaops.attribs.FragmentProgram->_Current = brw->metaops.fp;
struct gl_vertex_program *old = brw->tnl_program;
/* _NEW_PROGRAM */
- if (brw->attribs.VertexProgram->_Enabled)
+ if (brw->attribs.VertexProgram->_Current)
return;
/* Grab all the relevent state and put it in a single structure:
const struct gl_vertex_program *prev = brw->vertex_program;
/* NEW_PROGRAM */
- if (brw->attribs.VertexProgram->_Enabled) {
- brw->vertex_program = brw->attribs.VertexProgram->Current;
+ if (brw->attribs.VertexProgram->_Current) {
+ brw->vertex_program = brw->attribs.VertexProgram->_Current;
}
else {
/* BRW_NEW_TNL_PROGRAM */
}
}
else {
- ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
+ /* _Current pointer has been updated in update_program */
+ // ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
}
/* Tell the driver about the change. Could define a new target for