Mesa (main): glsl: _textureCubeArrayShadow support clamp

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


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

Author: Qiang Yu <yuq825 at gmail.com>
Date:   Thu Jan  6 14:58:45 2022 +0800

glsl: _textureCubeArrayShadow support clamp

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/builtin_functions.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 475abfb60e0..8b6447df345 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -1195,7 +1195,7 @@ private:
    ir_function_signature *_textureCubeArrayShadow(ir_texture_opcode opcode,
                                                   builtin_available_predicate avail,
                                                   const glsl_type *x,
-                                                  bool sparse = false);
+                                                  int flags = 0);
    ir_function_signature *_texelFetch(builtin_available_predicate avail,
                                       const glsl_type *return_type,
                                       const glsl_type *sampler_type,
@@ -4058,7 +4058,7 @@ builtin_builder::create_builtins()
 
                 _texture(ir_tex, v130_desktop_and_sparse, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_SPARSE),
 
-                _textureCubeArrayShadow(ir_tex, texture_cube_map_array_and_sparse, glsl_type::samplerCubeArrayShadow_type, true),
+                _textureCubeArrayShadow(ir_tex, texture_cube_map_array_and_sparse, glsl_type::samplerCubeArrayShadow_type, TEX_SPARSE),
 
                 _texture(ir_tex, v130_desktop_and_sparse, glsl_type::vec4_type,  glsl_type::sampler2DRect_type,  glsl_type::vec2_type, TEX_SPARSE),
                 _texture(ir_tex, v130_desktop_and_sparse, glsl_type::ivec4_type, glsl_type::isampler2DRect_type, glsl_type::vec2_type, TEX_SPARSE),
@@ -7080,12 +7080,14 @@ ir_function_signature *
 builtin_builder::_textureCubeArrayShadow(ir_texture_opcode opcode,
                                          builtin_available_predicate avail,
                                          const glsl_type *sampler_type,
-                                         bool sparse)
+                                         int flags)
 {
    ir_variable *s = in_var(sampler_type, "sampler");
    ir_variable *P = in_var(glsl_type::vec4_type, "P");
    ir_variable *compare = in_var(glsl_type::float_type, "compare");
    const glsl_type *return_type = glsl_type::float_type;
+   bool sparse = flags & TEX_SPARSE;
+   bool clamp = flags & TEX_CLAMP;
    /* Sparse texture return residency info. */
    const glsl_type *type = sparse ? glsl_type::int_type : return_type;
    MAKE_SIG(type, avail, 3, s, P, compare);
@@ -7102,6 +7104,12 @@ builtin_builder::_textureCubeArrayShadow(ir_texture_opcode opcode,
       tex->lod_info.lod = var_ref(lod);
    }
 
+   if (clamp) {
+      ir_variable *lod_clamp = in_var(glsl_type::float_type, "lodClamp");
+      sig->parameters.push_tail(lod_clamp);
+      tex->clamp = var_ref(lod_clamp);
+   }
+
    ir_variable *texel = NULL;
    if (sparse) {
       texel = out_var(return_type, "texel");



More information about the mesa-commit mailing list