nir/validate: Assert txf(_ms) matches dimension
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 27 Jun 2023 18:01:58 +0000 (14:01 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Jun 2023 14:17:30 +0000 (14:17 +0000)
We can't txf_ms on non-MS images and we can't txf on MS images. This would have
caught a regression on Asahi.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23892>

src/compiler/nir/nir_validate.c

index 1776bad..3ac014d 100644 (file)
@@ -930,6 +930,14 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state)
       }
    }
 
+   bool msaa = (instr->sampler_dim == GLSL_SAMPLER_DIM_MS ||
+                instr->sampler_dim == GLSL_SAMPLER_DIM_SUBPASS_MS);
+
+   if (msaa)
+      validate_assert(state, instr->op != nir_texop_txf);
+   else
+      validate_assert(state, instr->op != nir_texop_txf_ms);
+
    if (instr->op != nir_texop_tg4)
       validate_assert(state, instr->component == 0);