On Fri, Jun 24, 2011 at 7:20 AM, Brian Paul <bri...@vmware.com> wrote: > On 06/23/2011 11:22 PM, Dave Airlie wrote: >> >> From: Dave Airlie<airl...@redhat.com> >> >> 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. >> >> Signed-off-by: Dave Airlie<airl...@redhat.com> >> --- >> src/mesa/program/program.c | 8 ++++---- >> src/mesa/program/program.h | 12 +++++++++++- >> 2 files changed, 15 insertions(+), 5 deletions(-) >> >> diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c >> index 78efca9..b419058 100644 >> --- a/src/mesa/program/program.c >> +++ b/src/mesa/program/program.c >> @@ -423,10 +423,11 @@ _mesa_lookup_program(struct gl_context *ctx, GLuint >> id) >> * Reference counting for vertex/fragment programs >> */ >> void >> -_mesa_reference_program(struct gl_context *ctx, >> +__mesa_reference_program(struct gl_context *ctx, >> struct gl_program **ptr, >> struct gl_program *prog) >> { >> +#ifndef NDEBUG >> assert(ptr); >> if (*ptr&& prog) { >> /* sanity check */ >> @@ -438,9 +439,8 @@ _mesa_reference_program(struct gl_context *ctx, >> else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM) >> ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM); >> } >> - if (*ptr == prog) { >> - return; /* no change */ >> - } >> +#endif >> + >> if (*ptr) { >> GLboolean deleteFlag; >> >> diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h >> index ce37b95..c093afa 100644 >> --- a/src/mesa/program/program.h >> +++ b/src/mesa/program/program.h >> @@ -89,11 +89,21 @@ extern struct gl_program * >> _mesa_lookup_program(struct gl_context *ctx, GLuint id); >> >> extern void >> -_mesa_reference_program(struct gl_context *ctx, >> +__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) >> +{ >> + if (*ptr == prog) >> + return; >> + __mesa_reference_program(ctx, ptr, prog); >> +} > > How about: > > if (*ptr != prog) > __mesa_reference_program(ctx, ptr, prog); > > > Otherwise, Reviewed-by: Brian Paul <bri...@vmware.com>
Dave, were you going to commit this patch? -Brian _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev