[Mesa-dev] [PATCH 1/2] mesa: add some gl_program cast wrappers

Kenneth Graunke kenneth at whitecape.org
Wed Jul 18 15:10:33 PDT 2012


On 07/18/2012 02:44 PM, Brian Paul wrote:
> ---
>  src/mesa/program/program.h |   42 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 42 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
> index 9cd1780..0a5650e 100644
> --- a/src/mesa/program/program.h
> +++ b/src/mesa/program/program.h
> @@ -216,4 +216,46 @@ _mesa_program_index_to_target(GLuint i)
>        return enums[i];
>  }
>  
> +
> +/* Cast wrappers from gl_program to gl_vertex/geometry/fragment_program */
> +
> +static INLINE struct gl_fragment_program *

I think we switched to "inline" a while back (and just #define'd that on
systems that don't have it).  Otherwise, these two look fine to me.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> +gl_fragment_program(struct gl_program *prog)
> +{
> +   return (struct gl_fragment_program *) prog;
> +}
> +
> +static INLINE const struct gl_fragment_program *
> +gl_fragment_program_const(const struct gl_program *prog)
> +{
> +   return (const struct gl_fragment_program *) prog;
> +}
> +
> +
> +static INLINE struct gl_vertex_program *
> +gl_vertex_program(struct gl_program *prog)
> +{
> +   return (struct gl_vertex_program *) prog;
> +}
> +
> +static INLINE const struct gl_vertex_program *
> +gl_vertex_program_const(const struct gl_program *prog)
> +{
> +   return (const struct gl_vertex_program *) prog;
> +}
> +
> +
> +static INLINE struct gl_geometry_program *
> +gl_geometry_program(struct gl_program *prog)
> +{
> +   return (struct gl_geometry_program *) prog;
> +}
> +
> +static INLINE const struct gl_geometry_program *
> +gl_geometry_program_const(const struct gl_program *prog)
> +{
> +   return (const struct gl_geometry_program *) prog;
> +}
> +
> +
>  #endif /* PROGRAM_H */
> 




More information about the mesa-dev mailing list