Mesa (main): etnaviv: assert if etna_shader_io_file reg overrun

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 24 09:54:36 UTC 2022


Module: Mesa
Branch: main
Commit: 0a19ae1e98c2f842e5b9f01d13421cdfb6294b1c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a19ae1e98c2f842e5b9f01d13421cdfb6294b1c

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Tue May 24 14:35:19 2022 +1000

etnaviv: assert if etna_shader_io_file reg overrun

This code depends on optimisations eliminating all but a single write
to outputs. assert if we are about to overrun the array i.e an
output was possibly written to twice.

See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6536

Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16683>

---

 src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
index bd6ef14ba40..7f50fbeae4f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
@@ -123,6 +123,7 @@ etna_emit_output(struct etna_compile *c, nir_variable *var, struct etna_inst_src
       c->variant->vs_pointsize_out_reg = src.reg;
       break;
    default:
+      assert(sf->num_reg < ETNA_NUM_INPUTS);
       sf->reg[sf->num_reg].reg = src.reg;
       sf->reg[sf->num_reg].slot = var->data.location;
       sf->reg[sf->num_reg].num_components = glsl_get_components(var->type);



More information about the mesa-commit mailing list