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

Author: Paulo Zanoni <[email protected]>
Date:   Thu Jul 25 11:49:09 2019 -0700

glsl: Add builtin functions for EXT_texture_shadow_lod

With the help of Sagar, Ian and Ivan.

v2: Fix dependencies (Ian Romanick)

v3: 1) fix function name (Marek Olsak)
    2) Add check for extension enable (Marek Olsak)

Signed-off-by: Paulo Zanoni <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>

---

 src/compiler/glsl/builtin_functions.cpp | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/compiler/glsl/builtin_functions.cpp 
b/src/compiler/glsl/builtin_functions.cpp
index 53265269fd1..ff5d9a72da2 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -365,6 +365,13 @@ v130_or_gpu_shader4(const _mesa_glsl_parse_state *state)
 }
 
 static bool
+v130_or_gpu_shader4_and_tex_shadow_lod(const _mesa_glsl_parse_state *state)
+{
+   return v130_or_gpu_shader4(state) &&
+          state->EXT_texture_shadow_lod_enable;
+}
+
+static bool
 gpu_shader5(const _mesa_glsl_parse_state *state)
 {
    return state->is_version(400, 0) || state->ARB_gpu_shader5_enable;
@@ -492,6 +499,14 @@ texture_cube_map_array(const _mesa_glsl_parse_state *state)
 }
 
 static bool
+v130_or_gpu_shader4_and_tex_cube_map_array(const _mesa_glsl_parse_state *state)
+{
+   return texture_cube_map_array(state) &&
+          v130_or_gpu_shader4(state) &&
+          state->EXT_texture_shadow_lod_enable;
+}
+
+static bool
 texture_query_levels(const _mesa_glsl_parse_state *state)
 {
    return state->is_version(430, 0) ||
@@ -2211,6 +2226,11 @@ builtin_builder::create_builtins()
                 _texture(ir_txb, derivatives_texture_cube_map_array, 
glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type),
 
                 _texture(ir_txb, v130_derivatives_only, glsl_type::float_type, 
glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type),
+                _texture(ir_tex, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, 
glsl_type::vec4_type),
+                _texture(ir_txb, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, 
glsl_type::vec4_type),
+
+                _textureCubeArrayShadow(ir_tex, 
v130_or_gpu_shader4_and_tex_cube_map_array, 
glsl_type::samplerCubeArrayShadow_type),
+                _textureCubeArrayShadow(ir_txb, 
v130_or_gpu_shader4_and_tex_cube_map_array, 
glsl_type::samplerCubeArrayShadow_type),
                 NULL);
 
    add_function("textureLod",
@@ -2246,6 +2266,9 @@ builtin_builder::create_builtins()
                 _texture(ir_txl, texture_cube_map_array, 
glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type),
 
                 _texture(ir_txl, v130, glsl_type::float_type, 
glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type),
+                _texture(ir_txl, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, 
glsl_type::vec4_type),
+                _texture(ir_txl, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type),
+                _textureCubeArrayShadow(ir_txl, 
v130_or_gpu_shader4_and_tex_cube_map_array, 
glsl_type::samplerCubeArrayShadow_type),
                 NULL);
 
    add_function("textureOffset",
@@ -2311,6 +2334,8 @@ builtin_builder::create_builtins()
                 _texture(ir_txb, v130_derivatives_only, glsl_type::uvec4_type, 
glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET),
 
                 _texture(ir_txb, v130_derivatives_only, glsl_type::float_type, 
glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET),
+                _texture(ir_tex, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, 
glsl_type::vec4_type, TEX_OFFSET),
+                _texture(ir_txb, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, 
glsl_type::vec4_type, TEX_OFFSET),
                 NULL);
 
    add_function("texture1DOffset",
@@ -2729,6 +2754,7 @@ builtin_builder::create_builtins()
                 _texture(ir_txl, v130, glsl_type::uvec4_type, 
glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET),
 
                 _texture(ir_txl, v130, glsl_type::float_type, 
glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET),
+                _texture(ir_txl, v130_or_gpu_shader4_and_tex_shadow_lod, 
glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, 
glsl_type::vec4_type, TEX_OFFSET),
                 NULL);
 
    add_function("texture1DLodOffset",

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to