[Mesa-dev] [PATCH v2] mesa/st: Use 'struct nir_shader' instead of 'nir_shader'.

Jason Ekstrand jason at jlekstrand.net
Thu Jun 30 02:42:16 UTC 2016


On Jun 29, 2016 7:16 PM, "Vinson Lee" <vlee at freedesktop.org> wrote:
>
> Fix this build error with GCC 4.4.
>
>   CC     state_tracker/st_nir_lower_builtin.lo
> In file included from state_tracker/st_nir_lower_builtin.c:61:
> state_tracker/st_nir.h:34: error: redefinition of typedef ‘nir_shader’
> ../../src/compiler/nir/nir.h:1830: note: previous declaration of
‘nir_shader’ was here
>
> Suggested-by: Rob Clark <robclark at freedesktop.org>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96235
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  src/mesa/state_tracker/st_nir.h               |   12 ++++++------
>  src/mesa/state_tracker/st_nir_lower_builtin.c |    6 +++---
>  2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_nir.h
b/src/mesa/state_tracker/st_nir.h
> index 49ba573..4f3c606 100644
> --- a/src/mesa/state_tracker/st_nir.h
> +++ b/src/mesa/state_tracker/st_nir.h
> @@ -31,14 +31,14 @@
>  extern "C" {
>  #endif
>
> -typedef struct nir_shader nir_shader;
> +struct nir_shader;
>
> -void st_nir_lower_builtin(nir_shader *shader);
> -nir_shader * st_glsl_to_nir(struct st_context *st, struct gl_program
*prog,
> -                            struct gl_shader_program *shader_program,
> -                            gl_shader_stage stage);
> +void st_nir_lower_builtin(struct nir_shader *shader);
> +struct nir_shader * st_glsl_to_nir(struct st_context *st, struct
gl_program *prog,
> +                                  struct gl_shader_program
*shader_program,
> +                                  gl_shader_stage stage);

We've done this other places to avoid extra nir.h dependencies.  However, I
don't think the st_nir_lower_builtins.c bits are needed since that pulls in
nir.h and the typedef with it.  If it's not needed please drop it.  The
st_nir.h bits are

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

>
> -void st_finalize_nir(struct st_context *st, struct gl_program *prog,
nir_shader *nir);
> +void st_finalize_nir(struct st_context *st, struct gl_program *prog,
struct nir_shader *nir);
>
>  struct gl_program *
>  st_nir_get_mesa_program(struct gl_context *ctx,
> diff --git a/src/mesa/state_tracker/st_nir_lower_builtin.c
b/src/mesa/state_tracker/st_nir_lower_builtin.c
> index 20b04d1..e71262a 100644
> --- a/src/mesa/state_tracker/st_nir_lower_builtin.c
> +++ b/src/mesa/state_tracker/st_nir_lower_builtin.c
> @@ -64,7 +64,7 @@
>  #include "program/prog_instruction.h"
>
>  typedef struct {
> -   nir_shader *shader;
> +   struct nir_shader *shader;
>     nir_builder builder;
>     void *mem_ctx;
>  } lower_builtin_state;
> @@ -99,7 +99,7 @@ static nir_variable *
>  get_variable(lower_builtin_state *state, nir_deref_var *deref,
>               const struct gl_builtin_uniform_element *element)
>  {
> -   nir_shader *shader = state->shader;
> +   struct nir_shader *shader = state->shader;
>     int tokens[STATE_LENGTH];
>
>     memcpy(tokens, element->tokens, sizeof(tokens));
> @@ -237,7 +237,7 @@ lower_builtin_impl(lower_builtin_state *state,
nir_function_impl *impl)
>  }
>
>  void
> -st_nir_lower_builtin(nir_shader *shader)
> +st_nir_lower_builtin(struct nir_shader *shader)
>  {
>     lower_builtin_state state;
>     state.shader = shader;
> --
> 1.7.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160629/c5ea3a1e/attachment.html>


More information about the mesa-dev mailing list