[Mesa-dev] Mesa (master): mesa: convert macros to inline functions

Ian Romanick idr at freedesktop.org
Mon Feb 21 15:14:47 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/21/2011 02:16 PM, Brian Paul wrote:
> Module: Mesa
> Branch: master
> Commit: e9ff76aa81d9bd973d46b7e46f1e4ece2112a5b7
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9ff76aa81d9bd973d46b7e46f1e4ece2112a5b7
> 
> Author: Brian Paul <brianp at vmware.com>
> Date:   Mon Feb 21 15:11:44 2011 -0700
> 
> mesa: convert macros to inline functions
> 
> ---
> 
>  src/mesa/main/context.h |   44 ++++++++++++++++++++++----------------------
>  1 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
> index 4e391dd..8c115c7 100644
> --- a/src/mesa/main/context.h
> +++ b/src/mesa/main/context.h
> @@ -192,41 +192,41 @@ _mesa_Flush( void );
>  
>  /**
>   * Flush vertices.
> - *
> - * \param ctx GL context.
> - * \param newstate new state.
> + * \param newstate  bitmask of _NEW_x flags
>   *
>   * Checks if dd_function_table::NeedFlush is marked to flush stored vertices,
>   * and calls dd_function_table::FlushVertices if so. Marks
>   * __struct gl_contextRec::NewState with \p newstate.
>   */
> -#define FLUSH_VERTICES(ctx, newstate)				\
> -do {								\
> -   if (MESA_VERBOSE & VERBOSE_STATE)				\
> -      _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
> -   if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES)		\
> -      ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES);	\
> -   ctx->NewState |= newstate;					\
> -} while (0)
> +static INLINE void
> +FLUSH_VERTICES(struct gl_context *ctx, GLbitfield newstate)
> +{
> +   if (MESA_VERBOSE & VERBOSE_STATE)
> +      _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);
> +   if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES)
> +      ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES);
> +   ctx->NewState |= newstate;
> +}

So, now the _mesa_debug messages will show "FLUSH_VERTICES in
FLUSH_VERTICES".  That doesn't seem useful. :)  Ditto for FLUSH_CURRENT
below.

> +
>  
>  /**
>   * Flush current state.
> - *
> - * \param ctx GL context.
> - * \param newstate new state.
> + * \param newstate  bitmask of _NEW_x flags
>   *
>   * Checks if dd_function_table::NeedFlush is marked to flush current state,
>   * and calls dd_function_table::FlushVertices if so. Marks
>   * __struct gl_contextRec::NewState with \p newstate.
>   */
> -#define FLUSH_CURRENT(ctx, newstate)				\
> -do {								\
> -   if (MESA_VERBOSE & VERBOSE_STATE)				\
> -      _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION);	\
> -   if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)		\
> -      ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT);	\
> -   ctx->NewState |= newstate;					\
> -} while (0)
> +static INLINE void
> +FLUSH_CURRENT(struct gl_context *ctx, GLbitfield newstate)
> +{
> +   if (MESA_VERBOSE & VERBOSE_STATE)
> +      _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION);
> +   if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)
> +      ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT);
> +   ctx->NewState |= newstate;
> +}
> +
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1i8eMACgkQX1gOwKyEAw/VeQCffkOHrGwQiGhZw8L2AYHYzrS1
pdgAoJ5D0upXPr4copKoL64sicy/GSHj
=LMiI
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list