summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorDanylo Piliaiev <[email protected]>2020-04-23 12:41:34 +0300
committerMarge Bot <[email protected]>2020-04-27 09:30:06 +0000
commiteeab9c93db84e5759145891e8fdde66a5cdcf917 (patch)
tree40c0858b2b76b2f148c6c44d205d068c568eaeac /src/mesa
parentb785ad5853b1f75b2fd0280530e77cb63e71e8e8 (diff)
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: d684fb37bfbc47d098158cb03c0672119a4469fe Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2815 Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Jose Maria Casanova Crespo <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4705>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 1f5a3cd077e..6fe8f851757 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -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));