Mesa (master): nir: Add option to lower tex to txl when shader don't support implicit LOD

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 25 19:51:37 UTC 2019


Module: Mesa
Branch: master
Commit: d5ac5d6e836f348799625ce5792d3faee655cf9e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5ac5d6e836f348799625ce5792d3faee655cf9e

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Thu Apr 18 21:01:15 2019 -0700

nir: Add option to lower tex to txl when shader don't support implicit LOD

We already add the LOD src, so go ahead and update the texop as well
when this option is set.

v2: Make it an option. (Rob Clark)

v3: Use a more concise name suggested by Jason.

Reviewed-by: Rob Clark <robdclark at gmail.com>

---

 src/compiler/nir/nir.h           | 6 ++++++
 src/compiler/nir/nir_lower_tex.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 7d2062d3691..e878a63409d 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -3265,6 +3265,12 @@ typedef struct nir_lower_tex_options {
    unsigned lower_srgb;
 
    /**
+    * If true, lower nir_texop_tex on shaders that doesn't support implicit
+    * LODs to nir_texop_txl.
+    */
+   bool lower_tex_without_implicit_lod;
+
+   /**
     * If true, lower nir_texop_txd on cube maps with nir_texop_txl.
     */
    bool lower_txd_cube_map;
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index c5762b860fd..e814e65bf2c 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -1127,6 +1127,8 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
            (tex->op == nir_texop_tex && !shader_supports_implicit_lod))) {
          b->cursor = nir_before_instr(&tex->instr);
          nir_tex_instr_add_src(tex, nir_tex_src_lod, nir_src_for_ssa(nir_imm_int(b, 0)));
+         if (tex->op == nir_texop_tex && options->lower_tex_without_implicit_lod)
+            tex->op = nir_texop_txl;
          progress = true;
          continue;
       }




More information about the mesa-commit mailing list