summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/program.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-07 08:55:33 -0600
committerBrian Paul <[email protected]>2008-05-07 08:55:33 -0600
commita56a59ce74b7f18f25a13992d2a2c1ae7cf973ce (patch)
tree77480d5ff607adcfa5c7688805c514e4ab5c51e3 /src/mesa/shader/program.h
parent10b7192747087ec25f97cdfcfc062654a2d8fe6d (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... Picked from gallium-0.1
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 414a57d39cc..08fe576afc1 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);