Mesa (master): broadcom/compiler: Handle non-SSA destinations for tex instructions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 5 10:33:57 UTC 2020


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

Author: Arcady Goldmints-Orlov <agoldmints at igalia.com>
Date:   Mon Oct 26 11:57:32 2020 -0400

broadcom/compiler: Handle non-SSA destinations for tex instructions

The NIR that is given to the VIR compiler is not in SSA form, and so
the v3d*_vir_emit_tex() functions must be able to handle both SSA and
register destinations.

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7318>

---

 src/broadcom/compiler/v3d33_tex.c | 5 +++--
 src/broadcom/compiler/v3d40_tex.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/broadcom/compiler/v3d33_tex.c b/src/broadcom/compiler/v3d33_tex.c
index 488021bfc60..1b24fa0db3c 100644
--- a/src/broadcom/compiler/v3d33_tex.c
+++ b/src/broadcom/compiler/v3d33_tex.c
@@ -127,9 +127,10 @@ v3d33_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
         /* Limit the number of channels returned to both how many the NIR
          * instruction writes and how many the instruction could produce.
          */
-        assert(instr->dest.is_ssa);
         p1_unpacked.return_words_of_texture_data =
-                nir_ssa_def_components_read(&instr->dest.ssa);
+                instr->dest.is_ssa ?
+                nir_ssa_def_components_read(&instr->dest.ssa) :
+                (1 << instr->dest.reg.reg->num_components) - 1;
 
         uint32_t p0_packed;
         V3D33_TEXTURE_UNIFORM_PARAMETER_0_CFG_MODE1_pack(NULL,
diff --git a/src/broadcom/compiler/v3d40_tex.c b/src/broadcom/compiler/v3d40_tex.c
index 931ce759727..7e39f8b5498 100644
--- a/src/broadcom/compiler/v3d40_tex.c
+++ b/src/broadcom/compiler/v3d40_tex.c
@@ -175,9 +175,10 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
         /* Limit the number of channels returned to both how many the NIR
          * instruction writes and how many the instruction could produce.
          */
-        assert(instr->dest.is_ssa);
         p0_unpacked.return_words_of_texture_data =
-                nir_ssa_def_components_read(&instr->dest.ssa);
+                instr->dest.is_ssa ?
+                nir_ssa_def_components_read(&instr->dest.ssa) :
+                (1 << instr->dest.reg.reg->num_components) - 1;
 
         assert(p0_unpacked.return_words_of_texture_data != 0);
 



More information about the mesa-commit mailing list