[Mesa-dev] [PATCH 5/6] glsl: Create an accessor for the built-in function shader.

Ian Romanick idr at freedesktop.org
Sat Nov 23 16:03:06 PST 2013


Would it be better to just make _mesa_glsl_get_builtin_function_shader a
friend?

On 11/23/2013 01:43 PM, Kenneth Graunke wrote:
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/builtin_functions.cpp | 12 ++++++++++--
>  src/glsl/ir.h                  |  3 +++
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index 8cb75e5..e768685 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -357,8 +357,6 @@ public:
>     ir_function_signature *find(_mesa_glsl_parse_state *state,
>                                 const char *name, exec_list *actual_parameters);
>  
> -private:
> -   void *mem_ctx;
>     /**
>      * A shader to hold all the built-in signatures; created by this module.
>      *
> @@ -368,6 +366,9 @@ private:
>      */
>     gl_shader *shader;
>  
> +private:
> +   void *mem_ctx;
> +
>     /** Global variables used by built-in functions. */
>     ir_variable *gl_ModelViewProjectionMatrix;
>     ir_variable *gl_Vertex;
> @@ -4020,4 +4021,11 @@ _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
>  {
>     return builtins.find(state, name, actual_parameters);
>  }
> +
> +gl_shader *
> +_mesa_glsl_get_builtin_function_shader()
> +{
> +   return builtins.shader;
> +}
> +
>  /** @} */
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index 4f775da..70c6736 100644
> --- a/src/glsl/ir.h
> +++ b/src/glsl/ir.h
> @@ -2344,6 +2344,9 @@ extern ir_function_signature *
>  _mesa_glsl_find_builtin_function(_mesa_glsl_parse_state *state,
>                                   const char *name, exec_list *actual_parameters);
>  
> +extern gl_shader *
> +_mesa_glsl_get_builtin_function_shader(void);
> +
>  extern void
>  _mesa_glsl_release_functions(void);
>  
> 



More information about the mesa-dev mailing list