glsl: add ARB_sparse_texture_clamp builtin functions
authorQiang Yu <yuq825@gmail.com>
Thu, 6 Jan 2022 09:24:00 +0000 (17:24 +0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 1 Feb 2022 10:28:05 +0000 (10:28 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>

src/compiler/glsl/builtin_functions.cpp

index 8b6447d..d41516a 100644 (file)
@@ -949,6 +949,30 @@ shader_image_load_store_and_sparse(const _mesa_glsl_parse_state *state)
       state->ARB_sparse_texture2_enable;
 }
 
+static bool
+v130_desktop_and_clamp(const _mesa_glsl_parse_state *state)
+{
+   return v130_desktop(state) && state->ARB_sparse_texture_clamp_enable;
+}
+
+static bool
+texture_cube_map_array_and_clamp(const _mesa_glsl_parse_state *state)
+{
+   return texture_cube_map_array(state) && state->ARB_sparse_texture_clamp_enable;
+}
+
+static bool
+v130_derivatives_only_and_clamp(const _mesa_glsl_parse_state *state)
+{
+   return v130_derivatives_only(state) && state->ARB_sparse_texture_clamp_enable;
+}
+
+static bool
+derivatives_texture_cube_map_array_and_clamp(const _mesa_glsl_parse_state *state)
+{
+   return derivatives_texture_cube_map_array(state) && state->ARB_sparse_texture_clamp_enable;
+}
+
 /** @} */
 
 /******************************************************************************/
@@ -4379,6 +4403,322 @@ builtin_builder::create_builtins()
 
    add_function("sparseTexelsResidentARB", _is_sparse_texels_resident(), NULL);
 
+   add_function("sparseTextureClampARB",
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCube_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type,   glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, texture_cube_map_array_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCubeArray_type,  glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, texture_cube_map_array_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, texture_cube_map_array_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+
+                _textureCubeArrayShadow(ir_tex, texture_cube_map_array_and_clamp, glsl_type::samplerCubeArrayShadow_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCube_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type,   glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, derivatives_texture_cube_map_array_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCubeArray_type,  glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, derivatives_texture_cube_map_array_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, derivatives_texture_cube_map_array_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                NULL);
+
+   add_function("textureClampARB",
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1D_type, glsl_type::float_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCube_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DShadow_type,   glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type,   glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1DArray_type,  glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1DArray_type, glsl_type::vec2_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_tex, texture_cube_map_array_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCubeArray_type,  glsl_type::vec4_type, TEX_CLAMP),
+                _texture(ir_tex, texture_cube_map_array_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_CLAMP),
+                _texture(ir_tex, texture_cube_map_array_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _textureCubeArrayShadow(ir_tex, texture_cube_map_array_and_clamp, glsl_type::samplerCubeArrayShadow_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1D_type, glsl_type::float_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCube_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::sampler1DShadow_type,   glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type,   glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1DArray_type,  glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1DArray_type, glsl_type::vec2_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_txb, derivatives_texture_cube_map_array_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCubeArray_type,  glsl_type::vec4_type, TEX_CLAMP),
+                _texture(ir_txb, derivatives_texture_cube_map_array_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_CLAMP),
+                _texture(ir_txb, derivatives_texture_cube_map_array_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _texture(ir_txb, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_CLAMP),
+                NULL);
+
+   add_function("sparseTextureOffsetClampARB",
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                NULL);
+
+   add_function("textureOffsetClampARB",
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1D_type, glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1DArray_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1DArray_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_tex, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1D_type, glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::sampler1DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txb, v130_derivatives_only_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txb, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                NULL);
+
+   add_function("sparseTextureGradClampARB",
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCube_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type,   glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, texture_cube_map_array_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCubeArray_type,  glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, texture_cube_map_array_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, texture_cube_map_array_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_SPARSE|TEX_CLAMP),
+                NULL);
+
+   add_function("textureGradClampARB",
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1D_type, glsl_type::float_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCube_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DShadow_type,   glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type,   glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::samplerCubeShadow_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1DArray_type,  glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1DArray_type, glsl_type::vec2_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_CLAMP),
+
+                _texture(ir_txd, texture_cube_map_array_and_clamp, glsl_type::vec4_type,  glsl_type::samplerCubeArray_type,  glsl_type::vec4_type, TEX_CLAMP),
+                _texture(ir_txd, texture_cube_map_array_and_clamp, glsl_type::ivec4_type, glsl_type::isamplerCubeArray_type, glsl_type::vec4_type, TEX_CLAMP),
+                _texture(ir_txd, texture_cube_map_array_and_clamp, glsl_type::uvec4_type, glsl_type::usamplerCubeArray_type, glsl_type::vec4_type, TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_CLAMP),
+                NULL);
+
+   add_function("sparseTextureGradOffsetClampARB",
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_OFFSET|TEX_SPARSE|TEX_CLAMP),
+                NULL);
+
+   add_function("textureGradOffsetClampARB",
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1D_type,  glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1D_type, glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1D_type, glsl_type::float_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2D_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler3D_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler3D_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler1DArray_type,  glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler1DArray_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler1DArray_type, glsl_type::vec2_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::vec4_type,  glsl_type::sampler2DArray_type,  glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler1DArrayShadow_type, glsl_type::vec3_type, TEX_OFFSET|TEX_CLAMP),
+                _texture(ir_txd, v130_desktop_and_clamp, glsl_type::float_type, glsl_type::sampler2DArrayShadow_type, glsl_type::vec4_type, TEX_OFFSET|TEX_CLAMP),
+                NULL);
+
    F(dFdx)
    F(dFdy)
    F(fwidth)