summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/program.h
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-05-06 23:08:51 -0600
committerBrian <[email protected]>2008-05-06 23:08:51 -0600
commitdf43fb661b2030d9b833a42dd47b8d7bf58d73aa (patch)
treefe53a42d227411380c67d66f05e4f2f9c323bb69 /src/mesa/shader/program.h
parent38c5b148531b1f470956bb9d66757e7301ce0535 (diff)
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.
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 ea2c8c30508..9a6883e6a55 100644
--- a/src/mesa/shader/program.h
+++ b/src/mesa/shader/program.h
@@ -86,6 +86,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);