nir/lower_tex: add txp lowering option for arrays
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 22 Mar 2022 14:56:43 +0000 (10:56 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 23 Mar 2022 23:18:47 +0000 (23:18 +0000)
this is illegal in vulkan, so zink needs to be able to lower these

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15510>

src/compiler/nir/nir.h
src/compiler/nir/nir_lower_tex.c

index cd1b230..1ac1415 100644 (file)
@@ -4824,6 +4824,11 @@ typedef struct nir_lower_tex_options {
    unsigned lower_txp;
 
    /**
+    * If true, lower texture projector for any array sampler dims
+    */
+   bool lower_txp_array;
+
+   /**
     * If true, lower away nir_tex_src_offset for all texelfetch instructions.
     */
    bool lower_txf_offset;
index 8bf7de8..d6fd026 100644 (file)
@@ -1319,7 +1319,8 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
       /* If we are clamping any coords, we must lower projector first
        * as clamping happens *after* projection:
        */
-      if (lower_txp || sat_mask) {
+      if (lower_txp || sat_mask ||
+          (options->lower_txp_array && tex->is_array)) {
          progress |= project_src(b, tex);
       }