From: Ian Romanick Date: Thu, 8 Apr 2010 00:13:44 +0000 (-0700) Subject: Treat texture rectangles as an extension that is enabled be default X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c824653952a67722c242616bb34a4796b42f660;p=mesa.git Treat texture rectangles as an extension that is enabled be default --- diff --git a/builtin_types.sh b/builtin_types.sh index 609073c9e4d..4e6f0878ce5 100755 --- a/builtin_types.sh +++ b/builtin_types.sh @@ -167,8 +167,6 @@ done gen_sampler_type "3D" "GLSL_SAMPLER_DIM_3D" 0 0 "GLSL_TYPE_FLOAT" gen_sampler_type "Cube" "GLSL_SAMPLER_DIM_CUBE" 0 0 "GLSL_TYPE_FLOAT" -gen_sampler_type "2DRect" "GLSL_SAMPLER_DIM_RECT" 0 0 "GLSL_TYPE_FLOAT" -gen_sampler_type "2DRect" "GLSL_SAMPLER_DIM_RECT" 1 0 "GLSL_TYPE_FLOAT" gen_footer @@ -328,6 +326,16 @@ echo '' echo 'const glsl_type *const glsl_type::uint_type = & builtin_130_types['$uint_index'];' echo '/*@}*/' +echo +echo '/** \name Sampler types added by GL_ARB_texture_rectangle' +echo ' */' +echo '/*@{*/' +gen_header "ARB_texture_rectangle" +gen_sampler_type "2DRect" "GLSL_SAMPLER_DIM_RECT" 0 0 "GLSL_TYPE_FLOAT" +gen_sampler_type "2DRect" "GLSL_SAMPLER_DIM_RECT" 1 0 "GLSL_TYPE_FLOAT" +gen_footer +echo '/*@}*/' + echo echo '/** \name Sampler types added by GL_EXT_texture_buffer_object' echo ' */' diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index 553cd675a7a..fd44e966024 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -135,6 +135,9 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, state->ARB_draw_buffers_enable = (ext_mode != extension_disable); state->ARB_draw_buffers_warn = (ext_mode == extension_warn); } + } if (strcmp(name, "GL_ARB_texture_rectangle") == 0) { + state->ARB_texture_rectangle_enable = (ext_mode != extension_disable); + state->ARB_texture_rectangle_warn = (ext_mode == extension_warn); } else { unsupported = true; } @@ -736,6 +739,7 @@ main(int argc, char **argv) state.error = false; state.temp_index = 0; state.loop_or_switch_nesting = NULL; + state.ARB_texture_rectangle_enable = true; _mesa_glsl_lexer_ctor(& state, shader, shader_len); _mesa_glsl_parse(& state); diff --git a/glsl_parser_extras.h b/glsl_parser_extras.h index 51e4eb89ccf..a79dc75d482 100644 --- a/glsl_parser_extras.h +++ b/glsl_parser_extras.h @@ -66,6 +66,8 @@ struct _mesa_glsl_parse_state { /*@{*/ unsigned ARB_draw_buffers_enable:1; unsigned ARB_draw_buffers_warn:1; + unsigned ARB_texture_rectangle_enable:1; + unsigned ARB_texture_rectangle_warn:1; /*@}*/ }; diff --git a/glsl_types.cpp b/glsl_types.cpp index ba4f0297d81..24b3e3f59f9 100644 --- a/glsl_types.cpp +++ b/glsl_types.cpp @@ -35,11 +35,11 @@ hash_table *glsl_type::array_types = NULL; static void add_types_to_symbol_table(glsl_symbol_table *symtab, const struct glsl_type *types, - unsigned num_types) + unsigned num_types, bool warn) { - unsigned i; + (void) warn; - for (i = 0; i < num_types; i++) { + for (unsigned i = 0; i < num_types; i++) { symtab->add_type(types[i].name, & types[i]); } } @@ -49,12 +49,15 @@ static void generate_110_types(glsl_symbol_table *symtab) { add_types_to_symbol_table(symtab, builtin_core_types, - Elements(builtin_core_types)); + Elements(builtin_core_types), + false); add_types_to_symbol_table(symtab, builtin_structure_types, - Elements(builtin_structure_types)); + Elements(builtin_structure_types), + false); add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types, - Elements(builtin_110_deprecated_structure_types)); - add_types_to_symbol_table(symtab, & void_type, 1); + Elements(builtin_110_deprecated_structure_types), + false); + add_types_to_symbol_table(symtab, & void_type, 1, false); } @@ -64,7 +67,7 @@ generate_120_types(glsl_symbol_table *symtab) generate_110_types(symtab); add_types_to_symbol_table(symtab, builtin_120_types, - Elements(builtin_120_types)); + Elements(builtin_120_types), false); } @@ -74,7 +77,16 @@ generate_130_types(glsl_symbol_table *symtab) generate_120_types(symtab); add_types_to_symbol_table(symtab, builtin_130_types, - Elements(builtin_130_types)); + Elements(builtin_130_types), false); +} + + +static void +generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, bool warn) +{ + add_types_to_symbol_table(symtab, builtin_ARB_texture_rectangle_types, + Elements(builtin_ARB_texture_rectangle_types), + warn); } @@ -95,6 +107,11 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) /* error */ break; } + + if (state->ARB_texture_rectangle_enable) { + generate_ARB_texture_rectangle_types(state->symbols, + state->ARB_texture_rectangle_warn); + } }