[Mesa-dev] [PATCH 24/26] nir/lower_out_to_temp: Add an "entrypoint" parameter

Rob Clark robdclark at gmail.com
Sat Mar 26 16:37:17 UTC 2016


On Fri, Mar 25, 2016 at 7:12 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> Previously, the pass assumed that the entrypoint would be whatever function
> happened to have the name "main".  We really shouldn't trust in the
> function names.

heh, ok, this one will be more conflict than not w/ my branch ;-)

Reviewed-by: Rob Clark <robdclark at gmail.com>


> ---
>  src/compiler/nir/glsl_to_nir.cpp                    | 2 +-
>  src/compiler/nir/nir.h                              | 4 +++-
>  src/compiler/nir/nir_lower_outputs_to_temporaries.c | 4 ++--
>  3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp
> index efef9f5..14affee 100644
> --- a/src/compiler/nir/glsl_to_nir.cpp
> +++ b/src/compiler/nir/glsl_to_nir.cpp
> @@ -143,7 +143,7 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
>     v2.run(sh->ir);
>     visit_exec_list(sh->ir, &v1);
>
> -   nir_lower_outputs_to_temporaries(shader);
> +   nir_lower_outputs_to_temporaries(shader, nir_shader_get_entrypoint(shader));
>
>     shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name);
>     if (shader_prog->Label)
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index d39c5fd..45f208a 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -2229,7 +2229,9 @@ bool nir_lower_indirect_derefs(nir_shader *shader, uint32_t mode_mask);
>
>  bool nir_lower_locals_to_regs(nir_shader *shader);
>
> -void nir_lower_outputs_to_temporaries(nir_shader *shader);
> +void nir_lower_outputs_to_temporaries(nir_shader *shader,
> +                                      nir_function *entrypoint);
> +
>  void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint);
>
>  void nir_assign_var_locations(struct exec_list *var_list,
> diff --git a/src/compiler/nir/nir_lower_outputs_to_temporaries.c b/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> index 80c9af4..00ac091 100644
> --- a/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> +++ b/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> @@ -74,7 +74,7 @@ emit_output_copies_block(nir_block *block, void *state)
>  }
>
>  void
> -nir_lower_outputs_to_temporaries(nir_shader *shader)
> +nir_lower_outputs_to_temporaries(nir_shader *shader, nir_function *entrypoint)
>  {
>     struct lower_outputs_state state;
>
> @@ -117,7 +117,7 @@ nir_lower_outputs_to_temporaries(nir_shader *shader)
>            * before each EmitVertex call.
>            */
>           nir_foreach_block(function->impl, emit_output_copies_block, &state);
> -      } else if (strcmp(function->name, "main") == 0) {
> +      } else if (function == entrypoint) {
>           /* For all other shader types, we need to do the copies right before
>            * the jumps to the end block.
>            */
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list