From 0d80f71867e561c541bf8832a182401297972543 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 8 Jun 2010 16:17:17 -0700 Subject: [PATCH] Add EXT_texture_array support. --- builtin_types.h | 12 ++++++++++++ glsl_parser_extras.h | 2 ++ glsl_types.cpp | 15 +++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/builtin_types.h b/builtin_types.h index 41ce5d2..48202f5 100644 --- a/builtin_types.h +++ b/builtin_types.h @@ -244,6 +244,18 @@ static const struct glsl_type builtin_ARB_texture_rectangle_types[] = { }; /*@}*/ +/** \name Sampler types added by GL_EXT_texture_array + */ +/*@{*/ + +static const struct glsl_type builtin_EXT_texture_array_types[] = { + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), + glsl_type( GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), + glsl_type( GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), +}; +/*@}*/ + /** \name Sampler types added by GL_EXT_texture_buffer_object */ /*@{*/ diff --git a/glsl_parser_extras.h b/glsl_parser_extras.h index 157b986..e1585d2 100644 --- a/glsl_parser_extras.h +++ b/glsl_parser_extras.h @@ -74,6 +74,8 @@ struct _mesa_glsl_parse_state { unsigned ARB_draw_buffers_warn:1; unsigned ARB_texture_rectangle_enable:1; unsigned ARB_texture_rectangle_warn:1; + unsigned EXT_texture_array_enable:1; + unsigned EXT_texture_array_warn:1; /*@}*/ }; diff --git a/glsl_types.cpp b/glsl_types.cpp index e1beeef..9487819 100644 --- a/glsl_types.cpp +++ b/glsl_types.cpp @@ -90,6 +90,15 @@ generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, bool warn) } +static void +generate_EXT_texture_array_types(glsl_symbol_table *symtab, bool warn) +{ + add_types_to_symbol_table(symtab, builtin_EXT_texture_array_types, + Elements(builtin_EXT_texture_array_types), + warn); +} + + void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) { @@ -112,6 +121,12 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) generate_ARB_texture_rectangle_types(state->symbols, state->ARB_texture_rectangle_warn); } + + if (state->EXT_texture_array_enable && state->language_version < 130) { + // These are already included in 130; don't create twice. + generate_EXT_texture_array_types(state->symbols, + state->EXT_texture_array_warn); + } } -- 2.7.4