[Mesa-dev] [PATCH 09/16] nir: move callsite of lower_outputs_to_temporaries

Jason Ekstrand jason at jlekstrand.net
Fri Apr 1 17:47:37 UTC 2016


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

On Sat, Mar 26, 2016 at 2:02 PM, Rob Clark <robdclark at gmail.com> wrote:

> From: Rob Clark <robclark at freedesktop.org>
>
> Going to convert this pass to parameterized lower_io_to_temporaries, and
> we want the user to be able to specify whether to lower outputs or
> inputs or both.  The restriction of running this pass before validate
> to avoid output reads no longer applies.
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
>  src/compiler/nir/glsl_to_nir.cpp                    | 2 --
>  src/compiler/nir/nir_lower_outputs_to_temporaries.c | 4 ----
>  src/mesa/drivers/dri/i965/brw_nir.c                 | 1 +
>  3 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/src/compiler/nir/glsl_to_nir.cpp
> b/src/compiler/nir/glsl_to_nir.cpp
> index f6e1a17..c9e0479 100644
> --- a/src/compiler/nir/glsl_to_nir.cpp
> +++ b/src/compiler/nir/glsl_to_nir.cpp
> @@ -143,8 +143,6 @@ 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);
> -
>     shader->info.name = ralloc_asprintf(shader, "GLSL%d",
> shader_prog->Name);
>     if (shader_prog->Label)
>        shader->info.label = ralloc_strdup(shader, shader_prog->Label);
> diff --git a/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> b/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> index 71b06b8..0e518cd 100644
> --- a/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> +++ b/src/compiler/nir/nir_lower_outputs_to_temporaries.c
> @@ -25,10 +25,6 @@
>   * Implements a pass that lowers output variables to a temporary plus an
>   * output variable with a single copy at each exit point of the shader.
>   * This way the output variable is only ever written.
> - *
> - * Because valid NIR requires that output variables are never read, this
> - * pass is more of a helper for NIR producers and must be run before the
> - * shader is ever validated.
>   */
>
>  #include "nir.h"
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c
> b/src/mesa/drivers/dri/i965/brw_nir.c
> index c62840a..e0c9465 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir.c
> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
> @@ -560,6 +560,7 @@ brw_create_nir(struct brw_context *brw,
>     /* First, lower the GLSL IR or Mesa IR to NIR */
>     if (shader_prog) {
>        nir = glsl_to_nir(shader_prog, stage, options);
> +      nir_lower_outputs_to_temporaries(nir);
>     } else {
>        nir = prog_to_nir(prog, options);
>        OPT_V(nir_convert_to_ssa); /* turn registers into SSA */
> --
> 2.5.5
>
> _______________________________________________
> 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/20160401/7f715622/attachment.html>


More information about the mesa-dev mailing list