summaryrefslogtreecommitdiff
path: root/src/mesa/shader/program.h
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-05-06 22:13:06 -0600
committerBrian <brian.paul@tungstengraphics.com>2008-05-06 22:13:06 -0600
commit103ae5d16fd9fef566096570f731bb634a8025d4 (patch)
tree184578514c317c199b6b05bee1f3c57bf3e19877 /src/mesa/shader/program.h
parent10f6ae0355937615d137c79c060b9e5a923f0d65 (diff)
gallium: implement full reference counting for vertex/fragment programs
Use _mesa_reference_vert/fragprog() wherever we assign program pointers. Fixes a memory corruption bug found with glean/api2 test. Another memory bug involving shaders yet to be fixed...
Diffstat (limited to 'src/mesa/shader/program.h')
-rw-r--r--src/mesa/shader/program.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h
index 414a57d39c..08fe576afc 100644
--- a/src/mesa/shader/program.h
+++ b/src/mesa/shader/program.h
@@ -83,6 +83,28 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog);
extern struct gl_program *
_mesa_lookup_program(GLcontext *ctx, GLuint id);
+extern void
+_mesa_reference_program(GLcontext *ctx,
+ struct gl_program **ptr,
+ struct gl_program *prog);
+
+static INLINE void
+_mesa_reference_vertprog(GLcontext *ctx,
+ struct gl_vertex_program **ptr,
+ struct gl_vertex_program *prog)
+{
+ _mesa_reference_program(ctx, (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
+
+static INLINE void
+_mesa_reference_fragprog(GLcontext *ctx,
+ struct gl_fragment_program **ptr,
+ struct gl_fragment_program *prog)
+{
+ _mesa_reference_program(ctx, (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
extern struct gl_program *
_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog);