freedreno/ir3: Don't lower s2en if samp/tex is too large
authorRob Clark <robdclark@chromium.org>
Wed, 13 Oct 2021 21:14:29 +0000 (14:14 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 15 Oct 2021 15:52:33 +0000 (15:52 +0000)
We only have four bits to encode an immediate samp/tex.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13353>

src/freedreno/ir3/ir3_cp.c

index e6c7d52..551e50d 100644 (file)
@@ -621,7 +621,8 @@ instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr)
       struct ir3_register *samp = samp_tex->srcs[0];
       struct ir3_register *tex = samp_tex->srcs[1];
 
-      if ((samp->flags & IR3_REG_IMMED) && (tex->flags & IR3_REG_IMMED)) {
+      if ((samp->flags & IR3_REG_IMMED) && (tex->flags & IR3_REG_IMMED) &&
+          (samp->iim_val < 16) && (tex->iim_val < 16)) {
          instr->flags &= ~IR3_INSTR_S2EN;
          instr->cat5.samp = samp->iim_val;
          instr->cat5.tex = tex->iim_val;