[Mesa-dev] [RFCv2 12/13] freedreno/ir3: don't ignore local vars

Rob Clark robdclark at gmail.com
Sun Nov 8 12:12:33 PST 2015


From: Rob Clark <robclark at freedesktop.org>

With glsl_to_nir we end up with local variables, instead of global, for
arrays.

Note that we'll eventually have to do something more clever, I think,
when we support multiple functions, but that will probably take some
work in a few places.
---
 src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index e77afcc..cd664bc 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -2330,11 +2330,17 @@ emit_instructions(struct ir3_compile *ctx)
 	setup_vars(ctx, &ctx->s->inputs, setup_input);
 	setup_vars(ctx, &ctx->s->outputs, setup_output);
 
-	/* Setup variables (which should only be arrays): */
+	/* Setup global variables (which should only be arrays): */
 	nir_foreach_variable(var, &ctx->s->globals) {
 		declare_var(ctx, var);
 	}
 
+	/* Setup local variables (which should only be arrays): */
+	/* NOTE: need to do something more clever when we support >1 fxn */
+	nir_foreach_variable(var, &fxn->locals) {
+		declare_var(ctx, var);
+	}
+
 	/* And emit the body: */
 	ctx->impl = fxn;
 	emit_function(ctx, fxn);
-- 
2.5.0



More information about the mesa-dev mailing list