st/mesa: Treat vertex outputs absent in outputMapping as zero in mesa_to_tgsi

After updating vertex outputs being written based on optimized NIR, they may
go out of sync with outputs 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 outputs as zero because there is no pass to
entirely get rid of them.

Similar to eeab9c93db but now for outputs.

Fixes: d684fb37bf
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3365
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6187>
This commit is contained in:
Danylo Piliaiev 2020-08-05 18:07:06 +03:00 committed by Marge Bot
parent a92cfa66b4
commit 782ba8d3ae
1 changed files with 12 additions and 5 deletions

View File

@ -97,9 +97,12 @@ dst_register(struct st_translate *t, gl_register_file file, GLuint index)
else
assert(index < VARYING_SLOT_MAX);
assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs));
return t->outputs[t->outputMapping[index]];
if (t->outputMapping[index] < ARRAY_SIZE(t->outputs))
return t->outputs[t->outputMapping[index]];
else {
assert(t->procType == PIPE_SHADER_VERTEX);
return ureg_dst(ureg_DECL_constant(t->ureg, 0));
}
case PROGRAM_ADDRESS:
return t->address[index];
@ -149,8 +152,12 @@ src_register(struct st_translate *t,
}
case PROGRAM_OUTPUT:
assert(t->outputMapping[index] < ARRAY_SIZE(t->outputs));
return ureg_src(t->outputs[t->outputMapping[index]]); /* not needed? */
if (t->outputMapping[index] < ARRAY_SIZE(t->outputs))
return ureg_src(t->outputs[t->outputMapping[index]]);
else {
assert(t->procType == PIPE_SHADER_VERTEX);
return ureg_DECL_constant(t->ureg, 0);
}
case PROGRAM_ADDRESS:
return ureg_src(t->address[index]);