From: Rob Clark Date: Tue, 25 Feb 2014 13:02:28 +0000 (-0500) Subject: freedreno/a3xx: fix for unused inputs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76924e3b5178aef80804a8933e764661df6b37df;p=mesa.git freedreno/a3xx: fix for unused inputs An unused input might not have a register assigned. We don't want bogus regid to result in impossibly high max_reg.. Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c index 34d4dd3330b..9cc09889f98 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c @@ -80,10 +80,16 @@ static void fixup_vp_regfootprint(struct fd3_shader_variant *so) { unsigned i; - for (i = 0; i < so->inputs_count; i++) - so->info.max_reg = MAX2(so->info.max_reg, (so->inputs[i].regid + 3) >> 2); - for (i = 0; i < so->outputs_count; i++) - so->info.max_reg = MAX2(so->info.max_reg, (so->outputs[i].regid + 3) >> 2); + for (i = 0; i < so->inputs_count; i++) { + if (so->inputs[i].compmask) { + uint32_t regid = (so->inputs[i].regid + 3) >> 2; + so->info.max_reg = MAX2(so->info.max_reg, regid); + } + } + for (i = 0; i < so->outputs_count; i++) { + uint32_t regid = (so->outputs[i].regid + 3) >> 2; + so->info.max_reg = MAX2(so->info.max_reg, regid); + } } static struct fd3_shader_variant * diff --git a/src/gallium/drivers/freedreno/a3xx/ir3_ra.c b/src/gallium/drivers/freedreno/a3xx/ir3_ra.c index 1b3d0e3e1e5..904727a7d70 100644 --- a/src/gallium/drivers/freedreno/a3xx/ir3_ra.c +++ b/src/gallium/drivers/freedreno/a3xx/ir3_ra.c @@ -565,7 +565,7 @@ static void legalize(struct ir3_ra_ctx *ctx, struct ir3_block *block) struct ir3_instruction *end = ir3_instr_create(block, 0, OPC_END); struct ir3_instruction *last_input = NULL; - regmask_t needs_ss_war; + regmask_t needs_ss_war; /* write after read */ regmask_t needs_ss; regmask_t needs_sy;