[Mesa-dev] [PATCH] glsl: Add support for parsing [iu]samplerBuffer types in GLSL 1.40.

Ian Romanick idr at freedesktop.org
Thu Mar 29 18:20:43 PDT 2012


On 03/29/2012 02:59 PM, Eric Anholt wrote:
> The samplerBuffer type will be undefined in !glsl 1.40, and the
> keyword is marked as reserved.  The [iu]samplerBuffer types are not
> marked as reserved pre-1.40, so they don't have separate tokens and
> fall through to normal type handling.

My recollection of GLSL namespace rules is failing.  If these are only 
caught by the symbol table, will that allow things like

	int isamplerBufer;

> ---
>
> Good catch on my silly addition of tokens that never got lexed.  But
> it turns out we didn't need to add those tokens, since
> [iu]samplerBuffer are defined types in the symbol table, and obviously
> we can find existing types during parsing.
>
>   src/glsl/glsl_parser.yy |    1 +
>   src/glsl/glsl_types.cpp |
> 5 ++++-
>   2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 5ce69b6..dc1ef98 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1405,6 +1405,7 @@ basic_type_specifier_nonarray:
>   	| SAMPLER2DARRAY	{ $$ = (char *)"sampler2DArray"; }
>   	| SAMPLER1DARRAYSHADOW	{ $$ = (char *)"sampler1DArrayShadow"; }
>   	| SAMPLER2DARRAYSHADOW	{ $$ = (char *)"sampler2DArrayShadow"; }
> +	| SAMPLERBUFFER		{ $$ = (char *)"samplerBuffer"; }
>   	| ISAMPLER1D		{ $$ = (char *)"isampler1D"; }
>   	| ISAMPLER2D		{ $$ = (char *)"isampler2D"; }
>   	| ISAMPLER3D		{ $$ = (char *)"isampler3D"; }
> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
> index 069ebd1..8a34b8e 100644
> --- a/src/glsl/glsl_types.cpp
> +++ b/src/glsl/glsl_types.cpp
> @@ -146,7 +146,6 @@ glsl_type::sampler_index() const
>      case GLSL_SAMPLER_DIM_RECT:
>         return TEXTURE_RECT_INDEX;
>      case GLSL_SAMPLER_DIM_BUF:
> -      assert(!"FINISHME: Implement ARB_texture_buffer_object");
>         return TEXTURE_BUFFER_INDEX;
>      case GLSL_SAMPLER_DIM_EXTERNAL:
>         return TEXTURE_EXTERNAL_INDEX;
> @@ -213,6 +212,10 @@ glsl_type::generate_140_types(glsl_symbol_table *symtab)
>
>      add_types_to_symbol_table(symtab, builtin_140_types,
>   			     Elements(builtin_140_types), false);
> +
> +   add_types_to_symbol_table(symtab, builtin_EXT_texture_buffer_object_types,
> +			     Elements(builtin_EXT_texture_buffer_object_types),
> +			     false);
>   }
>
>



More information about the mesa-dev mailing list