Mesa (master): pan/bi: Fix varying writemask handling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 25 13:26:48 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Fri Nov 13 17:09:27 2020 -0500

pan/bi: Fix varying writemask handling

Allows shaders/supertuxkart/1.shader_test and
shaders/unity/24-Tree.shader_test to compile.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>

---

 src/panfrost/bifrost/bifrost_compile.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index ef04cc03d7b..7cbba974043 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -424,8 +424,14 @@ bi_emit_st_vary(bi_context *ctx, nir_intrinsic_instr *instr)
         address.dest_type = nir_type_uint32;
         address.vector_channels = 3;
 
-        unsigned nr = nir_intrinsic_src_components(instr, 0);
-        assert(nir_intrinsic_write_mask(instr) == ((1 << nr) - 1));
+        /* Only look at the total components needed. In effect, we fill in all
+         * the intermediate "holes" in the write mask, since we can't mask off
+         * stores. Since nir_lower_io_to_temporaries ensures each varying is
+         * written at most once, anything that's masked out is undefined, so it
+         * doesn't matter what we write there. So we may as well do the
+         * simplest thing possible. */
+        unsigned nr = util_last_bit(nir_intrinsic_write_mask(instr));
+        assert(nr > 0 && nr <= nir_intrinsic_src_components(instr, 0));
 
         bi_instruction st = {
                 .type = BI_STORE_VAR,



More information about the mesa-commit mailing list