[Mesa-dev] [PATCH 2/6] glsl: add plumbing for GL_ARB_texture_query_levels
Kenneth Graunke
kenneth at whitecape.org
Sat Oct 5 11:32:24 PDT 2013
On 10/04/2013 09:17 PM, Chris Forbes wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
> src/glsl/builtin_functions.cpp | 56 +++++++++++++++++++++++++++++++++++++
> src/glsl/glcpp/glcpp-parse.y | 3 ++
> src/glsl/glsl_parser_extras.cpp | 1 +
> src/glsl/glsl_parser_extras.h | 2 ++
> src/glsl/ir.cpp | 4 +--
> src/glsl/ir.h | 4 ++-
> src/glsl/ir_clone.cpp | 1 +
> src/glsl/ir_hv_accept.cpp | 1 +
> src/glsl/ir_print_visitor.cpp | 7 +++--
> src/glsl/ir_reader.cpp | 8 +++++-
> src/glsl/ir_rvalue_visitor.cpp | 1 +
> src/glsl/opt_tree_grafting.cpp | 1 +
> src/glsl/standalone_scaffolding.cpp | 1 +
> src/mesa/program/ir_to_mesa.cpp | 3 ++
> 14 files changed, 87 insertions(+), 6 deletions(-)
>
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index df735ef..40084f7 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -256,6 +256,13 @@ texture_cube_map_array(const _mesa_glsl_parse_state *state)
> }
>
> static bool
> +texture_query_levels(const _mesa_glsl_parse_state *state)
> +{
> + return state->is_version(430, 0) ||
> + state->ARB_texture_query_levels_enable;
> +}
> +
> +static bool
> texture_query_lod(const _mesa_glsl_parse_state *state)
> {
> return state->target == fragment_shader &&
> @@ -504,6 +511,7 @@ private:
> B0(EndPrimitive)
>
> B2(textureQueryLod);
> + B1(textureQueryLevels);
> B1(dFdx);
> B1(dFdy);
> B1(fwidth);
> @@ -1603,6 +1611,39 @@ builtin_builder::create_builtins()
> _textureQueryLod(glsl_type::samplerCubeArrayShadow_type, glsl_type::vec3_type),
> NULL);
>
> + add_function("textureQueryLevels",
> + _textureQueryLevels(glsl_type::sampler1D_type),
> + _textureQueryLevels(glsl_type::sampler2D_type),
> + _textureQueryLevels(glsl_type::sampler3D_type),
> + _textureQueryLevels(glsl_type::samplerCube_type),
> + _textureQueryLevels(glsl_type::sampler1DArray_type),
> + _textureQueryLevels(glsl_type::sampler2DArray_type),
> + _textureQueryLevels(glsl_type::samplerCubeArray_type),
> + _textureQueryLevels(glsl_type::sampler1DShadow_type),
> + _textureQueryLevels(glsl_type::sampler2DShadow_type),
> + _textureQueryLevels(glsl_type::samplerCubeShadow_type),
> + _textureQueryLevels(glsl_type::sampler1DArrayShadow_type),
> + _textureQueryLevels(glsl_type::sampler2DArrayShadow_type),
> + _textureQueryLevels(glsl_type::samplerCubeArrayShadow_type),
I noticed that ARB_texture_query_levels, GLSL 4.30, and GLSL 4.40 all
say "gsampler...Shadow". Which is weird, since there are no
integer/unsigned shadow sampling types.
FWIW, I've filed a spec bug (#11001). The resolution is obvious, and
you've done the right thing.
> +
> + _textureQueryLevels(glsl_type::isampler1D_type),
> + _textureQueryLevels(glsl_type::isampler2D_type),
> + _textureQueryLevels(glsl_type::isampler3D_type),
> + _textureQueryLevels(glsl_type::isamplerCube_type),
> + _textureQueryLevels(glsl_type::isampler1DArray_type),
> + _textureQueryLevels(glsl_type::isampler2DArray_type),
> + _textureQueryLevels(glsl_type::isamplerCubeArray_type),
> +
> + _textureQueryLevels(glsl_type::usampler1D_type),
> + _textureQueryLevels(glsl_type::usampler2D_type),
> + _textureQueryLevels(glsl_type::usampler3D_type),
> + _textureQueryLevels(glsl_type::usamplerCube_type),
> + _textureQueryLevels(glsl_type::usampler1DArray_type),
> + _textureQueryLevels(glsl_type::usampler2DArray_type),
> + _textureQueryLevels(glsl_type::usamplerCubeArray_type),
> +
> + NULL);
This looks good.
Patches 1-3 are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list