From 1736447f27e815405ed6a08e939d9c418678f195 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Sun, 15 Dec 2019 18:54:26 -0500 Subject: [PATCH] freedreno/ir3: allow inputs with the same location turnip can have multiple inputs with the same location, and different location_frac. Signed-off-by: Jonathan Marek Reviewed-by: Eric Anholt Part-of: --- src/freedreno/ir3/ir3_compiler_nir.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 698d98c6c6a..656c85e67f1 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2704,7 +2704,7 @@ setup_input(struct ir3_context *ctx, nir_variable *in) return; so->inputs[n].slot = slot; - so->inputs[n].compmask = (1 << (ncomp + frac)) - 1; + so->inputs[n].compmask |= (1 << (ncomp + frac)) - 1; so->inputs_count = MAX2(so->inputs_count, n + 1); so->inputs[n].interpolate = in->data.interpolation; @@ -2767,17 +2767,25 @@ setup_input(struct ir3_context *ctx, nir_variable *in) ctx->inputs[idx] = instr; } } else if (ctx->so->type == MESA_SHADER_VERTEX) { - /* We shouldn't have fractional input for VS input.. that only shows - * up with varying packing - */ - assert(frac == 0); + struct ir3_instruction *input = NULL, *in; + struct ir3_instruction *components[4]; + unsigned mask = (1 << (ncomp + frac)) - 1; - struct ir3_instruction *input = create_input(ctx, (1 << ncomp) - 1); - struct ir3_instruction *components[ncomp]; + foreach_input(in, ctx->ir) { + if (in->input.inidx == n) { + input = in; + break; + } + } - input->input.inidx = n; + if (!input) { + input = create_input(ctx, mask); + input->input.inidx = n; + } else { + input->regs[0]->wrmask |= mask; + } - ir3_split_dest(ctx->block, components, input, 0, ncomp); + ir3_split_dest(ctx->block, components, input, frac, ncomp); for (int i = 0; i < ncomp; i++) { unsigned idx = (n * 4) + i + frac; -- 2.30.2