diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2008-02-29 11:15:02 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2008-02-29 11:16:21 +0800 |
commit | de1e9880f8b239768293f7f434a9117dfab20162 (patch) | |
tree | 3ce4afb917c39795b0593f3d164802585680cb52 /src | |
parent | b39f15b88f4ef585f260db689294c12b1aee41f2 (diff) |
i965: use _Current pointer instead of Current pointer.
fix double free issue(bug#14710). It also corrects glsl/bitmap demo behavior.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_metaops.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_tnl.c | 6 | ||||
-rw-r--r-- | src/mesa/main/texenvprogram.c | 3 |
4 files changed, 7 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 349b8be49b..1601f6dd24 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -54,25 +54,7 @@ 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 ) diff --git a/src/mesa/drivers/dri/i965/brw_metaops.c b/src/mesa/drivers/dri/i965/brw_metaops.c index 3f5df27b88..dd62be34f4 100644 --- a/src/mesa/drivers/dri/i965/brw_metaops.c +++ b/src/mesa/drivers/dri/i965/brw_metaops.c @@ -196,7 +196,7 @@ static void init_metaops_state( struct brw_context *brw ) 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; diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c index d58fd4c0da..160fc34cb5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c +++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c @@ -1589,7 +1589,7 @@ static void update_tnl_program( struct brw_context *brw ) 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: @@ -1653,8 +1653,8 @@ static void update_active_vertprog( struct brw_context *brw ) 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 */ diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index de7d070b32..b1c00a36ac 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1271,7 +1271,8 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) } } 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 |