summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2008-02-29 11:15:02 +0800
committerXiang, Haihao <[email protected]>2008-02-29 11:16:21 +0800
commitde1e9880f8b239768293f7f434a9117dfab20162 (patch)
tree3ce4afb917c39795b0593f3d164802585680cb52 /src
parentb39f15b88f4ef585f260db689294c12b1aee41f2 (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.c20
-rw-r--r--src/mesa/drivers/dri/i965/brw_metaops.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_tnl.c6
-rw-r--r--src/mesa/main/texenvprogram.c3
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 349b8be49bd..1601f6dd248 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 3f5df27b887..dd62be34f4a 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 d58fd4c0da2..160fc34cb5e 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 de7d070b32c..b1c00a36ac6 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