Module: Mesa Branch: master Commit: 3f7509beffaf924a22227e70b499326393c5b885 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f7509beffaf924a22227e70b499326393c5b885
Author: Brian Paul <[email protected]> Date: Sat Mar 17 16:30:03 2012 -0600 mesa: make _mesa_reference_sampler_object() an inline function To make the no-change case faster, as we do for the other object-reference functions. Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Eric Anholt <[email protected]> --- src/mesa/main/samplerobj.c | 9 ++++----- src/mesa/main/samplerobj.h | 12 +++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 7cf0654..5d1b2ad 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -55,12 +55,11 @@ _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name) * Handle reference counting. */ void -_mesa_reference_sampler_object(struct gl_context *ctx, - struct gl_sampler_object **ptr, - struct gl_sampler_object *samp) +_mesa_reference_sampler_object_(struct gl_context *ctx, + struct gl_sampler_object **ptr, + struct gl_sampler_object *samp) { - if (*ptr == samp) - return; + assert(*ptr != samp); /* The inline wrapper should prevent no-op calls */ if (*ptr) { /* Unreference the old sampler */ diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h index fe7d5a7..c22d025 100644 --- a/src/mesa/main/samplerobj.h +++ b/src/mesa/main/samplerobj.h @@ -38,9 +38,19 @@ _mesa_get_samplerobj(struct gl_context *ctx, GLuint unit) } extern void +_mesa_reference_sampler_object_(struct gl_context *ctx, + struct gl_sampler_object **ptr, + struct gl_sampler_object *samp); + +static inline void _mesa_reference_sampler_object(struct gl_context *ctx, struct gl_sampler_object **ptr, - struct gl_sampler_object *samp); + struct gl_sampler_object *samp) +{ + if (*ptr != samp) + _mesa_reference_sampler_object_(ctx, ptr, samp); +} + extern void _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name); _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
