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@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
v2.run(sh->ir);
visit_exec_list(sh->ir, &v1);
- 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)
shader->info.label = ralloc_strdup(shader, shader_prog->Label);
* 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"
/* First, lower the GLSL IR or Mesa IR to NIR */
if (shader_prog) {
nir = glsl_to_nir(shader_prog, stage, options);
+ OPT_V(nir_lower_outputs_to_temporaries, nir_shader_get_entrypoint(nir));
} else {
nir = prog_to_nir(prog, options);
OPT_V(nir_convert_to_ssa); /* turn registers into SSA */