st/mesa: Treat vertex inputs absent in inputMapping as zero in mesa_to_tgsi

After updating vertex inputs being read based on optimized NIR, they may go out
of sync with inputs in mesa IR. Which is translated to TGSI and used together
with NIR if draw doesn't have llvm.

It's much easier to treat such inputs as zero because there is no pass to
entirely get rid of them and they don't contribute to shader's output.

Fixes: d684fb37bf
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2815
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4705>
This commit is contained in:
Danylo Piliaiev 2020-04-23 12:41:34 +03:00 committed by Marge Bot
parent b785ad5853
commit eeab9c93db
1 changed files with 6 additions and 2 deletions

View File

@ -141,8 +141,12 @@ src_register(struct st_translate *t,
return t->constants[index];
case PROGRAM_INPUT:
assert(t->inputMapping[index] < ARRAY_SIZE(t->inputs));
return t->inputs[t->inputMapping[index]];
if (t->inputMapping[index] < ARRAY_SIZE(t->inputs))
return t->inputs[t->inputMapping[index]];
else {
assert(t->procType == PIPE_SHADER_VERTEX);
return ureg_DECL_constant(t->ureg, 0);
}
case PROGRAM_OUTPUT:
assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs));