summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/program.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-07-14 08:09:21 -0600
committerBrian Paul <brianp@vmware.com>2011-07-14 08:09:38 -0600
commit323e4bff799a657632c5777c8be6e306202953af (patch)
treea6003e6d3624241d9c8fc301863539069cb0283f /src/mesa/program/program.h
parent8619aa5683eb16c12a1b2eaeab2378855791ec8c (diff)
downloadexternal_mesa3d-323e4bff799a657632c5777c8be6e306202953af.zip
external_mesa3d-323e4bff799a657632c5777c8be6e306202953af.tar.gz
external_mesa3d-323e4bff799a657632c5777c8be6e306202953af.tar.bz2
mesa: split _mesa_reference_program() into hot/cold paths.
inline the hotpath of the reference remaining the same. This shouldn't penalise the slow path at all but improve the hot path so we don't have to jump to the function. It also moves some assert checks under an #ifndef NDEBUG. Minor clean-ups added by Brian. Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/program/program.h')
-rw-r--r--src/mesa/program/program.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index ce37b95..0f32a6a 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -89,9 +89,18 @@ extern struct gl_program *
_mesa_lookup_program(struct gl_context *ctx, GLuint id);
extern void
+_mesa_reference_program_(struct gl_context *ctx,
+ struct gl_program **ptr,
+ struct gl_program *prog);
+
+static INLINE void
_mesa_reference_program(struct gl_context *ctx,
struct gl_program **ptr,
- struct gl_program *prog);
+ struct gl_program *prog)
+{
+ if (*ptr != prog)
+ _mesa_reference_program_(ctx, ptr, prog);
+}
static INLINE void
_mesa_reference_vertprog(struct gl_context *ctx,