summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.h
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-05-06 22:13:06 -0600
committerBrian <[email protected]>2008-05-06 22:13:06 -0600
commit103ae5d16fd9fef566096570f731bb634a8025d4 (patch)
tree184578514c317c199b6b05bee1f3c57bf3e19877 /src/mesa/state_tracker/st_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/state_tracker/st_program.h')
-rw-r--r--src/mesa/state_tracker/st_program.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index d8f26da2eeb..bf07a50789e 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -34,7 +34,8 @@
#ifndef ST_PROGRAM_H
#define ST_PROGRAM_H
-#include "mtypes.h"
+#include "main/mtypes.h"
+#include "shader/program.h"
#include "pipe/p_shader_tokens.h"
@@ -115,6 +116,27 @@ st_vertex_program( struct gl_vertex_program *vp )
}
+static INLINE void
+st_reference_vertprog(struct st_context *st,
+ struct st_vertex_program **ptr,
+ struct st_vertex_program *prog)
+{
+ _mesa_reference_program(st->ctx,
+ (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
+
+static INLINE void
+st_reference_fragprog(struct st_context *st,
+ struct st_fragment_program **ptr,
+ struct st_fragment_program *prog)
+{
+ _mesa_reference_program(st->ctx,
+ (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
+
+
extern void
st_translate_fragment_program(struct st_context *st,
struct st_fragment_program *fp,