agx: Don't blow up when lowering textures twice
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 11 Aug 2023 23:18:23 +0000 (19:18 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 23 Aug 2023 15:06:54 +0000 (15:06 +0000)
Hard to avoid with GS.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>

src/asahi/compiler/agx_nir_lower_texture.c

index e533e271da47ddaefdc29ad679f6dce274a5abc9..2430e5b8c4f456ccf62109d3a95a6112e39f5c74 100644 (file)
@@ -305,6 +305,10 @@ lower_regular_texture(nir_builder *b, nir_instr *instr, UNUSED void *data)
    if (tex->sampler_dim == GLSL_SAMPLER_DIM_BUF)
       return lower_buffer_texture(b, tex);
 
+   /* Don't lower twice */
+   if (nir_tex_instr_src_index(tex, nir_tex_src_backend1) >= 0)
+      return false;
+
    /* Get the coordinates */
    nir_def *coord = nir_steal_tex_src(tex, nir_tex_src_coord);
    nir_def *ms_idx = nir_steal_tex_src(tex, nir_tex_src_ms_index);