Mesa (main): glsl/nir: convert ir_texture->clamp to nir

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 1 10:57:36 UTC 2022


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

Author: Qiang Yu <yuq825 at gmail.com>
Date:   Thu Jan  6 17:31:01 2022 +0800

glsl/nir: convert ir_texture->clamp to nir

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Signed-off-by: Qiang Yu <yuq825 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

---

 src/compiler/glsl/glsl_to_nir.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index e91f9b73208..c011db2171b 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -2473,6 +2473,8 @@ nir_visitor::visit(ir_texture *ir)
    /* offsets are constants we store inside nir_tex_intrs.offsets */
    if (ir->offset != NULL && !ir->offset->type->is_array())
       num_srcs++;
+   if (ir->clamp != NULL)
+      num_srcs++;
 
    /* Add one for the texture deref */
    num_srcs += 2;
@@ -2556,6 +2558,13 @@ nir_visitor::visit(ir_texture *ir)
       }
    }
 
+   if (ir->clamp) {
+      instr->src[src_number].src =
+         nir_src_for_ssa(evaluate_rvalue(ir->clamp));
+      instr->src[src_number].src_type = nir_tex_src_min_lod;
+      src_number++;
+   }
+
    switch (ir->op) {
    case ir_txb:
       instr->src[src_number].src =



More information about the mesa-commit mailing list