Mesa (main): nir/lower_tex: avoid adding invalid LOD to RECT textures

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 22:09:12 UTC 2022


Module: Mesa
Branch: main
Commit: 6cfcf891c1d5baa1e5e073b875831884ed049b5a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cfcf891c1d5baa1e5e073b875831884ed049b5a

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Apr  7 14:49:07 2022 -0400

nir/lower_tex: avoid adding invalid LOD to RECT textures

this is illegal

Fixes: 74ec2b12be1 ("nir/lower_tex: Rework invalid implicit LOD lowering")

Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15804>

---

 src/compiler/nir/nir_lower_tex.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 7a42bb339e7..511171da60d 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -1477,8 +1477,10 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
       /* Only fragment and compute (in some cases) support implicit
        * derivatives.  Lower those opcodes which use implicit derivatives to
        * use an explicit LOD of 0.
+       * But don't touch RECT samplers because they don't have mips.
        */
       if (nir_tex_instr_has_implicit_derivative(tex) &&
+          tex->sampler_dim != GLSL_SAMPLER_DIM_RECT &&
           !nir_shader_supports_implicit_lod(b->shader)) {
          lower_zero_lod(b, tex);
          progress = true;



More information about the mesa-commit mailing list