[Mesa-dev] [PATCH 7/9] glsl: Add support for integer sampler2DRect variants in GLSL 1.40.

Kenneth Graunke kenneth at whitecape.org
Wed Mar 14 15:09:48 PDT 2012


On 03/12/2012 06:08 PM, Eric Anholt wrote:
> ---
>   src/glsl/builtin_types.h |   12 ++++++++++++
>   src/glsl/glsl_types.cpp  |   15 +++++++++++++--
>   src/glsl/glsl_types.h    |    2 ++
>   3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h
> index cc99b1b..890c121 100644
> --- a/src/glsl/builtin_types.h
> +++ b/src/glsl/builtin_types.h
> @@ -259,6 +259,18 @@ const glsl_type *const glsl_type::uvec3_type =&  builtin_130_types[2];
>   const glsl_type *const glsl_type::uvec4_type =&  builtin_130_types[3];
>   /*@}*/
>
> +
> +/** \name Types added in GLSL 1.30
> + */
> +/*@{*/
> +const glsl_type glsl_type::builtin_140_types[] = {
> +   glsl_type(GL_INT_SAMPLER_2D_RECT,
> +	     GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT, "isampler2DRect"),
> +   glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_RECT,
> +	     GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT, "usampler2DRect"),
> +};
> +/*@}*/
> +
>   /** \name Sampler types added by GL_ARB_texture_rectangle
>    */
>   /*@{*/
> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
> index a327197..4baec41 100644
> --- a/src/glsl/glsl_types.cpp
> +++ b/src/glsl/glsl_types.cpp
> @@ -205,6 +205,16 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab)
>
>
>   void
> +glsl_type::generate_140_types(glsl_symbol_table *symtab)
> +{
> +   generate_130_types(symtab);

We need to drop builtin_110_deprecated_structure_types here.
We can always do that as a subsequent patch though.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> +   add_types_to_symbol_table(symtab, builtin_140_types,
> +			     Elements(builtin_140_types), false);
> +}
> +
> +
> +void
>   glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
>   						bool warn)
>   {
> @@ -258,14 +268,15 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
>         glsl_type::generate_130_types(state->symbols);
>         break;
>      case 140:
> -      glsl_type::generate_130_types(state->symbols);
> +      glsl_type::generate_140_types(state->symbols);
>         break;
>      default:
>         /* error */
>         break;
>      }
>
> -   if (state->ARB_texture_rectangle_enable) {
> +   if (state->ARB_texture_rectangle_enable ||
> +       state->language_version>= 140) {
>         glsl_type::generate_ARB_texture_rectangle_types(state->symbols,
>   					   state->ARB_texture_rectangle_warn);
>      }
> diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
> index 2997c93..8f2a3ff 100644
> --- a/src/glsl/glsl_types.h
> +++ b/src/glsl/glsl_types.h
> @@ -498,6 +498,7 @@ private:
>      static const glsl_type builtin_110_types[];
>      static const glsl_type builtin_120_types[];
>      static const glsl_type builtin_130_types[];
> +   static const glsl_type builtin_140_types[];
>      static const glsl_type builtin_ARB_texture_rectangle_types[];
>      static const glsl_type builtin_EXT_texture_array_types[];
>      static const glsl_type builtin_EXT_texture_buffer_object_types[];
> @@ -517,6 +518,7 @@ private:
>      static void generate_110_types(glsl_symbol_table *);
>      static void generate_120_types(glsl_symbol_table *);
>      static void generate_130_types(glsl_symbol_table *);
> +   static void generate_140_types(glsl_symbol_table *);
>      static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
>      static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
>      static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);



More information about the mesa-dev mailing list