diff options
author | Dave Airlie <[email protected]> | 2011-07-14 08:09:21 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-07-14 08:09:38 -0600 |
commit | 323e4bff799a657632c5777c8be6e306202953af (patch) | |
tree | a6003e6d3624241d9c8fc301863539069cb0283f /src/mesa/program/program.c | |
parent | 8619aa5683eb16c12a1b2eaeab2378855791ec8c (diff) |
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 <[email protected]>
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/program/program.c')
-rw-r--r-- | src/mesa/program/program.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index 78efca9f122..adca094ee89 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -421,12 +421,15 @@ _mesa_lookup_program(struct gl_context *ctx, GLuint id) /** * Reference counting for vertex/fragment programs + * This is normally only called from the _mesa_reference_program() macro + * when there's a real pointer change. */ void -_mesa_reference_program(struct gl_context *ctx, - struct gl_program **ptr, - struct gl_program *prog) +_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 +441,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; |