Mesa (staging/22.0): nir: intel/compiler: Lower TXD on array surfaces on DG2+

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 17:52:04 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 59384b4415d5f04ab23b93d2f6385ab36924f2bc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=59384b4415d5f04ab23b93d2f6385ab36924f2bc

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Mar 30 16:36:06 2022 -0700

nir: intel/compiler: Lower TXD on array surfaces on DG2+

DG2 can only do sample_d and sample_d_c on 1D and 2D surfaces.  Cube
maps and 3D surfaces were already handled, but 1D array and 2D array
surfaces were not.

Fixes the following Vulkan CTS failures on DG2:

    dEQP-VK.glsl.texture_functions.texturegradclamp.isampler1darray_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.isampler2darray_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.sampler1darray_fixed_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.sampler1darray_float_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.sampler2darray_fixed_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.sampler2darray_float_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.usampler1darray_fragment
    dEQP-VK.glsl.texture_functions.texturegradclamp.usampler2darray_fragment

The Fixes: tag below is a bit misleading. This commit adds another
lowering, similar to the one in the Fixes: commit, that probably should
have been added at the same time.  I just want to make sure this commit
gets applied everywhere that commit was also applied.

Fixes: 635ed58e527 ("intel/compiler: Lower txd for 3D samplers on XeHP.")
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15681>
(cherry picked from commit 7fd1955412e252957486e0430b2e5a6e7c755364)

---

 .pick_status.json                | 2 +-
 src/compiler/nir/nir.h           | 5 +++++
 src/compiler/nir/nir_lower_tex.c | 3 ++-
 src/intel/compiler/brw_nir.c     | 3 ++-
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index f73233733ea..e8f042e0692 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -6460,7 +6460,7 @@
         "description": "nir: intel/compiler: Lower TXD on array surfaces on DG2+",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": "635ed58e527f1a1c0b11eca0552e892f56f8ccf6"
     },
     {
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 272e1d175da..4ea0be0b666 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -4839,6 +4839,11 @@ typedef struct nir_lower_tex_options {
     */
    bool lower_txd_3d;
 
+   /**
+    * If true, lower nir_texop_txd any array surfaces with nir_texop_txl.
+    */
+   bool lower_txd_array;
+
    /**
     * If true, lower nir_texop_txd on shadow samplers (except cube maps)
     * with nir_texop_txl. Notice that cube map shadow samplers are lowered
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 2664925568f..60e49984bab 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -1449,7 +1449,8 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
            (options->lower_txd_cube_map &&
             tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE) ||
            (options->lower_txd_3d &&
-            tex->sampler_dim == GLSL_SAMPLER_DIM_3D))) {
+            tex->sampler_dim == GLSL_SAMPLER_DIM_3D) ||
+           (options->lower_txd_array && tex->is_array))) {
          lower_gradient(b, tex);
          progress = true;
          continue;
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 9998edfc735..377bb5c3e3d 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -814,7 +814,8 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir,
       .lower_txf_offset = true,
       .lower_rect_offset = true,
       .lower_txd_cube_map = true,
-      .lower_txd_3d = devinfo->verx10 >= 125,
+      .lower_txd_3d = devinfo->verx10 >= 125,    /* Wa_1209978020 */
+      .lower_txd_array = devinfo->verx10 >= 125, /* Wa_1209978020 */
       .lower_txb_shadow_clamp = true,
       .lower_txd_shadow_clamp = true,
       .lower_txd_offset_clamp = true,



More information about the mesa-commit mailing list