Mesa (master): nir/lower_tex: Add an assert() in nir_lower_txs_lod()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 20 16:16:34 UTC 2019


Module: Mesa
Branch: master
Commit: 56434450f634d54dd0e4bf3d243dbf931932ff93
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=56434450f634d54dd0e4bf3d243dbf931932ff93

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Wed Jun 19 15:05:34 2019 +0200

nir/lower_tex: Add an assert() in nir_lower_txs_lod()

We don't expect the output of a TXS instruction to be wider than a
vec3. Add an assert() to make sure this never happens.

Suggested-by: Jason Ekstrand <jason at jlekstrand.net>
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/compiler/nir/nir_lower_tex.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 8a36edfbc5e..05b46b90252 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -1011,6 +1011,7 @@ nir_lower_txs_lod(nir_builder *b, nir_tex_instr *tex)
    if (tex->is_array) {
       nir_ssa_def *comp[3];
 
+      assert(dest_size <= ARRAY_SIZE(comp));
       for (unsigned i = 0; i < dest_size - 1; i++)
          comp[i] = nir_channel(b, minified, i);
 




More information about the mesa-commit mailing list