diff options
author | Christian König <[email protected]> | 2011-02-24 22:02:42 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2011-02-24 22:02:42 +0100 |
commit | b922a0ce12916a91cfc3e56714913fcf63279ff2 (patch) | |
tree | e24fa039925220882d155ccb987f7914e83f4372 /src/glsl | |
parent | f013b4f8f1329982727691a55cc263e3011d02bf (diff) | |
parent | c0ad70ae31ee5501281b434d56e389fc92b13a3a (diff) |
Merge remote branch 'origin/master' into pipe-video
Conflicts:
configure.ac
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/SConscript
src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_asm.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600_state_inlines.h
src/gallium/drivers/r600/r600_texture.c
Diffstat (limited to 'src/glsl')
76 files changed, 4725 insertions, 2906 deletions
diff --git a/src/glsl/Makefile b/src/glsl/Makefile index c9525446633..876f0dfc2a5 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -1,3 +1,4 @@ + #src/glsl/pp/Makefile TOP = ../.. @@ -13,10 +14,12 @@ LIBGLCPP_SOURCES = \ GLCPP_SOURCES = \ $(LIBGLCPP_SOURCES) \ + ralloc.c \ glcpp/glcpp.c C_SOURCES = \ strtod.c \ + ralloc.c \ $(LIBGLCPP_SOURCES) CXX_SOURCES = \ @@ -68,6 +71,7 @@ CXX_SOURCES = \ opt_constant_propagation.cpp \ opt_constant_variable.cpp \ opt_copy_propagation.cpp \ + opt_copy_propagation_elements.cpp \ opt_dead_code.cpp \ opt_dead_code_local.cpp \ opt_dead_functions.cpp \ @@ -82,8 +86,7 @@ CXX_SOURCES = \ s_expression.cpp LIBS = \ - $(TOP)/src/glsl/libglsl.a \ - $(TALLOC_LIBS) + $(TOP)/src/glsl/libglsl.a APPS = glsl_compiler glcpp/glcpp @@ -111,8 +114,10 @@ OBJECTS = \ $(C_SOURCES:.c=.o) \ $(CXX_SOURCES:.cpp=.o) +DRICORE_OBJ_DIR = obj-visible +OBJECTS_DRICORE = $(addprefix $(DRICORE_OBJ_DIR)/,$(OBJECTS)) + INCLUDES = \ - $(TALLOC_CFLAGS) \ -I. \ -I../mesa \ -I../mapi \ @@ -127,7 +132,13 @@ ALL_SOURCES = \ ##### TARGETS ##### -default: depend lib$(LIBNAME).a $(APPS) +default: depend lib$(LIBNAME).a $(APPS) $(DRICORE_GLSL_LIBS) + +$(TOP)/$(LIB_DIR)/libglsl.so: $(OBJECTS_DRICORE) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template + $(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ + -cplusplus -noprefix \ + -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/[email protected] \ + $(OBJECTS_DRICORE) builtin_function.o lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o @@ -138,22 +149,33 @@ depend: $(ALL_SOURCES) Makefile $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null # Remove .o and backup files -clean: +clean: clean-dricore rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler -rm -f $(APPS) +clean-dricore: + -rm -f $(DRICORE_OBJ_DIR) $(TOP)/$(LIB_DIR)/libglsl.so libglsl.so + +ifneq (,$(DRICORE_GLSL_LIBS)) +DRICORE_INSTALL_TARGET = install-dricore +endif + # Dummy target -install: +install: $(DRICORE_INSTALL_TARGET) @echo -n "" +install-dricore: default + $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + $(INSTALL) -m 755 $(DRICORE_GLSL_LIBS) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) ##### RULES ##### -glsl_compiler: $(GLSL2_OBJECTS) libglsl.a - $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@ +glsl_compiler: $(GLSL2_OBJECTS) libglsl.a builtin_stubs.o + $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) builtin_stubs.o $(LIBS) -o $@ -glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a - $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@ +glcpp: glcpp/glcpp +glcpp/glcpp: $(GLCPP_OBJECTS) + $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) -o $@ .cpp.o: $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@ @@ -161,6 +183,14 @@ glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ +$(DRICORE_OBJ_DIR)/%.o : %.cpp + @mkdir -p $(dir $@) + $(CXX) -c $(INCLUDES) $(DRI_CXXFLAGS) $(DEFINES) $< -o $@ + +$(DRICORE_OBJ_DIR)/%.o : %.c + @mkdir -p $(dir $@) + $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DEFINES) $< -o $@ + glsl_lexer.cpp: glsl_lexer.lpp flex --nounistd -o$@ $< @@ -174,10 +204,10 @@ glcpp/glcpp-parse.c: glcpp/glcpp-parse.y bison -v -o "$@" --defines=glcpp/glcpp-parse.h $< builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o - $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o $(TALLOC_LIBS) -o $@ + $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o -o $@ builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler @echo Regenerating builtin_function.cpp... - $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py $(PWD)/builtin_compiler > builtin_function.cpp + $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp -include depend diff --git a/src/glsl/SConscript b/src/glsl/SConscript index 88a83fdb6fa..7c6b6ae8c4d 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -7,14 +7,12 @@ from sys import executable as python_cmd env = env.Clone() env.Prepend(CPPPATH = [ + '#include', '#src/mapi', '#src/mesa', '#src/glsl', ]) -if env['platform'] == 'windows': - env.Prepend(CPPPATH = ['#src/talloc']) - sources = [ 'glcpp/glcpp-lex.c', 'glcpp/glcpp-parse.c', @@ -66,6 +64,7 @@ sources = [ 'opt_constant_propagation.cpp', 'opt_constant_variable.cpp', 'opt_copy_propagation.cpp', + 'opt_copy_propagation_elements.cpp', 'opt_dead_code.cpp', 'opt_dead_code_local.cpp', 'opt_dead_functions.cpp', @@ -77,22 +76,19 @@ sources = [ 'opt_structure_splitting.cpp', 'opt_swizzle_swizzle.cpp', 'opt_tree_grafting.cpp', + 'ralloc.c', 's_expression.cpp', 'strtod.c', ] -if env['platform'] == common.host_platform: +if env['crosscompile'] and env['platform'] != 'embedded': + Import('builtin_glsl_function') +else: if env['msvc']: env.Prepend(CPPPATH = ['#/src/getopt']) env.PrependUnique(LIBS = [getopt]) - if env['platform'] == 'windows': - env.Prepend(CPPPATH = ['#src/talloc']) - env.Prepend(LIBS = [talloc]) - else: - env.Prepend(LIBS = ['talloc']) - builtin_compiler = env.Program( target = 'builtin_compiler', source = sources + ['main.cpp', 'builtin_stubs.cpp', @@ -109,19 +105,12 @@ if env['platform'] == common.host_platform: env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*')) - if env['msvc']: - # There is no LD_LIBRARY_PATH equivalent on Windows. We need to ensure - # talloc.dll is on the same dir as builtin_function. - talloc_dll_src = talloc.dir.File('talloc.dll') - talloc_dll_dst = builtin_compiler[0].dir.File('talloc.dll') - talloc_dll = env.Command(talloc_dll_dst, talloc_dll_src, Copy(talloc_dll_dst, talloc_dll_src)) - env.Depends('builtin_function.cpp', talloc_dll) - Export('builtin_glsl_function') - if common.cross_compiling: + if env['hostonly']: Return() + sources += builtin_glsl_function glsl = env.ConvenienceLibrary( @@ -141,7 +130,7 @@ if env['platform'] == 'windows': 'user32', ]) -env.Prepend(LIBS = [glsl, talloc]) +env.Prepend(LIBS = [glsl]) env.Program( target = 'glsl2', diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 0e2811ca665..878f48b2070 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -49,23 +49,23 @@ struct YYLTYPE; */ class ast_node { public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { void *node; - node = talloc_zero_size(ctx, size); + node = rzalloc_size(ctx, size); assert(node != NULL); return node; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. */ + * ralloc_free in that case. */ static void operator delete(void *table) { - talloc_free(table); + ralloc_free(table); } /** @@ -350,6 +350,14 @@ struct ast_type_qualifier { * qualifier is used. */ unsigned explicit_location:1; + + /** \name Layout qualifiers for GL_AMD_conservative_depth */ + /** \{ */ + unsigned depth_any:1; + unsigned depth_greater:1; + unsigned depth_less:1; + unsigned depth_unchanged:1; + /** \} */ } /** \brief Set of flags, accessed by name. */ q; @@ -606,25 +614,6 @@ private: }; -class ast_declaration_statement : public ast_node { -public: - ast_declaration_statement(void); - - enum { - ast_function, - ast_declaration, - ast_precision - } mode; - - union { - class ast_function *function; - ast_declarator_list *declarator; - ast_type_specifier *type; - ast_node *node; - } declaration; -}; - - class ast_expression_statement : public ast_node { public: ast_expression_statement(ast_expression *); diff --git a/src/glsl/ast_expr.cpp b/src/glsl/ast_expr.cpp index 4e83decb924..e624d11cf3b 100644 --- a/src/glsl/ast_expr.cpp +++ b/src/glsl/ast_expr.cpp @@ -20,8 +20,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#include <cstdio> -#include <cassert> +#include <assert.h> #include "ast.h" const char * diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 6ecf779c935..e5cb8733952 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -66,7 +66,7 @@ process_parameters(exec_list *instructions, exec_list *actual_parameters, * formal or actual parameter list. Only the type is used. * * \return - * A talloced string representing the prototype of the function. + * A ralloced string representing the prototype of the function. */ char * prototype_string(const glsl_type *return_type, const char *name, @@ -75,19 +75,19 @@ prototype_string(const glsl_type *return_type, const char *name, char *str = NULL; if (return_type != NULL) - str = talloc_asprintf(str, "%s ", return_type->name); + str = ralloc_asprintf(NULL, "%s ", return_type->name); - str = talloc_asprintf_append(str, "%s(", name); + ralloc_asprintf_append(&str, "%s(", name); const char *comma = ""; foreach_list(node, parameters) { const ir_instruction *const param = (ir_instruction *) node; - str = talloc_asprintf_append(str, "%s%s", comma, param->type->name); + ralloc_asprintf_append(&str, "%s%s", comma, param->type->name); comma = ", "; } - str = talloc_strdup_append(str, ")"); + ralloc_strcat(&str, ")"); return str; } @@ -132,6 +132,9 @@ match_function_by_name(exec_list *instructions, const char *name, /* Verify that 'out' and 'inout' actual parameters are lvalues. This * isn't done in ir_function::matching_signature because that function * cannot generate the necessary diagnostics. + * + * Also, validate that 'const_in' formal parameters (an extension of our + * IR) correspond to ir_constant actual parameters. */ exec_list_iterator actual_iter = actual_parameters->iterator(); exec_list_iterator formal_iter = sig->parameters.iterator(); @@ -143,14 +146,35 @@ match_function_by_name(exec_list *instructions, const char *name, assert(actual != NULL); assert(formal != NULL); + if (formal->mode == ir_var_const_in && !actual->as_constant()) { + _mesa_glsl_error(loc, state, + "parameter `%s' must be a constant expression", + formal->name); + } + if ((formal->mode == ir_var_out) || (formal->mode == ir_var_inout)) { - if (! actual->is_lvalue()) { - /* FINISHME: Log a better diagnostic here. There is no way - * FINISHME: to tell the user which parameter is invalid. - */ - _mesa_glsl_error(loc, state, "`%s' parameter is not lvalue", - (formal->mode == ir_var_out) ? "out" : "inout"); + const char *mode = NULL; + switch (formal->mode) { + case ir_var_out: mode = "out"; break; + case ir_var_inout: mode = "inout"; break; + default: assert(false); break; + } + /* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always + * FIXME: 0:0(0). + */ + if (actual->variable_referenced() + && actual->variable_referenced()->read_only) { + _mesa_glsl_error(loc, state, + "function parameter '%s %s' references the " + "read-only variable '%s'", + mode, formal->name, + actual->variable_referenced()->name); + + } else if (!actual->is_lvalue()) { + _mesa_glsl_error(loc, state, + "function parameter '%s %s' is not an lvalue", + mode, formal->name); } } @@ -173,7 +197,7 @@ match_function_by_name(exec_list *instructions, const char *name, ir_dereference_variable *deref; var = new(ctx) ir_variable(sig->return_type, - talloc_asprintf(ctx, "%s_retval", + ralloc_asprintf(ctx, "%s_retval", sig->function_name()), ir_var_temporary); instructions->push_tail(var); @@ -195,11 +219,11 @@ match_function_by_name(exec_list *instructions, const char *name, _mesa_glsl_error(loc, state, "no matching function for call to `%s'", str); - talloc_free(str); + ralloc_free(str); const char *prefix = "candidates are: "; - for (int i = -1; i < state->num_builtins_to_link; i++) { + for (int i = -1; i < (int) state->num_builtins_to_link; i++) { glsl_symbol_table *syms = i >= 0 ? state->builtins_to_link[i]->symbols : state->symbols; f = syms->get_function(name); @@ -211,7 +235,7 @@ match_function_by_name(exec_list *instructions, const char *name, str = prototype_string(sig->return_type, f->name, &sig->parameters); _mesa_glsl_error(loc, state, "%s%s\n", prefix, str); - talloc_free(str); + ralloc_free(str); prefix = " "; } @@ -232,7 +256,7 @@ match_function_by_name(exec_list *instructions, const char *name, static ir_rvalue * convert_component(ir_rvalue *src, const glsl_type *desired_type) { - void *ctx = talloc_parent(src); + void *ctx = ralloc_parent(src); const unsigned a = desired_type->base_type; const unsigned b = src->type->base_type; ir_expression *result = NULL; @@ -295,7 +319,7 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type) static ir_rvalue * dereference_component(ir_rvalue *src, unsigned component) { - void *ctx = talloc_parent(src); + void *ctx = ralloc_parent(src); assert(component < src->type->components()); /* If the source is a constant, just create a new constant instead of a @@ -993,6 +1017,16 @@ ast_function_expression::hir(exec_list *instructions, const glsl_type *const constructor_type = type->glsl_type(& name, state); + /* constructor_type can be NULL if a variable with the same name as the + * structure has come into scope. + */ + if (constructor_type == NULL) { + _mesa_glsl_error(& loc, state, "unknown type `%s' (structure name " + "may be shadowed by a variable with the same name)", + type->type_name); + return ir_call::get_error_instruction(ctx); + } + /* Constructors for samplers are illegal. */ @@ -1022,6 +1056,57 @@ ast_function_expression::hir(exec_list *instructions, * correct order. These constructors follow essentially the same type * matching rules as functions. */ + if (constructor_type->is_record()) { + exec_list actual_parameters; + + process_parameters(instructions, &actual_parameters, + &this->expressions, state); + + exec_node *node = actual_parameters.head; + for (unsigned i = 0; i < constructor_type->length; i++) { + ir_rvalue *ir = (ir_rvalue *) node; + + if (node->is_tail_sentinel()) { + _mesa_glsl_error(&loc, state, + "insufficient parameters to constructor " + "for `%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + if (apply_implicit_conversion(constructor_type->fields.structure[i].type, + ir, state)) { + node->replace_with(ir); + } else { + _mesa_glsl_error(&loc, state, + "parameter type mismatch in constructor " + "for `%s.%s' (%s vs %s)", + constructor_type->name, + constructor_type->fields.structure[i].name, + ir->type->name, + constructor_type->fields.structure[i].type->name); + return ir_call::get_error_instruction(ctx);; + } + + node = node->next; + } + + if (!node->is_tail_sentinel()) { + _mesa_glsl_error(&loc, state, "too many parameters in constructor " + "for `%s'", constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + ir_rvalue *const constant = + constant_record_constructor(constructor_type, &actual_parameters, + state); + + return (constant != NULL) + ? constant + : emit_inline_record_constructor(constructor_type, instructions, + &actual_parameters, state); + } + if (!constructor_type->is_numeric() && !constructor_type->is_boolean()) return ir_call::get_error_instruction(ctx); @@ -1197,54 +1282,6 @@ ast_function_expression::hir(exec_list *instructions, process_parameters(instructions, &actual_parameters, &this->expressions, state); - const glsl_type *const type = - state->symbols->get_type(id->primary_expression.identifier); - - if ((type != NULL) && type->is_record()) { - exec_node *node = actual_parameters.head; - for (unsigned i = 0; i < type->length; i++) { - ir_rvalue *ir = (ir_rvalue *) node; - - if (node->is_tail_sentinel()) { - _mesa_glsl_error(&loc, state, - "insufficient parameters to constructor " - "for `%s'", - type->name); - return ir_call::get_error_instruction(ctx); - } - - if (apply_implicit_conversion(type->fields.structure[i].type, ir, - state)) { - node->replace_with(ir); - } else { - _mesa_glsl_error(&loc, state, - "parameter type mismatch in constructor " - "for `%s.%s' (%s vs %s)", - type->name, - type->fields.structure[i].name, - ir->type->name, - type->fields.structure[i].type->name); - return ir_call::get_error_instruction(ctx);; - } - - node = node->next; - } - - if (!node->is_tail_sentinel()) { - _mesa_glsl_error(&loc, state, "too many parameters in constructor " - "for `%s'", type->name); - return ir_call::get_error_instruction(ctx); - } - - ir_rvalue *const constant = - constant_record_constructor(type, &actual_parameters, state); - - return (constant != NULL) - ? constant - : emit_inline_record_constructor(type, instructions, - &actual_parameters, state); - } - return match_function_by_name(instructions, id->primary_expression.identifier, & loc, &actual_parameters, state); diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 7a171f3a2bb..bef099cca3b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -435,6 +435,13 @@ modulus_result_type(const struct glsl_type *type_a, const struct glsl_type *type_b, struct _mesa_glsl_parse_state *state, YYLTYPE *loc) { + if (state->language_version < 130) { + _mesa_glsl_error(loc, state, + "operator '%%' is reserved in %s", + state->version_string); + return glsl_type::error_type; + } + /* From GLSL 1.50 spec, page 56: * "The operator modulus (%) operates on signed or unsigned integers or * integer vectors. The operand types must both be signed or both be @@ -639,7 +646,14 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, bool error_emitted = (lhs->type->is_error() || rhs->type->is_error()); if (!error_emitted) { - if (!lhs->is_lvalue()) { + if (lhs->variable_referenced() != NULL + && lhs->variable_referenced()->read_only) { + _mesa_glsl_error(&lhs_loc, state, + "assignment to read-only variable '%s'", + lhs->variable_referenced()->name); + error_emitted = true; + + } else if (!lhs->is_lvalue()) { _mesa_glsl_error(& lhs_loc, state, "non-lvalue in assignment"); error_emitted = true; } @@ -712,7 +726,7 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, static ir_rvalue * get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) { - void *ctx = talloc_parent(lvalue); + void *ctx = ralloc_parent(lvalue); ir_variable *var; var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp", @@ -1809,7 +1823,6 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, } } - /* FINISHME: Mark 'in' variables at global scope as read-only. */ if (qual->flags.q.constant || qual->flags.q.attribute || qual->flags.q.uniform || (qual->flags.q.varying && (state->target == fragment_shader))) @@ -2003,6 +2016,40 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, } } + /* Layout qualifiers for gl_FragDepth, which are enabled by extension + * AMD_conservative_depth. + */ + int depth_layout_count = qual->flags.q.depth_any + + qual->flags.q.depth_greater + + qual->flags.q.depth_less + + qual->flags.q.depth_unchanged; + if (depth_layout_count > 0 + && !state->AMD_conservative_depth_enable) { + _mesa_glsl_error(loc, state, + "extension GL_AMD_conservative_depth must be enabled " + "to use depth layout qualifiers"); + } else if (depth_layout_count > 0 + && strcmp(var->name, "gl_FragDepth") != 0) { + _mesa_glsl_error(loc, state, + "depth layout qualifiers can be applied only to " + "gl_FragDepth"); + } else if (depth_layout_count > 1 + && strcmp(var->name, "gl_FragDepth") == 0) { + _mesa_glsl_error(loc, state, + "at most one depth layout qualifier can be applied to " + "gl_FragDepth"); + } + if (qual->flags.q.depth_any) + var->depth_layout = ir_depth_layout_any; + else if (qual->flags.q.depth_greater) + var->depth_layout = ir_depth_layout_greater; + else if (qual->flags.q.depth_less) + var->depth_layout = ir_depth_layout_less; + else if (qual->flags.q.depth_unchanged) + var->depth_layout = ir_depth_layout_unchanged; + else + var->depth_layout = ir_depth_layout_none; + if (var->type->is_array() && state->language_version != 110) { var->array_lvalue = true; } @@ -2206,6 +2253,8 @@ ast_declarator_list::hir(exec_list *instructions, mode, var->name, extra); } } else if (var->mode == ir_var_in) { + var->read_only = true; + if (state->target == vertex_shader) { bool error_emitted = false; @@ -2591,6 +2640,36 @@ ast_declarator_list::hir(exec_list *instructions, && earlier->type == var->type && earlier->mode == var->mode) { earlier->interpolation = var->interpolation; + + /* Layout qualifiers for gl_FragDepth. */ + } else if (state->AMD_conservative_depth_enable + && strcmp(var->name, "gl_FragDepth") == 0 + && earlier->type == var->type + && earlier->mode == var->mode) { + + /** From the AMD_conservative_depth spec: + * Within any shader, the first redeclarations of gl_FragDepth + * must appear before any use of gl_FragDepth. + */ + if (earlier->used) { + _mesa_glsl_error(&loc, state, + "the first redeclaration of gl_FragDepth " + "must appear before any use of gl_FragDepth"); + } + + /* Prevent inconsistent redeclaration of depth layout qualifier. */ + if (earlier->depth_layout != ir_depth_layout_none + && earlier->depth_layout != var->depth_layout) { + _mesa_glsl_error(&loc, state, + "gl_FragDepth: depth layout is declared here " + "as '%s, but it was previously declared as " + "'%s'", + depth_layout_string(var->depth_layout), + depth_layout_string(earlier->depth_layout)); + } + + earlier->depth_layout = var->depth_layout; + } else { YYLTYPE loc = this->get_location(); _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier); @@ -3002,27 +3081,26 @@ ast_jump_statement::hir(exec_list *instructions, assert(state->current_function); if (opt_return_value) { - if (state->current_function->return_type->base_type == - GLSL_TYPE_VOID) { - YYLTYPE loc = this->get_location(); - - _mesa_glsl_error(& loc, state, - "`return` with a value, in function `%s' " - "returning void", - state->current_function->function_name()); - } - ir_rvalue *const ret = opt_return_value->hir(instructions, state); - assert(ret != NULL); + + /* The value of the return type can be NULL if the shader says + * 'return foo();' and foo() is a function that returns void. + * + * NOTE: The GLSL spec doesn't say that this is an error. The type + * of the return value is void. If the return type of the function is + * also void, then this should compile without error. Seriously. + */ + const glsl_type *const ret_type = + (ret == NULL) ? glsl_type::void_type : ret->type; /* Implicit conversions are not allowed for return values. */ - if (state->current_function->return_type != ret->type) { + if (state->current_function->return_type != ret_type) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "`return' with wrong type %s, in function `%s' " "returning %s", - ret->type->name, + ret_type->name, state->current_function->function_name(), state->current_function->return_type->name); } @@ -3321,7 +3399,7 @@ ast_struct_specifier::hir(exec_list *instructions, * the types to HIR. This ensures that structure definitions embedded in * other structure definitions are processed. */ - glsl_struct_field *const fields = talloc_array(state, glsl_struct_field, + glsl_struct_field *const fields = ralloc_array(state, glsl_struct_field, decl_count); unsigned i = 0; diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index d14077473f0..c680ae5f671 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -21,7 +21,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include <cstdio> #include "ast.h" extern "C" { #include "program/symbol_table.h" diff --git a/src/glsl/builtins/profiles/130.frag b/src/glsl/builtins/profiles/130.frag index 329116f2a28..43653a906f8 100644 --- a/src/glsl/builtins/profiles/130.frag +++ b/src/glsl/builtins/profiles/130.frag @@ -635,7 +635,6 @@ uvec4 textureLod(usampler2DArray sampler, vec3 P, float lod); float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod); -#if 0 /* textureOffset - no bias */ vec4 textureOffset( sampler1D sampler, float P, int offset); ivec4 textureOffset(isampler1D sampler, float P, int offset); @@ -687,7 +686,6 @@ ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias); uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias); float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias); -#endif /* texelFetch */ vec4 texelFetch( sampler1D sampler, int P, int lod); @@ -710,7 +708,6 @@ uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); -#if 0 /* texelFetchOffset */ vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); @@ -801,7 +798,6 @@ ivec4 textureLodOffset(isampler2DArray samp, vec3 P, float lod, ivec2 offset); uvec4 textureLodOffset(usampler2DArray samp, vec3 P, float lod, ivec2 offset); float textureLodOffset(sampler1DArrayShadow s, vec3 P, float lod, int offset); -#endif /* textureProjLod */ vec4 textureProjLod( sampler1D sampler, vec2 P, float lod); @@ -825,7 +821,6 @@ uvec4 textureProjLod(usampler3D sampler, vec4 P, float lod); float textureProjLod(sampler1DShadow sampler, vec4 P, float lod); float textureProjLod(sampler2DShadow sampler, vec4 P, float lod); -#if 0 /* textureProjLodOffset */ vec4 textureProjLodOffset( sampler1D sampler, vec2 P, float lod, int offset); ivec4 textureProjLodOffset(isampler1D sampler, vec2 P, float lod, int offset); @@ -847,7 +842,6 @@ uvec4 textureProjLodOffset(usampler3D sampler, vec4 P, float lod, ivec3 offset); float textureProjLodOffset(sampler1DShadow s, vec4 P, float lod, int offset); float textureProjLodOffset(sampler2DShadow s, vec4 P, float lod, ivec2 offset); -#endif /* textureGrad */ vec4 textureGrad( sampler1D sampler, float P, float dPdx, float dPdy); @@ -881,7 +875,6 @@ uvec4 textureGrad(usampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy); float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); -#if 0 /* textureGradOffset */ vec4 textureGradOffset( sampler1D s, float P, float dx, float dy, int off); ivec4 textureGradOffset(isampler1D s, float P, float dx, float dy, int offset); @@ -912,7 +905,6 @@ uvec4 textureGradOffset(usampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); float textureGradOffset(sampler1DArrayShadow s, vec3 P, float dx, float dy, int o); float textureGradOffset(sampler2DArrayShadow s, vec4 P, vec2 dx, vec2 dy, ivec2 o); -#endif /* textureProjGrad */ vec4 textureProjGrad( sampler1D sampler, vec2 P, float dPdx, float dPdy); @@ -936,7 +928,6 @@ uvec4 textureProjGrad(usampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy); float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); -#if 0 /* textureProjGradOffset */ vec4 textureProjGradOffset( sampler1D s, vec2 P, float dx, float dy, int off); ivec4 textureProjGradOffset(isampler1D s, vec2 P, float dx, float dy, int off); @@ -958,7 +949,6 @@ uvec4 textureProjGradOffset(usampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); float textureProjGradOffset(sampler1DShadow s, vec4 P, float dx, float dy, int o); float textureProjGradOffset(sampler2DShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o); -#endif /* * The following texture functions are deprecated: diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert index 1c212ebb3c5..742dec6e6d5 100644 --- a/src/glsl/builtins/profiles/130.vert +++ b/src/glsl/builtins/profiles/130.vert @@ -637,7 +637,6 @@ uvec4 textureLod(usampler2DArray sampler, vec3 P, float lod); float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod); -#if 0 /* textureOffset - no bias */ vec4 textureOffset( sampler1D sampler, float P, int offset); ivec4 textureOffset(isampler1D sampler, float P, int offset); @@ -689,7 +688,6 @@ ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias); uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias); float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias); -#endif /* texelFetch */ vec4 texelFetch( sampler1D sampler, int P, int lod); @@ -712,7 +710,6 @@ uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); -#if 0 /* texelFetchOffset */ vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); @@ -803,7 +800,6 @@ ivec4 textureLodOffset(isampler2DArray samp, vec3 P, float lod, ivec2 offset); uvec4 textureLodOffset(usampler2DArray samp, vec3 P, float lod, ivec2 offset); float textureLodOffset(sampler1DArrayShadow s, vec3 P, float lod, int offset); -#endif /* textureProjLod */ vec4 textureProjLod( sampler1D sampler, vec2 P, float lod); @@ -827,7 +823,6 @@ uvec4 textureProjLod(usampler3D sampler, vec4 P, float lod); float textureProjLod(sampler1DShadow sampler, vec4 P, float lod); float textureProjLod(sampler2DShadow sampler, vec4 P, float lod); -#if 0 /* textureProjLodOffset */ vec4 textureProjLodOffset( sampler1D sampler, vec2 P, float lod, int offset); ivec4 textureProjLodOffset(isampler1D sampler, vec2 P, float lod, int offset); @@ -849,7 +844,6 @@ uvec4 textureProjLodOffset(usampler3D sampler, vec4 P, float lod, ivec3 offset); float textureProjLodOffset(sampler1DShadow s, vec4 P, float lod, int offset); float textureProjLodOffset(sampler2DShadow s, vec4 P, float lod, ivec2 offset); -#endif /* textureGrad */ vec4 textureGrad( sampler1D sampler, float P, float dPdx, float dPdy); @@ -883,7 +877,6 @@ uvec4 textureGrad(usampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy); float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); -#if 0 /* textureGradOffset */ vec4 textureGradOffset( sampler1D s, float P, float dx, float dy, int off); ivec4 textureGradOffset(isampler1D s, float P, float dx, float dy, int offset); @@ -914,7 +907,6 @@ uvec4 textureGradOffset(usampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); float textureGradOffset(sampler1DArrayShadow s, vec3 P, float dx, float dy, int o); float textureGradOffset(sampler2DArrayShadow s, vec4 P, vec2 dx, vec2 dy, ivec2 o); -#endif /* textureProjGrad */ vec4 textureProjGrad( sampler1D sampler, vec2 P, float dPdx, float dPdy); @@ -938,7 +930,6 @@ uvec4 textureProjGrad(usampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy); float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); -#if 0 /* textureProjGradOffset */ vec4 textureProjGradOffset( sampler1D s, vec2 P, float dx, float dy, int off); ivec4 textureProjGradOffset(isampler1D s, vec2 P, float dx, float dy, int off); @@ -960,7 +951,6 @@ uvec4 textureProjGradOffset(usampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); float textureProjGradOffset(sampler1DShadow s, vec4 P, float dx, float dy, int o); float textureProjGradOffset(sampler2DShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o); -#endif /* * The following texture functions are deprecated: diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 3a938a022da..edd3c70e00b 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -152,6 +152,8 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne { struct gl_context fakeCtx; fakeCtx.API = API_OPENGL; + fakeCtx.Const.GLSLVersion = 130; + fakeCtx.Extensions.ARB_ES2_compatibility = true; gl_shader *sh = _mesa_new_shader(NULL, 0, target); struct _mesa_glsl_parse_state *st = new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh); @@ -178,7 +180,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne if (st->error) { printf("error reading builtin: %.35s ...\\n", functions[i]); printf("Info log:\\n%s\\n", st->info_log); - talloc_free(sh); + ralloc_free(sh); return NULL; } } @@ -203,7 +205,7 @@ void *builtin_mem_ctx = NULL; void _mesa_glsl_release_functions(void) { - talloc_free(builtin_mem_ctx); + ralloc_free(builtin_mem_ctx); builtin_mem_ctx = NULL; memset(builtin_profiles, 0, sizeof(builtin_profiles)); } @@ -219,7 +221,7 @@ _mesa_read_profile(struct _mesa_glsl_parse_state *state, if (sh == NULL) { sh = read_builtins(GL_VERTEX_SHADER, prototypes, functions, count); - talloc_steal(builtin_mem_ctx, sh); + ralloc_steal(builtin_mem_ctx, sh); builtin_profiles[profile_index] = sh; } @@ -231,7 +233,7 @@ void _mesa_glsl_initialize_functions(struct _mesa_glsl_parse_state *state) { if (builtin_mem_ctx == NULL) { - builtin_mem_ctx = talloc_init("GLSL built-in functions"); + builtin_mem_ctx = ralloc_context(NULL); // "GLSL built-in functions" memset(&builtin_profiles, 0, sizeof(builtin_profiles)); } diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index 8bf708b5aac..8017e943b1b 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -3,6 +3,10 @@ import sys import StringIO +# Bitfield constants for the 'variant' argument to generate_sigs +Proj = 1 +Offset = 2 + def vec_type(g, size): if size == 1: if g == "i": @@ -12,16 +16,20 @@ def vec_type(g, size): return "float" return g + "vec" + str(size) -# Get the base dimension - i.e. sampler3D gives 3 -# Array samplers also get +1 here since the layer is really an extra coordinate -def get_coord_dim(sampler_type): +# Get the sampler dimension - i.e. sampler3D gives 3 +def get_sampler_dim(sampler_type): if sampler_type[0].isdigit(): - coord_dim = int(sampler_type[0]) + sampler_dim = int(sampler_type[0]) elif sampler_type.startswith("Cube"): - coord_dim = 3 + sampler_dim = 3 else: assert False ("coord_dim: invalid sampler_type: " + sampler_type) + return sampler_dim +# Get the coordinate dimension for a given sampler type. +# Array samplers also get +1 here since the layer is really an extra coordinate +def get_coord_dim(sampler_type): + coord_dim = get_sampler_dim(sampler_type) if sampler_type.find("Array") != -1: coord_dim += 1 return coord_dim @@ -35,18 +43,17 @@ def get_extra_dim(sampler_type, use_proj, unused_fields): extra_dim += 1 return extra_dim -def generate_sigs(g, tex_inst, sampler_type, use_proj = False, unused_fields = 0): +def generate_sigs(g, tex_inst, sampler_type, variant = 0, unused_fields = 0): coord_dim = get_coord_dim(sampler_type) - extra_dim = get_extra_dim(sampler_type, use_proj, unused_fields) + extra_dim = get_extra_dim(sampler_type, variant & Proj, unused_fields) + offset_dim = get_sampler_dim(sampler_type) # Print parameters print " (signature " + g + "vec4" print " (parameters" print " (declare (in) " + g + "sampler" + sampler_type + " sampler)" print " (declare (in) " + vec_type("i" if tex_inst == "txf" else "", coord_dim + extra_dim) + " P)", - if tex_inst == "txb": - print "\n (declare (in) float bias)", - elif tex_inst == "txl": + if tex_inst == "txl": print "\n (declare (in) float lod)", elif tex_inst == "txf": print "\n (declare (in) int lod)", @@ -55,6 +62,11 @@ def generate_sigs(g, tex_inst, sampler_type, use_proj = False, unused_fields = 0 print "\n (declare (in) " + grad_type + " dPdx)", print "\n (declare (in) " + grad_type + " dPdy)", + if variant & Offset: + print "\n (declare (const_in) " + vec_type("i", offset_dim) + " offset)", + if tex_inst == "txb": + print "\n (declare (in) float bias)", + print ")\n ((return (" + tex_inst + " (var_ref sampler)", # Coordinate @@ -63,12 +75,14 @@ def generate_sigs(g, tex_inst, sampler_type, use_proj = False, unused_fields = 0 else: print "(var_ref P)", - # Offset - print "(0 0 0)", + if variant & Offset: + print "(var_ref offset)", + else: + print "0", if tex_inst != "txf": # Projective divisor - if use_proj: + if variant & Proj: print "(swiz " + "xyzw"[coord_dim + extra_dim-1] + " (var_ref P))", else: print "1", @@ -90,10 +104,10 @@ def generate_sigs(g, tex_inst, sampler_type, use_proj = False, unused_fields = 0 print "((var_ref dPdx) (var_ref dPdy))", print "))))\n" -def generate_fiu_sigs(tex_inst, sampler_type, use_proj = False, unused_fields = 0): - generate_sigs("", tex_inst, sampler_type, use_proj, unused_fields) - generate_sigs("i", tex_inst, sampler_type, use_proj, unused_fields) - generate_sigs("u", tex_inst, sampler_type, use_proj, unused_fields) +def generate_fiu_sigs(tex_inst, sampler_type, variant = 0, unused_fields = 0): + generate_sigs("", tex_inst, sampler_type, variant, unused_fields) + generate_sigs("i", tex_inst, sampler_type, variant, unused_fields) + generate_sigs("u", tex_inst, sampler_type, variant, unused_fields) def start_function(name): sys.stdout = StringIO.StringIO() @@ -127,17 +141,17 @@ def generate_texture_functions(fs): end_function(fs, "texture") start_function("textureProj") - generate_fiu_sigs("tex", "1D", True) - generate_fiu_sigs("tex", "1D", True, 2) - generate_fiu_sigs("tex", "2D", True) - generate_fiu_sigs("tex", "2D", True, 1) - generate_fiu_sigs("tex", "3D", True) - - generate_fiu_sigs("txb", "1D", True) - generate_fiu_sigs("txb", "1D", True, 2) - generate_fiu_sigs("txb", "2D", True) - generate_fiu_sigs("txb", "2D", True, 1) - generate_fiu_sigs("txb", "3D", True) + generate_fiu_sigs("tex", "1D", Proj) + generate_fiu_sigs("tex", "1D", Proj, 2) + generate_fiu_sigs("tex", "2D", Proj) + generate_fiu_sigs("tex", "2D", Proj, 1) + generate_fiu_sigs("tex", "3D", Proj) + + generate_fiu_sigs("txb", "1D", Proj) + generate_fiu_sigs("txb", "1D", Proj, 2) + generate_fiu_sigs("txb", "2D", Proj) + generate_fiu_sigs("txb", "2D", Proj, 1) + generate_fiu_sigs("txb", "3D", Proj) end_function(fs, "textureProj") start_function("textureLod") @@ -149,6 +163,28 @@ def generate_texture_functions(fs): generate_fiu_sigs("txl", "2DArray") end_function(fs, "textureLod") + start_function("textureLodOffset") + generate_fiu_sigs("txl", "1D", Offset) + generate_fiu_sigs("txl", "2D", Offset) + generate_fiu_sigs("txl", "3D", Offset) + generate_fiu_sigs("txl", "1DArray", Offset) + generate_fiu_sigs("txl", "2DArray", Offset) + end_function(fs, "textureLodOffset") + + start_function("textureOffset") + generate_fiu_sigs("tex", "1D", Offset) + generate_fiu_sigs("tex", "2D", Offset) + generate_fiu_sigs("tex", "3D", Offset) + generate_fiu_sigs("tex", "1DArray", Offset) + generate_fiu_sigs("tex", "2DArray", Offset) + + generate_fiu_sigs("txb", "1D", Offset) + generate_fiu_sigs("txb", "2D", Offset) + generate_fiu_sigs("txb", "3D", Offset) + generate_fiu_sigs("txb", "1DArray", Offset) + generate_fiu_sigs("txb", "2DArray", Offset) + end_function(fs, "textureOffset") + start_function("texelFetch") generate_fiu_sigs("txf", "1D") generate_fiu_sigs("txf", "2D") @@ -157,14 +193,44 @@ def generate_texture_functions(fs): generate_fiu_sigs("txf", "2DArray") end_function(fs, "texelFetch") + start_function("texelFetchOffset") + generate_fiu_sigs("txf", "1D", Offset) + generate_fiu_sigs("txf", "2D", Offset) + generate_fiu_sigs("txf", "3D", Offset) + generate_fiu_sigs("txf", "1DArray", Offset) + generate_fiu_sigs("txf", "2DArray", Offset) + end_function(fs, "texelFetchOffset") + + start_function("textureProjOffset") + generate_fiu_sigs("tex", "1D", Proj | Offset) + generate_fiu_sigs("tex", "1D", Proj | Offset, 2) + generate_fiu_sigs("tex", "2D", Proj | Offset) + generate_fiu_sigs("tex", "2D", Proj | Offset, 1) + generate_fiu_sigs("tex", "3D", Proj | Offset) + + generate_fiu_sigs("txb", "1D", Proj | Offset) + generate_fiu_sigs("txb", "1D", Proj | Offset, 2) + generate_fiu_sigs("txb", "2D", Proj | Offset) + generate_fiu_sigs("txb", "2D", Proj | Offset, 1) + generate_fiu_sigs("txb", "3D", Proj | Offset) + end_function(fs, "textureProjOffset") + start_function("textureProjLod") - generate_fiu_sigs("txl", "1D", True) - generate_fiu_sigs("txl", "1D", True, 2) - generate_fiu_sigs("txl", "2D", True) - generate_fiu_sigs("txl", "2D", True, 1) - generate_fiu_sigs("txl", "3D", True) + generate_fiu_sigs("txl", "1D", Proj) + generate_fiu_sigs("txl", "1D", Proj, 2) + generate_fiu_sigs("txl", "2D", Proj) + generate_fiu_sigs("txl", "2D", Proj, 1) + generate_fiu_sigs("txl", "3D", Proj) end_function(fs, "textureProjLod") + start_function("textureProjLodOffset") + generate_fiu_sigs("txl", "1D", Proj | Offset) + generate_fiu_sigs("txl", "1D", Proj | Offset, 2) + generate_fiu_sigs("txl", "2D", Proj | Offset) + generate_fiu_sigs("txl", "2D", Proj | Offset, 1) + generate_fiu_sigs("txl", "3D", Proj | Offset) + end_function(fs, "textureProjLodOffset") + start_function("textureGrad") generate_fiu_sigs("txd", "1D") generate_fiu_sigs("txd", "2D") @@ -174,22 +240,40 @@ def generate_texture_functions(fs): generate_fiu_sigs("txd", "2DArray") end_function(fs, "textureGrad") + start_function("textureGradOffset") + generate_fiu_sigs("txd", "1D", Offset) + generate_fiu_sigs("txd", "2D", Offset) + generate_fiu_sigs("txd", "3D", Offset) + generate_fiu_sigs("txd", "Cube", Offset) + generate_fiu_sigs("txd", "1DArray", Offset) + generate_fiu_sigs("txd", "2DArray", Offset) + end_function(fs, "textureGradOffset") + start_function("textureProjGrad") - generate_fiu_sigs("txd", "1D", True) - generate_fiu_sigs("txd", "1D", True, 2) - generate_fiu_sigs("txd", "2D", True) - generate_fiu_sigs("txd", "2D", True, 1) - generate_fiu_sigs("txd", "3D", True) + generate_fiu_sigs("txd", "1D", Proj) + generate_fiu_sigs("txd", "1D", Proj, 2) + generate_fiu_sigs("txd", "2D", Proj) + generate_fiu_sigs("txd", "2D", Proj, 1) + generate_fiu_sigs("txd", "3D", Proj) end_function(fs, "textureProjGrad") + start_function("textureProjGradOffset") + generate_fiu_sigs("txd", "1D", Proj | Offset) + generate_fiu_sigs("txd", "1D", Proj | Offset, 2) + generate_fiu_sigs("txd", "2D", Proj | Offset) + generate_fiu_sigs("txd", "2D", Proj | Offset, 1) + generate_fiu_sigs("txd", "3D", Proj | Offset) + end_function(fs, "textureProjGradOffset") + + # ARB_texture_rectangle extension start_function("texture2DRect") generate_sigs("", "tex", "2DRect") end_function(fs, "texture2DRect") start_function("texture2DRectProj") - generate_sigs("", "tex", "2DRect", True) - generate_sigs("", "tex", "2DRect", True, 1) + generate_sigs("", "tex", "2DRect", Proj) + generate_sigs("", "tex", "2DRect", Proj, 1) end_function(fs, "texture2DRectProj") start_function("shadow2DRect") @@ -197,7 +281,7 @@ def generate_texture_functions(fs): end_function(fs, "shadow2DRect") start_function("shadow2DRectProj") - generate_sigs("", "tex", "2DRectShadow", True) + generate_sigs("", "tex", "2DRectShadow", Proj) end_function(fs, "shadow2DRectProj") # EXT_texture_array extension @@ -243,15 +327,15 @@ def generate_texture_functions(fs): end_function(fs, "texture1DLod") start_function("texture1DProj") - generate_sigs("", "tex", "1D", True) - generate_sigs("", "tex", "1D", True, 2) - generate_sigs("", "txb", "1D", True) - generate_sigs("", "txb", "1D", True, 2) + generate_sigs("", "tex", "1D", Proj) + generate_sigs("", "tex", "1D", Proj, 2) + generate_sigs("", "txb", "1D", Proj) + generate_sigs("", "txb", "1D", Proj, 2) end_function(fs, "texture1DProj") start_function("texture1DProjLod") - generate_sigs("", "txl", "1D", True) - generate_sigs("", "txl", "1D", True, 2) + generate_sigs("", "txl", "1D", Proj) + generate_sigs("", "txl", "1D", Proj, 2) end_function(fs, "texture1DProjLod") start_function("texture2D") @@ -264,15 +348,15 @@ def generate_texture_functions(fs): end_function(fs, "texture2DLod") start_function("texture2DProj") - generate_sigs("", "tex", "2D", True) - generate_sigs("", "tex", "2D", True, 1) - generate_sigs("", "txb", "2D", True) - generate_sigs("", "txb", "2D", True, 1) + generate_sigs("", "tex", "2D", Proj) + generate_sigs("", "tex", "2D", Proj, 1) + generate_sigs("", "txb", "2D", Proj) + generate_sigs("", "txb", "2D", Proj, 1) end_function(fs, "texture2DProj") start_function("texture2DProjLod") - generate_sigs("", "txl", "2D", True) - generate_sigs("", "txl", "2D", True, 1) + generate_sigs("", "txl", "2D", Proj) + generate_sigs("", "txl", "2D", Proj, 1) end_function(fs, "texture2DProjLod") start_function("texture3D") @@ -285,12 +369,12 @@ def generate_texture_functions(fs): end_function(fs, "texture3DLod") start_function("texture3DProj") - generate_sigs("", "tex", "3D", True) - generate_sigs("", "txb", "3D", True) + generate_sigs("", "tex", "3D", Proj) + generate_sigs("", "txb", "3D", Proj) end_function(fs, "texture3DProj") start_function("texture3DProjLod") - generate_sigs("", "txl", "3D", True) + generate_sigs("", "txl", "3D", Proj) end_function(fs, "texture3DProjLod") start_function("textureCube") @@ -312,12 +396,12 @@ def generate_texture_functions(fs): end_function(fs, "shadow1DLod") start_function("shadow1DProj") - generate_sigs("", "tex", "1DShadow", True, 1) - generate_sigs("", "txb", "1DShadow", True, 1) + generate_sigs("", "tex", "1DShadow", Proj, 1) + generate_sigs("", "txb", "1DShadow", Proj, 1) end_function(fs, "shadow1DProj") start_function("shadow1DProjLod") - generate_sigs("", "txl", "1DShadow", True, 1) + generate_sigs("", "txl", "1DShadow", Proj, 1) end_function(fs, "shadow1DProjLod") start_function("shadow2D") @@ -330,12 +414,12 @@ def generate_texture_functions(fs): end_function(fs, "shadow2DLod") start_function("shadow2DProj") - generate_sigs("", "tex", "2DShadow", True) - generate_sigs("", "txb", "2DShadow", True) + generate_sigs("", "tex", "2DShadow", Proj) + generate_sigs("", "txb", "2DShadow", Proj) end_function(fs, "shadow2DProj") start_function("shadow2DProjLod") - generate_sigs("", "txl", "2DShadow", True) + generate_sigs("", "txl", "2DShadow", Proj) end_function(fs, "shadow2DProjLod") sys.stdout = sys.__stdout__ @@ -346,4 +430,4 @@ if __name__ == "__main__": fs = {} generate_texture_functions(fs); for k, v in fs.iteritems(): - print v + print v diff --git a/src/glsl/configure.ac b/src/glsl/configure.ac deleted file mode 100644 index 73ce67de3d1..00000000000 --- a/src/glsl/configure.ac +++ /dev/null @@ -1,69 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.61) -AC_INIT(glsl, XXXXX, [email protected], glsl) -AC_CONFIG_SRCDIR([Makefile.am]) -AM_CONFIG_HEADER([config.h]) -AC_CONFIG_FILES([glcpp/Makefile]) - -AM_INIT_AUTOMAKE -LT_INIT - -AM_MAINTAINER_MODE - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC -AC_PROG_MAKE_SET -AC_PROG_YACC -AC_PROG_LEX - -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -# Checks for libraries. - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. - -# Checks for library functions. -AC_HEADER_STDC - -AH_TOP([#ifndef GLSL_CONFIG_H -#define GLSL_CONFIG_H]) -AH_BOTTOM([#endif /* GLSL_CONFIG_H */]) - -PKG_CHECK_MODULES([talloc], [talloc >= 2.0]) - -AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug], - [use debug compiler flags and macros @<:@default=disabled@:>@])], - [enable_debug="$enableval"], - [enable_debug=no] -) -if test "x$enable_debug" = xyes; then - DEFINES="$DEFINES -DDEBUG" - if test "x$GCC" = xyes; then - # Remove any -g or -O flags from the command line - CFLAGS=[`echo $CFLAGS | sed 's/-g[^ \t]*[ \t]*//g;s/-O[^ \t]*[ \t]*//g'`] - CFLAGS="$CFLAGS -O0 -ggdb3 -fstack-protector -D_FORTIFY_SOURCE=2" - fi - if test "x$GXX" = xyes; then - # Remove any -g flags from the command line - CXXFLAGS=[`echo $CXXFLAGS | sed 's/-g[^ \t]*[ \t]*//g;s/-O[^ \t]*[ \t]*//g'`] - CXXFLAGS="$CXXFLAGS -O0 -ggdb3 -fstack-protector -D_FORTIFY_SOURCE=2" - fi -fi - -if test "x$GXX" = xyes ; then - WARN="-Wall -Wextra -Wunsafe-loop-optimizations -Wstack-protector" -else - WARN="" -fi - -CFLAGS="$CFLAGS $WARN" -CXXFLAGS="$CXXFLAGS $WARN" -YFLAGS="-d -v" - -AC_OUTPUT([Makefile]) diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index 156af3008c0..b53bea6271d 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -795,6 +795,10 @@ int glcpp_get_lineno (yyscan_t yyscanner ); void glcpp_set_lineno (int line_number ,yyscan_t yyscanner ); +int glcpp_get_column (yyscan_t yyscanner ); + +void glcpp_set_column (int column_no ,yyscan_t yyscanner ); + YYSTYPE * glcpp_get_lval (yyscan_t yyscanner ); void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); @@ -954,7 +958,7 @@ YY_DECL /* Single-line comments */ -#line 958 "glcpp/glcpp-lex.c" +#line 962 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1121,7 +1125,7 @@ case 8: YY_RULE_SETUP #line 94 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); yyextra->space_tokens = 0; return HASH_VERSION; } @@ -1132,7 +1136,7 @@ case 9: YY_RULE_SETUP #line 102 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; return OTHER; @@ -1312,7 +1316,7 @@ case 24: YY_RULE_SETUP #line 221 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK @@ -1320,7 +1324,7 @@ case 25: YY_RULE_SETUP #line 226 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK @@ -1328,7 +1332,7 @@ case 26: YY_RULE_SETUP #line 231 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK @@ -1406,7 +1410,7 @@ case 37: YY_RULE_SETUP #line 276 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return IDENTIFIER; } YY_BREAK @@ -1421,7 +1425,7 @@ case 39: YY_RULE_SETUP #line 285 "glcpp/glcpp-lex.l" { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return OTHER; } YY_BREAK @@ -1471,7 +1475,7 @@ YY_RULE_SETUP #line 319 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1475 "glcpp/glcpp-lex.c" +#line 1479 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index e936854cf2c..11b73aea88b 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -92,7 +92,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {HASH}version { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); yyextra->space_tokens = 0; return HASH_VERSION; } @@ -100,7 +100,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* glcpp doesn't handle #extension, #version, or #pragma directives. * Simply pass them through to the main compiler's lexer/parser. */ {HASH}(extension|pragma)[^\n]+ { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; return OTHER; @@ -219,17 +219,17 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {DECIMAL_INTEGER} { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return INTEGER_STRING; } {OCTAL_INTEGER} { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return INTEGER_STRING; } {HEXADECIMAL_INTEGER} { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return INTEGER_STRING; } @@ -274,7 +274,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {IDENTIFIER} { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return IDENTIFIER; } @@ -283,7 +283,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {OTHER}+ { - yylval->str = talloc_strdup (yyextra, yytext); + yylval->str = ralloc_strdup (yyextra, yytext); return OTHER; } diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index a5566dc0aaf..1e71b18c4cb 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -103,10 +102,6 @@ #include "main/core.h" /* for struct gl_extensions */ #include "main/mtypes.h" /* for gl_api enum */ -#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) -#define glcpp_printf(stream, fmt, args, ...) \ - stream = talloc_asprintf_append(stream, fmt, args) - static void yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); @@ -150,7 +145,7 @@ _argument_list_length (argument_list_t *list); static token_list_t * _argument_list_member_at (argument_list_t *list, int index); -/* Note: This function talloc_steal()s the str pointer. */ +/* Note: This function ralloc_steal()s the str pointer. */ static token_t * _token_create_str (void *ctx, int type, char *str); @@ -160,10 +155,7 @@ _token_create_ival (void *ctx, int type, int ival); static token_list_t * _token_list_create (void *ctx); -/* Note: This function adds a talloc_reference() to token. - * - * You may want to talloc_unlink any current reference if you no - * longer need it. */ +/* Note: This function calls ralloc_steal on token. */ static void _token_list_append (token_list_t *list, token_t *token); @@ -220,7 +212,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 224 "glcpp/glcpp-parse.c" +#line 216 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -308,7 +300,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 312 "glcpp/glcpp-parse.c" +#line 304 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -358,7 +350,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -633,17 +625,17 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 188, 188, 190, 194, 197, 202, 203, 207, 210, - 216, 219, 222, 225, 233, 252, 262, 267, 272, 291, - 306, 309, 312, 333, 337, 346, 351, 352, 355, 358, - 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, - 391, 394, 397, 400, 408, 411, 414, 417, 420, 423, - 429, 434, 442, 443, 447, 453, 454, 457, 459, 466, - 470, 474, 479, 484, 492, 498, 506, 510, 514, 518, - 522, 529, 530, 531, 532, 533, 534, 535, 536, 537, - 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, - 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, - 558, 559 + 0, 181, 181, 183, 187, 190, 195, 196, 200, 203, + 209, 212, 215, 218, 226, 245, 255, 260, 265, 284, + 299, 302, 305, 326, 330, 339, 344, 345, 348, 351, + 354, 357, 360, 363, 366, 369, 372, 375, 378, 381, + 384, 387, 390, 398, 406, 409, 412, 415, 418, 421, + 427, 432, 440, 441, 445, 451, 452, 455, 457, 464, + 468, 472, 477, 481, 488, 493, 500, 504, 508, 512, + 516, 523, 524, 525, 526, 527, 528, 529, 530, 531, + 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, + 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, + 552, 553 }; #endif @@ -946,9 +938,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -1005,7 +1006,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1547,7 +1548,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; @@ -1594,7 +1595,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1602,8 +1603,8 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1242 of yacc.c */ -#line 155 "glcpp/glcpp-parse.y" +/* Line 1251 of yacc.c */ +#line 148 "glcpp/glcpp-parse.y" { yylloc.first_line = 1; yylloc.first_column = 1; @@ -1612,8 +1613,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1242 of yacc.c */ -#line 1617 "glcpp/glcpp-parse.c" +/* Line 1251 of yacc.c */ +#line 1618 "glcpp/glcpp-parse.c" yylsp[0] = yylloc; goto yysetstate; @@ -1800,28 +1801,28 @@ yyreduce: { case 4: -/* Line 1455 of yacc.c */ -#line 194 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 187 "glcpp/glcpp-parse.y" { - glcpp_print(parser->output, "\n"); + ralloc_strcat (&parser->output, "\n"); ;} break; case 5: -/* Line 1455 of yacc.c */ -#line 197 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 190 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); - glcpp_print(parser->output, "\n"); - talloc_free ((yyvsp[(1) - (1)].token_list)); + ralloc_strcat (&parser->output, "\n"); + ralloc_free ((yyvsp[(1) - (1)].token_list)); ;} break; case 8: -/* Line 1455 of yacc.c */ -#line 207 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 200 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); ;} @@ -1829,8 +1830,8 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ -#line 210 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 203 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); ;} @@ -1838,8 +1839,8 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ -#line 216 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 209 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); ;} @@ -1847,8 +1848,8 @@ yyreduce: case 11: -/* Line 1455 of yacc.c */ -#line 219 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 212 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); ;} @@ -1856,8 +1857,8 @@ yyreduce: case 12: -/* Line 1455 of yacc.c */ -#line 222 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 215 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); ;} @@ -1865,22 +1866,22 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ -#line 225 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 218 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); if (macro) { hash_table_remove (parser->defines, (yyvsp[(2) - (3)].str)); - talloc_free (macro); + ralloc_free (macro); } - talloc_free ((yyvsp[(2) - (3)].str)); + ralloc_free ((yyvsp[(2) - (3)].str)); ;} break; case 14: -/* Line 1455 of yacc.c */ -#line 233 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 226 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we @@ -1904,8 +1905,8 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ -#line 252 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 245 "glcpp/glcpp-parse.y" { /* #if without an expression is only an error if we * are not skipping */ @@ -1920,30 +1921,30 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ -#line 262 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 255 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); - talloc_free ((yyvsp[(2) - (4)].str)); + ralloc_free ((yyvsp[(2) - (4)].str)); _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro != NULL); ;} break; case 17: -/* Line 1455 of yacc.c */ -#line 267 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 260 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); - talloc_free ((yyvsp[(2) - (4)].str)); + ralloc_free ((yyvsp[(2) - (4)].str)); _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro == NULL); ;} break; case 18: -/* Line 1455 of yacc.c */ -#line 272 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 265 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'elif' expression * if we are not skipping. When we are skipping, we @@ -1967,8 +1968,8 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ -#line 291 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 284 "glcpp/glcpp-parse.y" { /* #elif without an expression is an error unless we * are skipping. */ @@ -1988,8 +1989,8 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ -#line 306 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 299 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1997,8 +1998,8 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ -#line 309 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 302 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -2006,13 +2007,13 @@ yyreduce: case 22: -/* Line 1455 of yacc.c */ -#line 312 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 305 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { hash_table_remove (parser->defines, "__VERSION__"); - talloc_free (macro); + ralloc_free (macro); } add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival)); @@ -2027,14 +2028,14 @@ yyreduce: if ((yyvsp[(2) - (3)].ival) >= 130 || (yyvsp[(2) - (3)].ival) == 100) add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1); - glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival)); + ralloc_asprintf_append (&parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival)); ;} break; case 24: -/* Line 1455 of yacc.c */ -#line 337 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 330 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -2048,8 +2049,8 @@ yyreduce: case 25: -/* Line 1455 of yacc.c */ -#line 346 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 339 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -2057,8 +2058,8 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ -#line 352 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 345 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -2066,8 +2067,8 @@ yyreduce: case 28: -/* Line 1455 of yacc.c */ -#line 355 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 348 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -2075,8 +2076,8 @@ yyreduce: case 29: -/* Line 1455 of yacc.c */ -#line 358 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 351 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2084,8 +2085,8 @@ yyreduce: case 30: -/* Line 1455 of yacc.c */ -#line 361 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 354 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2093,8 +2094,8 @@ yyreduce: case 31: -/* Line 1455 of yacc.c */ -#line 364 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 357 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2102,8 +2103,8 @@ yyreduce: case 32: -/* Line 1455 of yacc.c */ -#line 367 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 360 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2111,8 +2112,8 @@ yyreduce: case 33: -/* Line 1455 of yacc.c */ -#line 370 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 363 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2120,8 +2121,8 @@ yyreduce: case 34: -/* Line 1455 of yacc.c */ -#line 373 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 366 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2129,8 +2130,8 @@ yyreduce: case 35: -/* Line 1455 of yacc.c */ -#line 376 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 369 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2138,8 +2139,8 @@ yyreduce: case 36: -/* Line 1455 of yacc.c */ -#line 379 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 372 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2147,8 +2148,8 @@ yyreduce: case 37: -/* Line 1455 of yacc.c */ -#line 382 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 375 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2156,8 +2157,8 @@ yyreduce: case 38: -/* Line 1455 of yacc.c */ -#line 385 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 378 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2165,8 +2166,8 @@ yyreduce: case 39: -/* Line 1455 of yacc.c */ -#line 388 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 381 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2174,8 +2175,8 @@ yyreduce: case 40: -/* Line 1455 of yacc.c */ -#line 391 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 384 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2183,8 +2184,8 @@ yyreduce: case 41: -/* Line 1455 of yacc.c */ -#line 394 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 387 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2192,17 +2193,22 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ -#line 397 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 390 "glcpp/glcpp-parse.y" { - (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); + if ((yyvsp[(3) - (3)].ival) == 0) { + yyerror (& (yylsp[(1) - (3)]), parser, + "zero modulus in preprocessor directive"); + } else { + (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); + } ;} break; case 43: -/* Line 1455 of yacc.c */ -#line 400 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 398 "glcpp/glcpp-parse.y" { if ((yyvsp[(3) - (3)].ival) == 0) { yyerror (& (yylsp[(1) - (3)]), parser, @@ -2215,8 +2221,8 @@ yyreduce: case 44: -/* Line 1455 of yacc.c */ -#line 408 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 406 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2224,8 +2230,8 @@ yyreduce: case 45: -/* Line 1455 of yacc.c */ -#line 411 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 409 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2233,8 +2239,8 @@ yyreduce: case 46: -/* Line 1455 of yacc.c */ -#line 414 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 412 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2242,8 +2248,8 @@ yyreduce: case 47: -/* Line 1455 of yacc.c */ -#line 417 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 415 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2251,8 +2257,8 @@ yyreduce: case 48: -/* Line 1455 of yacc.c */ -#line 420 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 418 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2260,8 +2266,8 @@ yyreduce: case 49: -/* Line 1455 of yacc.c */ -#line 423 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 421 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2269,37 +2275,37 @@ yyreduce: case 50: -/* Line 1455 of yacc.c */ -#line 429 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 427 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); - talloc_steal ((yyval.string_list), (yyvsp[(1) - (1)].str)); + ralloc_steal ((yyval.string_list), (yyvsp[(1) - (1)].str)); ;} break; case 51: -/* Line 1455 of yacc.c */ -#line 434 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 432 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); - talloc_steal ((yyval.string_list), (yyvsp[(3) - (3)].str)); + ralloc_steal ((yyval.string_list), (yyvsp[(3) - (3)].str)); ;} break; case 52: -/* Line 1455 of yacc.c */ -#line 442 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 440 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 54: -/* Line 1455 of yacc.c */ -#line 447 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 445 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2307,15 +2313,15 @@ yyreduce: case 55: -/* Line 1455 of yacc.c */ -#line 453 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 451 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 58: -/* Line 1455 of yacc.c */ -#line 459 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 457 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2323,8 +2329,8 @@ yyreduce: case 59: -/* Line 1455 of yacc.c */ -#line 466 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 464 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2333,8 +2339,8 @@ yyreduce: case 60: -/* Line 1455 of yacc.c */ -#line 470 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 468 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2343,53 +2349,49 @@ yyreduce: case 62: -/* Line 1455 of yacc.c */ -#line 479 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 477 "glcpp/glcpp-parse.y" { (yyval.token_list) = _token_list_create (parser); _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token)); - talloc_unlink (parser, (yyvsp[(1) - (1)].token)); ;} break; case 63: -/* Line 1455 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 481 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); - talloc_unlink (parser, (yyvsp[(2) - (2)].token)); ;} break; case 64: -/* Line 1455 of yacc.c */ -#line 492 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 488 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token)); - talloc_unlink (parser, (yyvsp[(1) - (1)].token)); ;} break; case 65: -/* Line 1455 of yacc.c */ -#line 498 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 493 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); - talloc_unlink (parser, (yyvsp[(2) - (2)].token)); ;} break; case 66: -/* Line 1455 of yacc.c */ -#line 506 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 500 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2398,8 +2400,8 @@ yyreduce: case 67: -/* Line 1455 of yacc.c */ -#line 510 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 504 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2408,8 +2410,8 @@ yyreduce: case 68: -/* Line 1455 of yacc.c */ -#line 514 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 508 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2418,8 +2420,8 @@ yyreduce: case 69: -/* Line 1455 of yacc.c */ -#line 518 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 512 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2428,8 +2430,8 @@ yyreduce: case 70: -/* Line 1455 of yacc.c */ -#line 522 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 516 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2438,225 +2440,225 @@ yyreduce: case 71: -/* Line 1455 of yacc.c */ -#line 529 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 72: -/* Line 1455 of yacc.c */ -#line 530 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 73: -/* Line 1455 of yacc.c */ -#line 531 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 74: -/* Line 1455 of yacc.c */ -#line 532 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 75: -/* Line 1455 of yacc.c */ -#line 533 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 76: -/* Line 1455 of yacc.c */ -#line 534 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 77: -/* Line 1455 of yacc.c */ -#line 535 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 78: -/* Line 1455 of yacc.c */ -#line 536 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 79: -/* Line 1455 of yacc.c */ -#line 537 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 80: -/* Line 1455 of yacc.c */ -#line 538 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 81: -/* Line 1455 of yacc.c */ -#line 539 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 82: -/* Line 1455 of yacc.c */ -#line 540 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 83: -/* Line 1455 of yacc.c */ -#line 541 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 84: -/* Line 1455 of yacc.c */ -#line 542 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 536 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 85: -/* Line 1455 of yacc.c */ -#line 543 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 537 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 86: -/* Line 1455 of yacc.c */ -#line 544 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 538 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 87: -/* Line 1455 of yacc.c */ -#line 545 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 539 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 88: -/* Line 1455 of yacc.c */ -#line 546 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 540 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 89: -/* Line 1455 of yacc.c */ -#line 547 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 541 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 90: -/* Line 1455 of yacc.c */ -#line 548 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 542 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 91: -/* Line 1455 of yacc.c */ -#line 549 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 543 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 92: -/* Line 1455 of yacc.c */ -#line 550 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 544 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 93: -/* Line 1455 of yacc.c */ -#line 551 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 545 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 94: -/* Line 1455 of yacc.c */ -#line 552 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 546 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 95: -/* Line 1455 of yacc.c */ -#line 553 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 547 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 96: -/* Line 1455 of yacc.c */ -#line 554 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 548 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 97: -/* Line 1455 of yacc.c */ -#line 555 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 549 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 98: -/* Line 1455 of yacc.c */ -#line 556 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 550 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 99: -/* Line 1455 of yacc.c */ -#line 557 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 551 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 100: -/* Line 1455 of yacc.c */ -#line 558 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 552 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 101: -/* Line 1455 of yacc.c */ -#line 559 "glcpp/glcpp-parse.y" +/* Line 1464 of yacc.c */ +#line 553 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; -/* Line 1455 of yacc.c */ -#line 2660 "glcpp/glcpp-parse.c" +/* Line 1464 of yacc.c */ +#line 2662 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2728,7 +2730,7 @@ yyerrlab: #endif } - yyerror_range[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus == 3) { @@ -2765,7 +2767,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[0] = yylsp[1-yylen]; + yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -2799,7 +2801,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[0] = *yylsp; + yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, parser); YYPOPSTACK (1); @@ -2809,10 +2811,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -2874,8 +2876,8 @@ yyreturn: -/* Line 1675 of yacc.c */ -#line 562 "glcpp/glcpp-parse.y" +/* Line 1684 of yacc.c */ +#line 556 "glcpp/glcpp-parse.y" string_list_t * @@ -2883,7 +2885,7 @@ _string_list_create (void *ctx) { string_list_t *list; - list = talloc (ctx, string_list_t); + list = ralloc (ctx, string_list_t); list->head = NULL; list->tail = NULL; @@ -2895,8 +2897,8 @@ _string_list_append_item (string_list_t *list, const char *str) { string_node_t *node; - node = talloc (list, string_node_t); - node->str = talloc_strdup (node, str); + node = ralloc (list, string_node_t); + node->str = ralloc_strdup (node, str); node->next = NULL; @@ -2974,7 +2976,7 @@ _argument_list_create (void *ctx) { argument_list_t *list; - list = talloc (ctx, argument_list_t); + list = ralloc (ctx, argument_list_t); list->head = NULL; list->tail = NULL; @@ -2986,7 +2988,7 @@ _argument_list_append (argument_list_t *list, token_list_t *argument) { argument_node_t *node; - node = talloc (list, argument_node_t); + node = ralloc (list, argument_node_t); node->argument = argument; node->next = NULL; @@ -3037,15 +3039,17 @@ _argument_list_member_at (argument_list_t *list, int index) return NULL; } -/* Note: This function talloc_steal()s the str pointer. */ +/* Note: This function ralloc_steal()s the str pointer. */ token_t * _token_create_str (void *ctx, int type, char *str) { token_t *token; - token = talloc (ctx, token_t); + token = ralloc (ctx, token_t); token->type = type; - token->value.str = talloc_steal (token, str); + token->value.str = str; + + ralloc_steal (token, str); return token; } @@ -3055,7 +3059,7 @@ _token_create_ival (void *ctx, int type, int ival) { token_t *token; - token = talloc (ctx, token_t); + token = ralloc (ctx, token_t); token->type = type; token->value.ival = ival; @@ -3067,7 +3071,7 @@ _token_list_create (void *ctx) { token_list_t *list; - list = talloc (ctx, token_list_t); + list = ralloc (ctx, token_list_t); list->head = NULL; list->tail = NULL; list->non_space_tail = NULL; @@ -3080,11 +3084,12 @@ _token_list_append (token_list_t *list, token_t *token) { token_node_t *node; - node = talloc (list, token_node_t); - node->token = talloc_reference (list, token); - + node = ralloc (list, token_node_t); + node->token = token; node->next = NULL; + ralloc_steal (list, token); + if (list->head == NULL) { list->head = node; } else { @@ -3122,8 +3127,11 @@ _token_list_copy (void *ctx, token_list_t *other) return NULL; copy = _token_list_create (ctx); - for (node = other->head; node; node = node->next) - _token_list_append (copy, node->token); + for (node = other->head; node; node = node->next) { + token_t *new_token = ralloc (copy, token_t); + *new_token = *node->token; + _token_list_append (copy, new_token); + } return copy; } @@ -3140,13 +3148,13 @@ _token_list_trim_trailing_space (token_list_t *list) while (tail) { next = tail->next; - talloc_free (tail); + ralloc_free (tail); tail = next; } } } -int +static int _token_list_is_empty_ignoring_space (token_list_t *l) { token_node_t *n; @@ -3226,51 +3234,51 @@ static void _token_print (char **out, token_t *token) { if (token->type < 256) { - glcpp_printf (*out, "%c", token->type); + ralloc_asprintf_append (out, "%c", token->type); return; } switch (token->type) { case INTEGER: - glcpp_printf (*out, "%" PRIiMAX, token->value.ival); + ralloc_asprintf_append (out, "%" PRIiMAX, token->value.ival); break; case IDENTIFIER: case INTEGER_STRING: case OTHER: - glcpp_print (*out, token->value.str); + ralloc_strcat (out, token->value.str); break; case SPACE: - glcpp_print (*out, " "); + ralloc_strcat (out, " "); break; case LEFT_SHIFT: - glcpp_print (*out, "<<"); + ralloc_strcat (out, "<<"); break; case RIGHT_SHIFT: - glcpp_print (*out, ">>"); + ralloc_strcat (out, ">>"); break; case LESS_OR_EQUAL: - glcpp_print (*out, "<="); + ralloc_strcat (out, "<="); break; case GREATER_OR_EQUAL: - glcpp_print (*out, ">="); + ralloc_strcat (out, ">="); break; case EQUAL: - glcpp_print (*out, "=="); + ralloc_strcat (out, "=="); break; case NOT_EQUAL: - glcpp_print (*out, "!="); + ralloc_strcat (out, "!="); break; case AND: - glcpp_print (*out, "&&"); + ralloc_strcat (out, "&&"); break; case OR: - glcpp_print (*out, "||"); + ralloc_strcat (out, "||"); break; case PASTE: - glcpp_print (*out, "##"); + ralloc_strcat (out, "##"); break; case COMMA_FINAL: - glcpp_print (*out, ","); + ralloc_strcat (out, ","); break; case PLACEHOLDER: /* Nothing to print. */ @@ -3281,7 +3289,7 @@ _token_print (char **out, token_t *token) } } -/* Return a new token (talloc()ed off of 'token') formed by pasting +/* Return a new token (ralloc()ed off of 'token') formed by pasting * 'token' and 'other'. Note that this function may return 'token' or * 'other' directly rather than allocating anything new. * @@ -3352,7 +3360,7 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) { char *str; - str = talloc_asprintf (token, "%s%s", token->value.str, + str = ralloc_asprintf (token, "%s%s", token->value.str, other->value.str); combined = _token_create_str (token, token->type, str); combined->location = token->location; @@ -3360,11 +3368,11 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) } glcpp_error (&token->location, parser, ""); - glcpp_print (parser->info_log, "Pasting \""); + ralloc_strcat (&parser->info_log, "Pasting \""); _token_print (&parser->info_log, token); - glcpp_print (parser->info_log, "\" and \""); + ralloc_strcat (&parser->info_log, "\" and \""); _token_print (&parser->info_log, other); - glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n"); + ralloc_strcat (&parser->info_log, "\" does not give a valid preprocessing token.\n"); return token; } @@ -3398,8 +3406,6 @@ static void add_builtin_define(glcpp_parser_t *parser, list = _token_list_create(parser); _token_list_append(list, tok); _define_object_macro(parser, NULL, name, list); - - talloc_unlink(parser, tok); } glcpp_parser_t * @@ -3408,7 +3414,7 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) glcpp_parser_t *parser; int language_version; - parser = talloc (NULL, glcpp_parser_t); + parser = ralloc (NULL, glcpp_parser_t); glcpp_lex_init_extra (parser, &parser->scanner); parser->defines = hash_table_ctor (32, hash_table_string_hash, @@ -3425,8 +3431,8 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) parser->lex_from_list = NULL; parser->lex_from_node = NULL; - parser->output = talloc_strdup(parser, ""); - parser->info_log = talloc_strdup(parser, ""); + parser->output = ralloc_strdup(parser, ""); + parser->info_log = ralloc_strdup(parser, ""); parser->error = 0; /* Add pre-defined macros. */ @@ -3447,6 +3453,8 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_explicit_attrib_location) add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1); + if (extensions->AMD_conservative_depth) + add_builtin_define(parser, "GL_AMD_conservative_depth", 1); } language_version = 110; @@ -3466,7 +3474,7 @@ glcpp_parser_destroy (glcpp_parser_t *parser) { glcpp_lex_destroy (parser->scanner); hash_table_dtor (parser->defines); - talloc_free (parser); + ralloc_free (parser); } typedef enum function_status @@ -3637,7 +3645,7 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) { - talloc_free (arguments); + ralloc_free (arguments); return _token_list_create_with_one_space (parser); } @@ -3793,7 +3801,7 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, token_list_t *expansion; token_t *final; - str = talloc_strdup (parser, token->value.str); + str = ralloc_strdup (parser, token->value.str); final = _token_create_str (parser, OTHER, str); expansion = _token_list_create (parser); _token_list_append (expansion, final); @@ -3829,8 +3837,8 @@ _active_list_push (active_list_t *list, { active_list_t *node; - node = talloc (list, active_list_t); - node->identifier = talloc_strdup (node, identifier); + node = ralloc (list, active_list_t); + node->identifier = ralloc_strdup (node, identifier); node->marker = marker; node->next = list; @@ -3846,7 +3854,7 @@ _active_list_pop (active_list_t *list) return NULL; node = list->next; - talloc_free (list); + ralloc_free (list); return node; } @@ -3995,17 +4003,18 @@ _define_object_macro (glcpp_parser_t *parser, if (loc != NULL) _check_for_reserved_macro_name(parser, loc, identifier); - macro = talloc (parser, macro_t); + macro = ralloc (parser, macro_t); macro->is_function = 0; macro->parameters = NULL; - macro->identifier = talloc_strdup (macro, identifier); - macro->replacements = talloc_steal (macro, replacements); + macro->identifier = ralloc_strdup (macro, identifier); + macro->replacements = replacements; + ralloc_steal (macro, replacements); previous = hash_table_find (parser->defines, identifier); if (previous) { if (_macro_equal (macro, previous)) { - talloc_free (macro); + ralloc_free (macro); return; } glcpp_error (loc, parser, "Redefinition of macro %s\n", @@ -4026,17 +4035,18 @@ _define_function_macro (glcpp_parser_t *parser, _check_for_reserved_macro_name(parser, loc, identifier); - macro = talloc (parser, macro_t); + macro = ralloc (parser, macro_t); + ralloc_steal (macro, parameters); + ralloc_steal (macro, replacements); macro->is_function = 1; - macro->parameters = talloc_steal (macro, parameters); - macro->identifier = talloc_strdup (macro, identifier); - macro->replacements = talloc_steal (macro, replacements); - + macro->parameters = parameters; + macro->identifier = ralloc_strdup (macro, identifier); + macro->replacements = replacements; previous = hash_table_find (parser->defines, identifier); if (previous) { if (_macro_equal (macro, previous)) { - talloc_free (macro); + ralloc_free (macro); return; } glcpp_error (loc, parser, "Redefinition of macro %s\n", @@ -4112,7 +4122,7 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) node = parser->lex_from_node; if (node == NULL) { - talloc_free (parser->lex_from_list); + ralloc_free (parser->lex_from_list); parser->lex_from_list = NULL; return NEWLINE; } @@ -4141,13 +4151,13 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list) _token_list_append (parser->lex_from_list, node->token); } - talloc_free (list); + ralloc_free (list); parser->lex_from_node = parser->lex_from_list->head; /* It's possible the list consisted of nothing but whitespace. */ if (parser->lex_from_node == NULL) { - talloc_free (parser->lex_from_list); + ralloc_free (parser->lex_from_list); parser->lex_from_list = NULL; } } @@ -4162,7 +4172,7 @@ _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, if (parser->skip_stack) current = parser->skip_stack->type; - node = talloc (parser, skip_node_t); + node = ralloc (parser, skip_node_t); node->loc = *loc; if (current == SKIP_NO_SKIP) { @@ -4207,6 +4217,6 @@ _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) node = parser->skip_stack; parser->skip_stack = node->next; - talloc_free (node); + ralloc_free (node); } diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e71c0e8b382..1f6e67fa062 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -32,10 +32,6 @@ #include "main/core.h" /* for struct gl_extensions */ #include "main/mtypes.h" /* for gl_api enum */ -#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) -#define glcpp_printf(stream, fmt, args, ...) \ - stream = talloc_asprintf_append(stream, fmt, args) - static void yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); @@ -79,7 +75,7 @@ _argument_list_length (argument_list_t *list); static token_list_t * _argument_list_member_at (argument_list_t *list, int index); -/* Note: This function talloc_steal()s the str pointer. */ +/* Note: This function ralloc_steal()s the str pointer. */ static token_t * _token_create_str (void *ctx, int type, char *str); @@ -89,10 +85,7 @@ _token_create_ival (void *ctx, int type, int ival); static token_list_t * _token_list_create (void *ctx); -/* Note: This function adds a talloc_reference() to token. - * - * You may want to talloc_unlink any current reference if you no - * longer need it. */ +/* Note: This function calls ralloc_steal on token. */ static void _token_list_append (token_list_t *list, token_t *token); @@ -192,12 +185,12 @@ input: line: control_line { - glcpp_print(parser->output, "\n"); + ralloc_strcat (&parser->output, "\n"); } | text_line { _glcpp_parser_print_expanded_token_list (parser, $1); - glcpp_print(parser->output, "\n"); - talloc_free ($1); + ralloc_strcat (&parser->output, "\n"); + ralloc_free ($1); } | expanded_line | HASH non_directive @@ -226,9 +219,9 @@ control_line: macro_t *macro = hash_table_find (parser->defines, $2); if (macro) { hash_table_remove (parser->defines, $2); - talloc_free (macro); + ralloc_free (macro); } - talloc_free ($2); + ralloc_free ($2); } | HASH_IF conditional_tokens NEWLINE { /* Be careful to only evaluate the 'if' expression if @@ -261,12 +254,12 @@ control_line: } | HASH_IFDEF IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); - talloc_free ($2); + ralloc_free ($2); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); } | HASH_IFNDEF IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); - talloc_free ($2); + ralloc_free ($2); _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); } | HASH_ELIF conditional_tokens NEWLINE { @@ -313,7 +306,7 @@ control_line: macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { hash_table_remove (parser->defines, "__VERSION__"); - talloc_free (macro); + ralloc_free (macro); } add_builtin_define (parser, "__VERSION__", $2); @@ -328,7 +321,7 @@ control_line: if ($2 >= 130 || $2 == 100) add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1); - glcpp_printf(parser->output, "#version %" PRIiMAX, $2); + ralloc_asprintf_append (&parser->output, "#version %" PRIiMAX, $2); } | HASH NEWLINE ; @@ -395,7 +388,12 @@ expression: $$ = $1 + $3; } | expression '%' expression { - $$ = $1 % $3; + if ($3 == 0) { + yyerror (& @1, parser, + "zero modulus in preprocessor directive"); + } else { + $$ = $1 % $3; + } } | expression '/' expression { if ($3 == 0) { @@ -429,12 +427,12 @@ identifier_list: IDENTIFIER { $$ = _string_list_create (parser); _string_list_append_item ($$, $1); - talloc_steal ($$, $1); + ralloc_steal ($$, $1); } | identifier_list ',' IDENTIFIER { $$ = $1; _string_list_append_item ($$, $3); - talloc_steal ($$, $3); + ralloc_steal ($$, $3); } ; @@ -479,12 +477,10 @@ conditional_tokens: conditional_token { $$ = _token_list_create (parser); _token_list_append ($$, $1); - talloc_unlink (parser, $1); } | conditional_tokens conditional_token { $$ = $1; _token_list_append ($$, $2); - talloc_unlink (parser, $2); } ; @@ -493,12 +489,10 @@ pp_tokens: parser->space_tokens = 1; $$ = _token_list_create (parser); _token_list_append ($$, $1); - talloc_unlink (parser, $1); } | pp_tokens preprocessing_token { $$ = $1; _token_list_append ($$, $2); - talloc_unlink (parser, $2); } ; @@ -566,7 +560,7 @@ _string_list_create (void *ctx) { string_list_t *list; - list = talloc (ctx, string_list_t); + list = ralloc (ctx, string_list_t); list->head = NULL; list->tail = NULL; @@ -578,8 +572,8 @@ _string_list_append_item (string_list_t *list, const char *str) { string_node_t *node; - node = talloc (list, string_node_t); - node->str = talloc_strdup (node, str); + node = ralloc (list, string_node_t); + node->str = ralloc_strdup (node, str); node->next = NULL; @@ -657,7 +651,7 @@ _argument_list_create (void *ctx) { argument_list_t *list; - list = talloc (ctx, argument_list_t); + list = ralloc (ctx, argument_list_t); list->head = NULL; list->tail = NULL; @@ -669,7 +663,7 @@ _argument_list_append (argument_list_t *list, token_list_t *argument) { argument_node_t *node; - node = talloc (list, argument_node_t); + node = ralloc (list, argument_node_t); node->argument = argument; node->next = NULL; @@ -720,15 +714,17 @@ _argument_list_member_at (argument_list_t *list, int index) return NULL; } -/* Note: This function talloc_steal()s the str pointer. */ +/* Note: This function ralloc_steal()s the str pointer. */ token_t * _token_create_str (void *ctx, int type, char *str) { token_t *token; - token = talloc (ctx, token_t); + token = ralloc (ctx, token_t); token->type = type; - token->value.str = talloc_steal (token, str); + token->value.str = str; + + ralloc_steal (token, str); return token; } @@ -738,7 +734,7 @@ _token_create_ival (void *ctx, int type, int ival) { token_t *token; - token = talloc (ctx, token_t); + token = ralloc (ctx, token_t); token->type = type; token->value.ival = ival; @@ -750,7 +746,7 @@ _token_list_create (void *ctx) { token_list_t *list; - list = talloc (ctx, token_list_t); + list = ralloc (ctx, token_list_t); list->head = NULL; list->tail = NULL; list->non_space_tail = NULL; @@ -763,11 +759,12 @@ _token_list_append (token_list_t *list, token_t *token) { token_node_t *node; - node = talloc (list, token_node_t); - node->token = talloc_reference (list, token); - + node = ralloc (list, token_node_t); + node->token = token; node->next = NULL; + ralloc_steal (list, token); + if (list->head == NULL) { list->head = node; } else { @@ -805,8 +802,11 @@ _token_list_copy (void *ctx, token_list_t *other) return NULL; copy = _token_list_create (ctx); - for (node = other->head; node; node = node->next) - _token_list_append (copy, node->token); + for (node = other->head; node; node = node->next) { + token_t *new_token = ralloc (copy, token_t); + *new_token = *node->token; + _token_list_append (copy, new_token); + } return copy; } @@ -823,13 +823,13 @@ _token_list_trim_trailing_space (token_list_t *list) while (tail) { next = tail->next; - talloc_free (tail); + ralloc_free (tail); tail = next; } } } -int +static int _token_list_is_empty_ignoring_space (token_list_t *l) { token_node_t *n; @@ -909,51 +909,51 @@ static void _token_print (char **out, token_t *token) { if (token->type < 256) { - glcpp_printf (*out, "%c", token->type); + ralloc_asprintf_append (out, "%c", token->type); return; } switch (token->type) { case INTEGER: - glcpp_printf (*out, "%" PRIiMAX, token->value.ival); + ralloc_asprintf_append (out, "%" PRIiMAX, token->value.ival); break; case IDENTIFIER: case INTEGER_STRING: case OTHER: - glcpp_print (*out, token->value.str); + ralloc_strcat (out, token->value.str); break; case SPACE: - glcpp_print (*out, " "); + ralloc_strcat (out, " "); break; case LEFT_SHIFT: - glcpp_print (*out, "<<"); + ralloc_strcat (out, "<<"); break; case RIGHT_SHIFT: - glcpp_print (*out, ">>"); + ralloc_strcat (out, ">>"); break; case LESS_OR_EQUAL: - glcpp_print (*out, "<="); + ralloc_strcat (out, "<="); break; case GREATER_OR_EQUAL: - glcpp_print (*out, ">="); + ralloc_strcat (out, ">="); break; case EQUAL: - glcpp_print (*out, "=="); + ralloc_strcat (out, "=="); break; case NOT_EQUAL: - glcpp_print (*out, "!="); + ralloc_strcat (out, "!="); break; case AND: - glcpp_print (*out, "&&"); + ralloc_strcat (out, "&&"); break; case OR: - glcpp_print (*out, "||"); + ralloc_strcat (out, "||"); break; case PASTE: - glcpp_print (*out, "##"); + ralloc_strcat (out, "##"); break; case COMMA_FINAL: - glcpp_print (*out, ","); + ralloc_strcat (out, ","); break; case PLACEHOLDER: /* Nothing to print. */ @@ -964,7 +964,7 @@ _token_print (char **out, token_t *token) } } -/* Return a new token (talloc()ed off of 'token') formed by pasting +/* Return a new token (ralloc()ed off of 'token') formed by pasting * 'token' and 'other'. Note that this function may return 'token' or * 'other' directly rather than allocating anything new. * @@ -1035,7 +1035,7 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) { char *str; - str = talloc_asprintf (token, "%s%s", token->value.str, + str = ralloc_asprintf (token, "%s%s", token->value.str, other->value.str); combined = _token_create_str (token, token->type, str); combined->location = token->location; @@ -1043,11 +1043,11 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) } glcpp_error (&token->location, parser, ""); - glcpp_print (parser->info_log, "Pasting \""); + ralloc_strcat (&parser->info_log, "Pasting \""); _token_print (&parser->info_log, token); - glcpp_print (parser->info_log, "\" and \""); + ralloc_strcat (&parser->info_log, "\" and \""); _token_print (&parser->info_log, other); - glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n"); + ralloc_strcat (&parser->info_log, "\" does not give a valid preprocessing token.\n"); return token; } @@ -1081,8 +1081,6 @@ static void add_builtin_define(glcpp_parser_t *parser, list = _token_list_create(parser); _token_list_append(list, tok); _define_object_macro(parser, NULL, name, list); - - talloc_unlink(parser, tok); } glcpp_parser_t * @@ -1091,7 +1089,7 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) glcpp_parser_t *parser; int language_version; - parser = talloc (NULL, glcpp_parser_t); + parser = ralloc (NULL, glcpp_parser_t); glcpp_lex_init_extra (parser, &parser->scanner); parser->defines = hash_table_ctor (32, hash_table_string_hash, @@ -1108,8 +1106,8 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) parser->lex_from_list = NULL; parser->lex_from_node = NULL; - parser->output = talloc_strdup(parser, ""); - parser->info_log = talloc_strdup(parser, ""); + parser->output = ralloc_strdup(parser, ""); + parser->info_log = ralloc_strdup(parser, ""); parser->error = 0; /* Add pre-defined macros. */ @@ -1130,6 +1128,8 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_explicit_attrib_location) add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1); + if (extensions->AMD_conservative_depth) + add_builtin_define(parser, "GL_AMD_conservative_depth", 1); } language_version = 110; @@ -1149,7 +1149,7 @@ glcpp_parser_destroy (glcpp_parser_t *parser) { glcpp_lex_destroy (parser->scanner); hash_table_dtor (parser->defines); - talloc_free (parser); + ralloc_free (parser); } typedef enum function_status @@ -1320,7 +1320,7 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) { - talloc_free (arguments); + ralloc_free (arguments); return _token_list_create_with_one_space (parser); } @@ -1476,7 +1476,7 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, token_list_t *expansion; token_t *final; - str = talloc_strdup (parser, token->value.str); + str = ralloc_strdup (parser, token->value.str); final = _token_create_str (parser, OTHER, str); expansion = _token_list_create (parser); _token_list_append (expansion, final); @@ -1512,8 +1512,8 @@ _active_list_push (active_list_t *list, { active_list_t *node; - node = talloc (list, active_list_t); - node->identifier = talloc_strdup (node, identifier); + node = ralloc (list, active_list_t); + node->identifier = ralloc_strdup (node, identifier); node->marker = marker; node->next = list; @@ -1529,7 +1529,7 @@ _active_list_pop (active_list_t *list) return NULL; node = list->next; - talloc_free (list); + ralloc_free (list); return node; } @@ -1678,17 +1678,18 @@ _define_object_macro (glcpp_parser_t *parser, if (loc != NULL) _check_for_reserved_macro_name(parser, loc, identifier); - macro = talloc (parser, macro_t); + macro = ralloc (parser, macro_t); macro->is_function = 0; macro->parameters = NULL; - macro->identifier = talloc_strdup (macro, identifier); - macro->replacements = talloc_steal (macro, replacements); + macro->identifier = ralloc_strdup (macro, identifier); + macro->replacements = replacements; + ralloc_steal (macro, replacements); previous = hash_table_find (parser->defines, identifier); if (previous) { if (_macro_equal (macro, previous)) { - talloc_free (macro); + ralloc_free (macro); return; } glcpp_error (loc, parser, "Redefinition of macro %s\n", @@ -1709,17 +1710,18 @@ _define_function_macro (glcpp_parser_t *parser, _check_for_reserved_macro_name(parser, loc, identifier); - macro = talloc (parser, macro_t); + macro = ralloc (parser, macro_t); + ralloc_steal (macro, parameters); + ralloc_steal (macro, replacements); macro->is_function = 1; - macro->parameters = talloc_steal (macro, parameters); - macro->identifier = talloc_strdup (macro, identifier); - macro->replacements = talloc_steal (macro, replacements); - + macro->parameters = parameters; + macro->identifier = ralloc_strdup (macro, identifier); + macro->replacements = replacements; previous = hash_table_find (parser->defines, identifier); if (previous) { if (_macro_equal (macro, previous)) { - talloc_free (macro); + ralloc_free (macro); return; } glcpp_error (loc, parser, "Redefinition of macro %s\n", @@ -1795,7 +1797,7 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) node = parser->lex_from_node; if (node == NULL) { - talloc_free (parser->lex_from_list); + ralloc_free (parser->lex_from_list); parser->lex_from_list = NULL; return NEWLINE; } @@ -1824,13 +1826,13 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list) _token_list_append (parser->lex_from_list, node->token); } - talloc_free (list); + ralloc_free (list); parser->lex_from_node = parser->lex_from_list->head; /* It's possible the list consisted of nothing but whitespace. */ if (parser->lex_from_node == NULL) { - talloc_free (parser->lex_from_list); + ralloc_free (parser->lex_from_list); parser->lex_from_list = NULL; } } @@ -1845,7 +1847,7 @@ _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, if (parser->skip_stack) current = parser->skip_stack->type; - node = talloc (parser, skip_node_t); + node = ralloc (parser, skip_node_t); node->loc = *loc; if (current == SKIP_NO_SKIP) { @@ -1890,5 +1892,5 @@ _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) node = parser->skip_stack; parser->skip_stack = node->next; - talloc_free (node); + ralloc_free (node); } diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c index 062eb6b72d4..564194caac2 100644 --- a/src/glsl/glcpp/glcpp.c +++ b/src/glsl/glcpp/glcpp.c @@ -54,7 +54,7 @@ load_text_fd (void *ctx, int fd) while (1) { if (total_read + CHUNK + 1 > text_size) { text_size = text_size ? text_size * 2 : CHUNK + 1; - text = talloc_realloc_size (ctx, text, text_size); + text = reralloc_size (ctx, text, text_size); if (text == NULL) { fprintf (stderr, "Out of memory\n"); return NULL; @@ -64,7 +64,7 @@ load_text_fd (void *ctx, int fd) if (bytes < 0) { fprintf (stderr, "Error while reading: %s\n", strerror (errno)); - talloc_free (text); + ralloc_free (text); return NULL; } @@ -107,8 +107,8 @@ int main (int argc, char *argv[]) { char *filename = NULL; - void *ctx = talloc(NULL, void*); - char *info_log = talloc_strdup(ctx, ""); + void *ctx = ralloc(NULL, void*); + char *info_log = ralloc_strdup(ctx, ""); const char *shader; int ret; @@ -125,7 +125,7 @@ main (int argc, char *argv[]) printf("%s", shader); fprintf(stderr, "%s", info_log); - talloc_free(ctx); + ralloc_free(ctx); return ret; } diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h index 7125d325dff..dc816e90ee7 100644 --- a/src/glsl/glcpp/glcpp.h +++ b/src/glsl/glcpp/glcpp.h @@ -26,7 +26,7 @@ #include <stdint.h> -#include <talloc.h> +#include "../ralloc.h" #include "program/hash_table.h" @@ -189,7 +189,7 @@ void glcpp_parser_destroy (glcpp_parser_t *parser); int -preprocess(void *talloc_ctx, const char **shader, char **info_log, +preprocess(void *ralloc_ctx, const char **shader, char **info_log, const struct gl_extensions *extensions, int api); /* Functions for writing to the info log */ diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index e1a3a88a3e5..3640896a2c2 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -33,16 +33,15 @@ glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) va_list ap; parser->error = 1; - parser->info_log = talloc_asprintf_append(parser->info_log, - "%u:%u(%u): " + ralloc_asprintf_append(&parser->info_log, "%u:%u(%u): " "preprocessor error: ", locp->source, locp->first_line, locp->first_column); va_start(ap, fmt); - parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); + ralloc_vasprintf_append(&parser->info_log, fmt, ap); va_end(ap); - parser->info_log = talloc_strdup_append(parser->info_log, "\n"); + ralloc_strcat(&parser->info_log, "\n"); } void @@ -50,16 +49,15 @@ glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) { va_list ap; - parser->info_log = talloc_asprintf_append(parser->info_log, - "%u:%u(%u): " + ralloc_asprintf_append(&parser->info_log, "%u:%u(%u): " "preprocessor warning: ", locp->source, locp->first_line, locp->first_column); va_start(ap, fmt); - parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); + ralloc_vasprintf_append(&parser->info_log, fmt, ap); va_end(ap); - parser->info_log = talloc_strdup_append(parser->info_log, "\n"); + ralloc_strcat(&parser->info_log, "\n"); } /* Searches backwards for '^ *#' from a given starting point. */ @@ -92,7 +90,7 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) { int in_continued_line = 0; int extra_newlines = 0; - char *clean = talloc_strdup(ctx, ""); + char *clean = ralloc_strdup(ctx, ""); const char *search_start = shader; const char *newline; while ((newline = strchr(search_start, '\n')) != NULL) { @@ -122,27 +120,27 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) } if (in_continued_line) { /* Copy everything before the \ */ - clean = talloc_strndup_append(clean, shader, backslash - shader); + ralloc_strncat(&clean, shader, backslash - shader); shader = newline + 1; extra_newlines++; } } else if (in_continued_line) { /* Copy everything up to and including the \n */ - clean = talloc_strndup_append(clean, shader, newline - shader + 1); + ralloc_strncat(&clean, shader, newline - shader + 1); shader = newline + 1; /* Output extra newlines to make line numbers match */ for (; extra_newlines > 0; extra_newlines--) - clean = talloc_strdup_append(clean, "\n"); + ralloc_strcat(&clean, "\n"); in_continued_line = 0; } search_start = newline + 1; } - clean = talloc_strdup_append(clean, shader); + ralloc_strcat(&clean, shader); return clean; } int -preprocess(void *talloc_ctx, const char **shader, char **info_log, +preprocess(void *ralloc_ctx, const char **shader, char **info_log, const struct gl_extensions *extensions, int api) { int errors; @@ -156,9 +154,9 @@ preprocess(void *talloc_ctx, const char **shader, char **info_log, if (parser->skip_stack) glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); - *info_log = talloc_strdup_append(*info_log, parser->info_log); + ralloc_strcat(info_log, parser->info_log); - talloc_steal(talloc_ctx, parser->output); + ralloc_steal(ralloc_ctx, parser->output); *shader = parser->output; errors = parser->error; diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index 7c0a51b99bf..40d2294ef8c 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -54,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -159,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -1027,6 +1018,8 @@ static yyconst flex_int16_t yy_chk[1283] = #include "glsl_parser_extras.h" #include "glsl_parser.h" +static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); + #define YY_USER_ACTION \ do { \ yylloc->source = 0; \ @@ -1062,7 +1055,7 @@ static yyconst flex_int16_t yy_chk[1283] = return ERROR_TOK; \ } else { \ yylval->identifier = strdup(yytext); \ - return IDENTIFIER; \ + return classify_identifier(yyextra, yytext); \ } \ } while (0) @@ -1076,7 +1069,7 @@ static yyconst flex_int16_t yy_chk[1283] = */ #define ES yyextra->es_shader -#line 1080 "glsl_lexer.cpp" +#line 1073 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -1163,6 +1156,10 @@ int _mesa_glsl_get_lineno (yyscan_t yyscanner ); void _mesa_glsl_set_lineno (int line_number ,yyscan_t yyscanner ); +int _mesa_glsl_get_column (yyscan_t yyscanner ); + +void _mesa_glsl_set_column (int column_no ,yyscan_t yyscanner ); + YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner ); void _mesa_glsl_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); @@ -1203,12 +1200,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1227,7 +1219,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1315,10 +1307,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 95 "glsl_lexer.lpp" +#line 97 "glsl_lexer.lpp" -#line 1322 "glsl_lexer.cpp" +#line 1314 "glsl_lexer.cpp" yylval = yylval_param; @@ -1404,7 +1396,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 97 "glsl_lexer.lpp" +#line 99 "glsl_lexer.lpp" ; YY_BREAK /* Preprocessor tokens. */ @@ -1413,17 +1405,17 @@ case 2: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 100 "glsl_lexer.lpp" +#line 102 "glsl_lexer.lpp" ; YY_BREAK case 3: YY_RULE_SETUP -#line 101 "glsl_lexer.lpp" +#line 103 "glsl_lexer.lpp" { BEGIN PP; return VERSION; } YY_BREAK case 4: YY_RULE_SETUP -#line 102 "glsl_lexer.lpp" +#line 104 "glsl_lexer.lpp" { BEGIN PP; return EXTENSION; } YY_BREAK case 5: @@ -1431,7 +1423,7 @@ case 5: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 103 "glsl_lexer.lpp" +#line 105 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1453,7 +1445,7 @@ case 6: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 118 "glsl_lexer.lpp" +#line 120 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1471,7 +1463,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 132 "glsl_lexer.lpp" +#line 134 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_DEBUG_ON; @@ -1479,7 +1471,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 136 "glsl_lexer.lpp" +#line 138 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_DEBUG_OFF; @@ -1487,7 +1479,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 140 "glsl_lexer.lpp" +#line 142 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_OPTIMIZE_ON; @@ -1495,7 +1487,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 144 "glsl_lexer.lpp" +#line 146 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_OPTIMIZE_OFF; @@ -1503,7 +1495,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 148 "glsl_lexer.lpp" +#line 150 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_INVARIANT_ALL; @@ -1511,38 +1503,38 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 152 "glsl_lexer.lpp" +#line 154 "glsl_lexer.lpp" { BEGIN PRAGMA; } YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 154 "glsl_lexer.lpp" +#line 156 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; } YY_BREAK case 14: YY_RULE_SETUP -#line 155 "glsl_lexer.lpp" +#line 157 "glsl_lexer.lpp" { } YY_BREAK case 15: YY_RULE_SETUP -#line 157 "glsl_lexer.lpp" +#line 159 "glsl_lexer.lpp" { } YY_BREAK case 16: YY_RULE_SETUP -#line 158 "glsl_lexer.lpp" +#line 160 "glsl_lexer.lpp" { } YY_BREAK case 17: YY_RULE_SETUP -#line 159 "glsl_lexer.lpp" +#line 161 "glsl_lexer.lpp" return COLON; YY_BREAK case 18: YY_RULE_SETUP -#line 160 "glsl_lexer.lpp" +#line 162 "glsl_lexer.lpp" { yylval->identifier = strdup(yytext); return IDENTIFIER; @@ -1550,7 +1542,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 164 "glsl_lexer.lpp" +#line 166 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1559,392 +1551,393 @@ YY_RULE_SETUP case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 168 "glsl_lexer.lpp" +#line 170 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } YY_BREAK case 21: /* rule 21 can match eol */ YY_RULE_SETUP -#line 170 "glsl_lexer.lpp" +#line 172 "glsl_lexer.lpp" { yylineno++; yycolumn = 0; } YY_BREAK case 22: YY_RULE_SETUP -#line 172 "glsl_lexer.lpp" +#line 174 "glsl_lexer.lpp" return ATTRIBUTE; YY_BREAK case 23: YY_RULE_SETUP -#line 173 "glsl_lexer.lpp" +#line 175 "glsl_lexer.lpp" return CONST_TOK; YY_BREAK case 24: YY_RULE_SETUP -#line 174 "glsl_lexer.lpp" +#line 176 "glsl_lexer.lpp" return BOOL_TOK; YY_BREAK case 25: YY_RULE_SETUP -#line 175 "glsl_lexer.lpp" +#line 177 "glsl_lexer.lpp" return FLOAT_TOK; YY_BREAK case 26: YY_RULE_SETUP -#line 176 "glsl_lexer.lpp" +#line 178 "glsl_lexer.lpp" return INT_TOK; YY_BREAK case 27: YY_RULE_SETUP -#line 177 "glsl_lexer.lpp" +#line 179 "glsl_lexer.lpp" KEYWORD(130, 130, UINT_TOK); YY_BREAK case 28: YY_RULE_SETUP -#line 179 "glsl_lexer.lpp" +#line 181 "glsl_lexer.lpp" return BREAK; YY_BREAK case 29: YY_RULE_SETUP -#line 180 "glsl_lexer.lpp" +#line 182 "glsl_lexer.lpp" return CONTINUE; YY_BREAK case 30: YY_RULE_SETUP -#line 181 "glsl_lexer.lpp" +#line 183 "glsl_lexer.lpp" return DO; YY_BREAK case 31: YY_RULE_SETUP -#line 182 "glsl_lexer.lpp" +#line 184 "glsl_lexer.lpp" return WHILE; YY_BREAK case 32: YY_RULE_SETUP -#line 183 "glsl_lexer.lpp" +#line 185 "glsl_lexer.lpp" return ELSE; YY_BREAK case 33: YY_RULE_SETUP -#line 184 "glsl_lexer.lpp" +#line 186 "glsl_lexer.lpp" return FOR; YY_BREAK case 34: YY_RULE_SETUP -#line 185 "glsl_lexer.lpp" +#line 187 "glsl_lexer.lpp" return IF; YY_BREAK case 35: YY_RULE_SETUP -#line 186 "glsl_lexer.lpp" +#line 188 "glsl_lexer.lpp" return DISCARD; YY_BREAK case 36: YY_RULE_SETUP -#line 187 "glsl_lexer.lpp" +#line 189 "glsl_lexer.lpp" return RETURN; YY_BREAK case 37: YY_RULE_SETUP -#line 189 "glsl_lexer.lpp" +#line 191 "glsl_lexer.lpp" return BVEC2; YY_BREAK case 38: YY_RULE_SETUP -#line 190 "glsl_lexer.lpp" +#line 192 "glsl_lexer.lpp" return BVEC3; YY_BREAK case 39: YY_RULE_SETUP -#line 191 "glsl_lexer.lpp" +#line 193 "glsl_lexer.lpp" return BVEC4; YY_BREAK case 40: YY_RULE_SETUP -#line 192 "glsl_lexer.lpp" +#line 194 "glsl_lexer.lpp" return IVEC2; YY_BREAK case 41: YY_RULE_SETUP -#line 193 "glsl_lexer.lpp" +#line 195 "glsl_lexer.lpp" return IVEC3; YY_BREAK case 42: YY_RULE_SETUP -#line 194 "glsl_lexer.lpp" +#line 196 "glsl_lexer.lpp" return IVEC4; YY_BREAK case 43: YY_RULE_SETUP -#line 195 "glsl_lexer.lpp" +#line 197 "glsl_lexer.lpp" KEYWORD(130, 130, UVEC2); YY_BREAK case 44: YY_RULE_SETUP -#line 196 "glsl_lexer.lpp" +#line 198 "glsl_lexer.lpp" KEYWORD(130, 130, UVEC3); YY_BREAK case 45: YY_RULE_SETUP -#line 197 "glsl_lexer.lpp" +#line 199 "glsl_lexer.lpp" KEYWORD(130, 130, UVEC4); YY_BREAK case 46: YY_RULE_SETUP -#line 198 "glsl_lexer.lpp" +#line 200 "glsl_lexer.lpp" return VEC2; YY_BREAK case 47: YY_RULE_SETUP -#line 199 "glsl_lexer.lpp" +#line 201 "glsl_lexer.lpp" return VEC3; YY_BREAK case 48: YY_RULE_SETUP -#line 200 "glsl_lexer.lpp" +#line 202 "glsl_lexer.lpp" return VEC4; YY_BREAK case 49: YY_RULE_SETUP -#line 201 "glsl_lexer.lpp" +#line 203 "glsl_lexer.lpp" return MAT2X2; YY_BREAK case 50: YY_RULE_SETUP -#line 202 "glsl_lexer.lpp" +#line 204 "glsl_lexer.lpp" return MAT3X3; YY_BREAK case 51: YY_RULE_SETUP -#line 203 "glsl_lexer.lpp" +#line 205 "glsl_lexer.lpp" return MAT4X4; YY_BREAK case 52: YY_RULE_SETUP -#line 204 "glsl_lexer.lpp" +#line 206 "glsl_lexer.lpp" KEYWORD(120, 120, MAT2X2); YY_BREAK case 53: YY_RULE_SETUP -#line 205 "glsl_lexer.lpp" +#line 207 "glsl_lexer.lpp" KEYWORD(120, 120, MAT2X3); YY_BREAK case 54: YY_RULE_SETUP -#line 206 "glsl_lexer.lpp" +#line 208 "glsl_lexer.lpp" KEYWORD(120, 120, MAT2X4); YY_BREAK case 55: YY_RULE_SETUP -#line 207 "glsl_lexer.lpp" +#line 209 "glsl_lexer.lpp" KEYWORD(120, 120, MAT3X2); YY_BREAK case 56: YY_RULE_SETUP -#line 208 "glsl_lexer.lpp" +#line 210 "glsl_lexer.lpp" KEYWORD(120, 120, MAT3X3); YY_BREAK case 57: YY_RULE_SETUP -#line 209 "glsl_lexer.lpp" +#line 211 "glsl_lexer.lpp" KEYWORD(120, 120, MAT3X4); YY_BREAK case 58: YY_RULE_SETUP -#line 210 "glsl_lexer.lpp" +#line 212 "glsl_lexer.lpp" KEYWORD(120, 120, MAT4X2); YY_BREAK case 59: YY_RULE_SETUP -#line 211 "glsl_lexer.lpp" +#line 213 "glsl_lexer.lpp" KEYWORD(120, 120, MAT4X3); YY_BREAK case 60: YY_RULE_SETUP -#line 212 "glsl_lexer.lpp" +#line 214 "glsl_lexer.lpp" KEYWORD(120, 120, MAT4X4); YY_BREAK case 61: YY_RULE_SETUP -#line 214 "glsl_lexer.lpp" +#line 216 "glsl_lexer.lpp" return IN_TOK; YY_BREAK case 62: YY_RULE_SETUP -#line 215 "glsl_lexer.lpp" +#line 217 "glsl_lexer.lpp" return OUT_TOK; YY_BREAK case 63: YY_RULE_SETUP -#line 216 "glsl_lexer.lpp" +#line 218 "glsl_lexer.lpp" return INOUT_TOK; YY_BREAK case 64: YY_RULE_SETUP -#line 217 "glsl_lexer.lpp" +#line 219 "glsl_lexer.lpp" return UNIFORM; YY_BREAK case 65: YY_RULE_SETUP -#line 218 "glsl_lexer.lpp" +#line 220 "glsl_lexer.lpp" return VARYING; YY_BREAK case 66: YY_RULE_SETUP -#line 219 "glsl_lexer.lpp" +#line 221 "glsl_lexer.lpp" KEYWORD(120, 120, CENTROID); YY_BREAK case 67: YY_RULE_SETUP -#line 220 "glsl_lexer.lpp" +#line 222 "glsl_lexer.lpp" KEYWORD(120 || ES, 120 || ES, INVARIANT); YY_BREAK case 68: YY_RULE_SETUP -#line 221 "glsl_lexer.lpp" +#line 223 "glsl_lexer.lpp" KEYWORD(130 || ES, 130, FLAT); YY_BREAK case 69: YY_RULE_SETUP -#line 222 "glsl_lexer.lpp" +#line 224 "glsl_lexer.lpp" KEYWORD(130, 130, SMOOTH); YY_BREAK case 70: YY_RULE_SETUP -#line 223 "glsl_lexer.lpp" +#line 225 "glsl_lexer.lpp" KEYWORD(130, 130, NOPERSPECTIVE); YY_BREAK case 71: YY_RULE_SETUP -#line 225 "glsl_lexer.lpp" +#line 227 "glsl_lexer.lpp" return SAMPLER1D; YY_BREAK case 72: YY_RULE_SETUP -#line 226 "glsl_lexer.lpp" +#line 228 "glsl_lexer.lpp" return SAMPLER2D; YY_BREAK case 73: YY_RULE_SETUP -#line 227 "glsl_lexer.lpp" +#line 229 "glsl_lexer.lpp" return SAMPLER3D; YY_BREAK case 74: YY_RULE_SETUP -#line 228 "glsl_lexer.lpp" +#line 230 "glsl_lexer.lpp" return SAMPLERCUBE; YY_BREAK case 75: YY_RULE_SETUP -#line 229 "glsl_lexer.lpp" +#line 231 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER1DARRAY); YY_BREAK case 76: YY_RULE_SETUP -#line 230 "glsl_lexer.lpp" +#line 232 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER2DARRAY); YY_BREAK case 77: YY_RULE_SETUP -#line 231 "glsl_lexer.lpp" +#line 233 "glsl_lexer.lpp" return SAMPLER1DSHADOW; YY_BREAK case 78: YY_RULE_SETUP -#line 232 "glsl_lexer.lpp" +#line 234 "glsl_lexer.lpp" return SAMPLER2DSHADOW; YY_BREAK case 79: YY_RULE_SETUP -#line 233 "glsl_lexer.lpp" +#line 235 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLERCUBESHADOW); YY_BREAK case 80: YY_RULE_SETUP -#line 234 "glsl_lexer.lpp" +#line 236 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER1DARRAYSHADOW); YY_BREAK case 81: YY_RULE_SETUP -#line 235 "glsl_lexer.lpp" +#line 237 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER2DARRAYSHADOW); YY_BREAK case 82: YY_RULE_SETUP -#line 236 "glsl_lexer.lpp" +#line 238 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER1D); YY_BREAK case 83: YY_RULE_SETUP -#line 237 "glsl_lexer.lpp" +#line 239 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER2D); YY_BREAK case 84: YY_RULE_SETUP -#line 238 "glsl_lexer.lpp" +#line 240 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER3D); YY_BREAK case 85: YY_RULE_SETUP -#line 239 "glsl_lexer.lpp" +#line 241 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLERCUBE); YY_BREAK case 86: YY_RULE_SETUP -#line 240 "glsl_lexer.lpp" +#line 242 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER1DARRAY); YY_BREAK case 87: YY_RULE_SETUP -#line 241 "glsl_lexer.lpp" +#line 243 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER2DARRAY); YY_BREAK case 88: YY_RULE_SETUP -#line 242 "glsl_lexer.lpp" +#line 244 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER1D); YY_BREAK case 89: YY_RULE_SETUP -#line 243 "glsl_lexer.lpp" +#line 245 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER2D); YY_BREAK case 90: YY_RULE_SETUP -#line 244 "glsl_lexer.lpp" +#line 246 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER3D); YY_BREAK case 91: YY_RULE_SETUP -#line 245 "glsl_lexer.lpp" +#line 247 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLERCUBE); YY_BREAK case 92: YY_RULE_SETUP -#line 246 "glsl_lexer.lpp" +#line 248 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER1DARRAY); YY_BREAK case 93: YY_RULE_SETUP -#line 247 "glsl_lexer.lpp" +#line 249 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER2DARRAY); YY_BREAK case 94: YY_RULE_SETUP -#line 250 "glsl_lexer.lpp" +#line 252 "glsl_lexer.lpp" return STRUCT; YY_BREAK case 95: YY_RULE_SETUP -#line 251 "glsl_lexer.lpp" +#line 253 "glsl_lexer.lpp" return VOID_TOK; YY_BREAK case 96: YY_RULE_SETUP -#line 253 "glsl_lexer.lpp" +#line 255 "glsl_lexer.lpp" { if ((yyextra->language_version >= 140) + || yyextra->AMD_conservative_depth_enable || yyextra->ARB_explicit_attrib_location_enable - || (yyextra->ARB_fragment_coord_conventions_enable)){ + || yyextra->ARB_fragment_coord_conventions_enable) { return LAYOUT_TOK; } else { yylval->identifier = strdup(yytext); @@ -1954,112 +1947,112 @@ YY_RULE_SETUP YY_BREAK case 97: YY_RULE_SETUP -#line 264 "glsl_lexer.lpp" +#line 267 "glsl_lexer.lpp" return INC_OP; YY_BREAK case 98: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" +#line 268 "glsl_lexer.lpp" return DEC_OP; YY_BREAK case 99: YY_RULE_SETUP -#line 266 "glsl_lexer.lpp" +#line 269 "glsl_lexer.lpp" return LE_OP; YY_BREAK case 100: YY_RULE_SETUP -#line 267 "glsl_lexer.lpp" +#line 270 "glsl_lexer.lpp" return GE_OP; YY_BREAK case 101: YY_RULE_SETUP -#line 268 "glsl_lexer.lpp" +#line 271 "glsl_lexer.lpp" return EQ_OP; YY_BREAK case 102: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 272 "glsl_lexer.lpp" return NE_OP; YY_BREAK case 103: YY_RULE_SETUP -#line 270 "glsl_lexer.lpp" +#line 273 "glsl_lexer.lpp" return AND_OP; YY_BREAK case 104: YY_RULE_SETUP -#line 271 "glsl_lexer.lpp" +#line 274 "glsl_lexer.lpp" return OR_OP; YY_BREAK case 105: YY_RULE_SETUP -#line 272 "glsl_lexer.lpp" +#line 275 "glsl_lexer.lpp" return XOR_OP; YY_BREAK case 106: YY_RULE_SETUP -#line 273 "glsl_lexer.lpp" +#line 276 "glsl_lexer.lpp" return LEFT_OP; YY_BREAK case 107: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" +#line 277 "glsl_lexer.lpp" return RIGHT_OP; YY_BREAK case 108: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" +#line 279 "glsl_lexer.lpp" return MUL_ASSIGN; YY_BREAK case 109: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" +#line 280 "glsl_lexer.lpp" return DIV_ASSIGN; YY_BREAK case 110: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 281 "glsl_lexer.lpp" return ADD_ASSIGN; YY_BREAK case 111: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" +#line 282 "glsl_lexer.lpp" return MOD_ASSIGN; YY_BREAK case 112: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" +#line 283 "glsl_lexer.lpp" return LEFT_ASSIGN; YY_BREAK case 113: YY_RULE_SETUP -#line 281 "glsl_lexer.lpp" +#line 284 "glsl_lexer.lpp" return RIGHT_ASSIGN; YY_BREAK case 114: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" +#line 285 "glsl_lexer.lpp" return AND_ASSIGN; YY_BREAK case 115: YY_RULE_SETUP -#line 283 "glsl_lexer.lpp" +#line 286 "glsl_lexer.lpp" return XOR_ASSIGN; YY_BREAK case 116: YY_RULE_SETUP -#line 284 "glsl_lexer.lpp" +#line 287 "glsl_lexer.lpp" return OR_ASSIGN; YY_BREAK case 117: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" +#line 288 "glsl_lexer.lpp" return SUB_ASSIGN; YY_BREAK case 118: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" +#line 290 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return IS_UINT ? UINTCONSTANT : INTCONSTANT; @@ -2067,7 +2060,7 @@ YY_RULE_SETUP YY_BREAK case 119: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 294 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return IS_UINT ? UINTCONSTANT : INTCONSTANT; @@ -2075,7 +2068,7 @@ YY_RULE_SETUP YY_BREAK case 120: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" +#line 298 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return IS_UINT ? UINTCONSTANT : INTCONSTANT; @@ -2083,7 +2076,7 @@ YY_RULE_SETUP YY_BREAK case 121: YY_RULE_SETUP -#line 300 "glsl_lexer.lpp" +#line 303 "glsl_lexer.lpp" { yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; @@ -2091,7 +2084,7 @@ YY_RULE_SETUP YY_BREAK case 122: YY_RULE_SETUP -#line 304 "glsl_lexer.lpp" +#line 307 "glsl_lexer.lpp" { yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; @@ -2099,7 +2092,7 @@ YY_RULE_SETUP YY_BREAK case 123: YY_RULE_SETUP -#line 308 "glsl_lexer.lpp" +#line 311 "glsl_lexer.lpp" { yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; @@ -2107,7 +2100,7 @@ YY_RULE_SETUP YY_BREAK case 124: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 315 "glsl_lexer.lpp" { yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; @@ -2115,7 +2108,7 @@ YY_RULE_SETUP YY_BREAK case 125: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 319 "glsl_lexer.lpp" { yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; @@ -2123,7 +2116,7 @@ YY_RULE_SETUP YY_BREAK case 126: YY_RULE_SETUP -#line 321 "glsl_lexer.lpp" +#line 324 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; @@ -2131,7 +2124,7 @@ YY_RULE_SETUP YY_BREAK case 127: YY_RULE_SETUP -#line 325 "glsl_lexer.lpp" +#line 328 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; @@ -2140,427 +2133,427 @@ YY_RULE_SETUP /* Reserved words in GLSL 1.10. */ case 128: YY_RULE_SETUP -#line 332 "glsl_lexer.lpp" +#line 335 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, ASM); YY_BREAK case 129: YY_RULE_SETUP -#line 333 "glsl_lexer.lpp" +#line 336 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, CLASS); YY_BREAK case 130: YY_RULE_SETUP -#line 334 "glsl_lexer.lpp" +#line 337 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, UNION); YY_BREAK case 131: YY_RULE_SETUP -#line 335 "glsl_lexer.lpp" +#line 338 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, ENUM); YY_BREAK case 132: YY_RULE_SETUP -#line 336 "glsl_lexer.lpp" +#line 339 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, TYPEDEF); YY_BREAK case 133: YY_RULE_SETUP -#line 337 "glsl_lexer.lpp" +#line 340 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, TEMPLATE); YY_BREAK case 134: YY_RULE_SETUP -#line 338 "glsl_lexer.lpp" +#line 341 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, THIS); YY_BREAK case 135: YY_RULE_SETUP -#line 339 "glsl_lexer.lpp" +#line 342 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, PACKED_TOK); YY_BREAK case 136: YY_RULE_SETUP -#line 340 "glsl_lexer.lpp" +#line 343 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, GOTO); YY_BREAK case 137: YY_RULE_SETUP -#line 341 "glsl_lexer.lpp" +#line 344 "glsl_lexer.lpp" KEYWORD(110 || ES, 130, SWITCH); YY_BREAK case 138: YY_RULE_SETUP -#line 342 "glsl_lexer.lpp" +#line 345 "glsl_lexer.lpp" KEYWORD(110 || ES, 130, DEFAULT); YY_BREAK case 139: YY_RULE_SETUP -#line 343 "glsl_lexer.lpp" +#line 346 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, INLINE_TOK); YY_BREAK case 140: YY_RULE_SETUP -#line 344 "glsl_lexer.lpp" +#line 347 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, NOINLINE); YY_BREAK case 141: YY_RULE_SETUP -#line 345 "glsl_lexer.lpp" +#line 348 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, VOLATILE); YY_BREAK case 142: YY_RULE_SETUP -#line 346 "glsl_lexer.lpp" +#line 349 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, PUBLIC_TOK); YY_BREAK case 143: YY_RULE_SETUP -#line 347 "glsl_lexer.lpp" +#line 350 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, STATIC); YY_BREAK case 144: YY_RULE_SETUP -#line 348 "glsl_lexer.lpp" +#line 351 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, EXTERN); YY_BREAK case 145: YY_RULE_SETUP -#line 349 "glsl_lexer.lpp" +#line 352 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, EXTERNAL); YY_BREAK case 146: YY_RULE_SETUP -#line 350 "glsl_lexer.lpp" +#line 353 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, INTERFACE); YY_BREAK case 147: YY_RULE_SETUP -#line 351 "glsl_lexer.lpp" +#line 354 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, LONG_TOK); YY_BREAK case 148: YY_RULE_SETUP -#line 352 "glsl_lexer.lpp" +#line 355 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, SHORT_TOK); YY_BREAK case 149: YY_RULE_SETUP -#line 353 "glsl_lexer.lpp" +#line 356 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DOUBLE_TOK); YY_BREAK case 150: YY_RULE_SETUP -#line 354 "glsl_lexer.lpp" +#line 357 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HALF); YY_BREAK case 151: YY_RULE_SETUP -#line 355 "glsl_lexer.lpp" +#line 358 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FIXED_TOK); YY_BREAK case 152: YY_RULE_SETUP -#line 356 "glsl_lexer.lpp" +#line 359 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, UNSIGNED); YY_BREAK case 153: YY_RULE_SETUP -#line 357 "glsl_lexer.lpp" +#line 360 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, INPUT_TOK); YY_BREAK case 154: YY_RULE_SETUP -#line 358 "glsl_lexer.lpp" +#line 361 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, OUTPUT); YY_BREAK case 155: YY_RULE_SETUP -#line 359 "glsl_lexer.lpp" +#line 362 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HVEC2); YY_BREAK case 156: YY_RULE_SETUP -#line 360 "glsl_lexer.lpp" +#line 363 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HVEC3); YY_BREAK case 157: YY_RULE_SETUP -#line 361 "glsl_lexer.lpp" +#line 364 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HVEC4); YY_BREAK case 158: YY_RULE_SETUP -#line 362 "glsl_lexer.lpp" +#line 365 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DVEC2); YY_BREAK case 159: YY_RULE_SETUP -#line 363 "glsl_lexer.lpp" +#line 366 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DVEC3); YY_BREAK case 160: YY_RULE_SETUP -#line 364 "glsl_lexer.lpp" +#line 367 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DVEC4); YY_BREAK case 161: YY_RULE_SETUP -#line 365 "glsl_lexer.lpp" +#line 368 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FVEC2); YY_BREAK case 162: YY_RULE_SETUP -#line 366 "glsl_lexer.lpp" +#line 369 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FVEC3); YY_BREAK case 163: YY_RULE_SETUP -#line 367 "glsl_lexer.lpp" +#line 370 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FVEC4); YY_BREAK case 164: YY_RULE_SETUP -#line 368 "glsl_lexer.lpp" +#line 371 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK case 165: YY_RULE_SETUP -#line 369 "glsl_lexer.lpp" +#line 372 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, SAMPLER3DRECT); YY_BREAK case 166: YY_RULE_SETUP -#line 370 "glsl_lexer.lpp" +#line 373 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK case 167: YY_RULE_SETUP -#line 371 "glsl_lexer.lpp" +#line 374 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, SIZEOF); YY_BREAK case 168: YY_RULE_SETUP -#line 372 "glsl_lexer.lpp" +#line 375 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, CAST); YY_BREAK case 169: YY_RULE_SETUP -#line 373 "glsl_lexer.lpp" +#line 376 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, NAMESPACE); YY_BREAK case 170: YY_RULE_SETUP -#line 374 "glsl_lexer.lpp" +#line 377 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, USING); YY_BREAK /* Additional reserved words in GLSL 1.20. */ case 171: YY_RULE_SETUP -#line 377 "glsl_lexer.lpp" +#line 380 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, LOWP); YY_BREAK case 172: YY_RULE_SETUP -#line 378 "glsl_lexer.lpp" +#line 381 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, MEDIUMP); YY_BREAK case 173: YY_RULE_SETUP -#line 379 "glsl_lexer.lpp" +#line 382 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, HIGHP); YY_BREAK case 174: YY_RULE_SETUP -#line 380 "glsl_lexer.lpp" +#line 383 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, PRECISION); YY_BREAK /* Additional reserved words in GLSL 1.30. */ case 175: YY_RULE_SETUP -#line 383 "glsl_lexer.lpp" +#line 386 "glsl_lexer.lpp" KEYWORD(130, 130, CASE); YY_BREAK case 176: YY_RULE_SETUP -#line 384 "glsl_lexer.lpp" +#line 387 "glsl_lexer.lpp" KEYWORD(130, 999, COMMON); YY_BREAK case 177: YY_RULE_SETUP -#line 385 "glsl_lexer.lpp" +#line 388 "glsl_lexer.lpp" KEYWORD(130, 999, PARTITION); YY_BREAK case 178: YY_RULE_SETUP -#line 386 "glsl_lexer.lpp" +#line 389 "glsl_lexer.lpp" KEYWORD(130, 999, ACTIVE); YY_BREAK case 179: YY_RULE_SETUP -#line 387 "glsl_lexer.lpp" +#line 390 "glsl_lexer.lpp" KEYWORD(130 || ES, 999, SUPERP); YY_BREAK case 180: YY_RULE_SETUP -#line 388 "glsl_lexer.lpp" +#line 391 "glsl_lexer.lpp" KEYWORD(130, 140, SAMPLERBUFFER); YY_BREAK case 181: YY_RULE_SETUP -#line 389 "glsl_lexer.lpp" +#line 392 "glsl_lexer.lpp" KEYWORD(130, 999, FILTER); YY_BREAK case 182: YY_RULE_SETUP -#line 390 "glsl_lexer.lpp" +#line 393 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1D); YY_BREAK case 183: YY_RULE_SETUP -#line 391 "glsl_lexer.lpp" +#line 394 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2D); YY_BREAK case 184: YY_RULE_SETUP -#line 392 "glsl_lexer.lpp" +#line 395 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE3D); YY_BREAK case 185: YY_RULE_SETUP -#line 393 "glsl_lexer.lpp" +#line 396 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGECUBE); YY_BREAK case 186: YY_RULE_SETUP -#line 394 "glsl_lexer.lpp" +#line 397 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE1D); YY_BREAK case 187: YY_RULE_SETUP -#line 395 "glsl_lexer.lpp" +#line 398 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE2D); YY_BREAK case 188: YY_RULE_SETUP -#line 396 "glsl_lexer.lpp" +#line 399 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE3D); YY_BREAK case 189: YY_RULE_SETUP -#line 397 "glsl_lexer.lpp" +#line 400 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGECUBE); YY_BREAK case 190: YY_RULE_SETUP -#line 398 "glsl_lexer.lpp" +#line 401 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE1D); YY_BREAK case 191: YY_RULE_SETUP -#line 399 "glsl_lexer.lpp" +#line 402 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE2D); YY_BREAK case 192: YY_RULE_SETUP -#line 400 "glsl_lexer.lpp" +#line 403 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE3D); YY_BREAK case 193: YY_RULE_SETUP -#line 401 "glsl_lexer.lpp" +#line 404 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGECUBE); YY_BREAK case 194: YY_RULE_SETUP -#line 402 "glsl_lexer.lpp" +#line 405 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1DARRAY); YY_BREAK case 195: YY_RULE_SETUP -#line 403 "glsl_lexer.lpp" +#line 406 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2DARRAY); YY_BREAK case 196: YY_RULE_SETUP -#line 404 "glsl_lexer.lpp" +#line 407 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE1DARRAY); YY_BREAK case 197: YY_RULE_SETUP -#line 405 "glsl_lexer.lpp" +#line 408 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE2DARRAY); YY_BREAK case 198: YY_RULE_SETUP -#line 406 "glsl_lexer.lpp" +#line 409 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE1DARRAY); YY_BREAK case 199: YY_RULE_SETUP -#line 407 "glsl_lexer.lpp" +#line 410 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE2DARRAY); YY_BREAK case 200: YY_RULE_SETUP -#line 408 "glsl_lexer.lpp" +#line 411 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1DSHADOW); YY_BREAK case 201: YY_RULE_SETUP -#line 409 "glsl_lexer.lpp" +#line 412 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2DSHADOW); YY_BREAK case 202: YY_RULE_SETUP -#line 410 "glsl_lexer.lpp" +#line 413 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1DARRAYSHADOW); YY_BREAK case 203: YY_RULE_SETUP -#line 411 "glsl_lexer.lpp" +#line 414 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2DARRAYSHADOW); YY_BREAK case 204: YY_RULE_SETUP -#line 412 "glsl_lexer.lpp" +#line 415 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGEBUFFER); YY_BREAK case 205: YY_RULE_SETUP -#line 413 "glsl_lexer.lpp" +#line 416 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGEBUFFER); YY_BREAK case 206: YY_RULE_SETUP -#line 414 "glsl_lexer.lpp" +#line 417 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGEBUFFER); YY_BREAK case 207: YY_RULE_SETUP -#line 415 "glsl_lexer.lpp" +#line 418 "glsl_lexer.lpp" KEYWORD(130, 999, ROW_MAJOR); YY_BREAK case 208: YY_RULE_SETUP -#line 417 "glsl_lexer.lpp" +#line 420 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; - yylval->identifier = talloc_strdup(ctx, yytext); - return IDENTIFIER; + yylval->identifier = ralloc_strdup(ctx, yytext); + return classify_identifier(state, yytext); } YY_BREAK case 209: YY_RULE_SETUP -#line 424 "glsl_lexer.lpp" +#line 427 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK case 210: YY_RULE_SETUP -#line 426 "glsl_lexer.lpp" +#line 429 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2564 "glsl_lexer.cpp" +#line 2557 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): case YY_STATE_EOF(PRAGMA): @@ -3296,8 +3289,8 @@ YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscann /** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3703,9 +3696,20 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 426 "glsl_lexer.lpp" +#line 429 "glsl_lexer.lpp" + +int +classify_identifier(struct _mesa_glsl_parse_state *state, const char *name) +{ + if (state->symbols->get_variable(name) || state->symbols->get_function(name)) + return IDENTIFIER; + else if (state->symbols->get_type(name)) + return TYPE_IDENTIFIER; + else + return NEW_IDENTIFIER; +} void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string) diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index d30759be2b8..e4c469f9e0a 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -27,6 +27,8 @@ #include "glsl_parser_extras.h" #include "glsl_parser.h" +static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); + #define YY_USER_ACTION \ do { \ yylloc->source = 0; \ @@ -62,7 +64,7 @@ return ERROR_TOK; \ } else { \ yylval->identifier = strdup(yytext); \ - return IDENTIFIER; \ + return classify_identifier(yyextra, yytext); \ } \ } while (0) @@ -252,8 +254,9 @@ void return VOID_TOK; layout { if ((yyextra->language_version >= 140) + || yyextra->AMD_conservative_depth_enable || yyextra->ARB_explicit_attrib_location_enable - || (yyextra->ARB_fragment_coord_conventions_enable)){ + || yyextra->ARB_fragment_coord_conventions_enable) { return LAYOUT_TOK; } else { yylval->identifier = strdup(yytext); @@ -417,14 +420,25 @@ row_major KEYWORD(130, 999, ROW_MAJOR); [_a-zA-Z][_a-zA-Z0-9]* { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; - yylval->identifier = talloc_strdup(ctx, yytext); - return IDENTIFIER; + yylval->identifier = ralloc_strdup(ctx, yytext); + return classify_identifier(state, yytext); } . { return yytext[0]; } %% +int +classify_identifier(struct _mesa_glsl_parse_state *state, const char *name) +{ + if (state->symbols->get_variable(name) || state->symbols->get_function(name)) + return IDENTIFIER; + else if (state->symbols->get_type(name)) + return TYPE_IDENTIFIER; + else + return NEW_IDENTIFIER; +} + void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string) { diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 8b196ae7fc6..1db7e901a96 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -214,123 +214,125 @@ VOID_TOK = 329, WHILE = 330, IDENTIFIER = 331, - FLOATCONSTANT = 332, - INTCONSTANT = 333, - UINTCONSTANT = 334, - BOOLCONSTANT = 335, - FIELD_SELECTION = 336, - LEFT_OP = 337, - RIGHT_OP = 338, - INC_OP = 339, - DEC_OP = 340, - LE_OP = 341, - GE_OP = 342, - EQ_OP = 343, - NE_OP = 344, - AND_OP = 345, - OR_OP = 346, - XOR_OP = 347, - MUL_ASSIGN = 348, - DIV_ASSIGN = 349, - ADD_ASSIGN = 350, - MOD_ASSIGN = 351, - LEFT_ASSIGN = 352, - RIGHT_ASSIGN = 353, - AND_ASSIGN = 354, - XOR_ASSIGN = 355, - OR_ASSIGN = 356, - SUB_ASSIGN = 357, - INVARIANT = 358, - LOWP = 359, - MEDIUMP = 360, - HIGHP = 361, - SUPERP = 362, - PRECISION = 363, - VERSION = 364, - EXTENSION = 365, - LINE = 366, - COLON = 367, - EOL = 368, - INTERFACE = 369, - OUTPUT = 370, - PRAGMA_DEBUG_ON = 371, - PRAGMA_DEBUG_OFF = 372, - PRAGMA_OPTIMIZE_ON = 373, - PRAGMA_OPTIMIZE_OFF = 374, - PRAGMA_INVARIANT_ALL = 375, - LAYOUT_TOK = 376, - ASM = 377, - CLASS = 378, - UNION = 379, - ENUM = 380, - TYPEDEF = 381, - TEMPLATE = 382, - THIS = 383, - PACKED_TOK = 384, - GOTO = 385, - INLINE_TOK = 386, - NOINLINE = 387, - VOLATILE = 388, - PUBLIC_TOK = 389, - STATIC = 390, - EXTERN = 391, - EXTERNAL = 392, - LONG_TOK = 393, - SHORT_TOK = 394, - DOUBLE_TOK = 395, - HALF = 396, - FIXED_TOK = 397, - UNSIGNED = 398, - INPUT_TOK = 399, - OUPTUT = 400, - HVEC2 = 401, - HVEC3 = 402, - HVEC4 = 403, - DVEC2 = 404, - DVEC3 = 405, - DVEC4 = 406, - FVEC2 = 407, - FVEC3 = 408, - FVEC4 = 409, - SAMPLER2DRECT = 410, - SAMPLER3DRECT = 411, - SAMPLER2DRECTSHADOW = 412, - SIZEOF = 413, - CAST = 414, - NAMESPACE = 415, - USING = 416, - ERROR_TOK = 417, - COMMON = 418, - PARTITION = 419, - ACTIVE = 420, - SAMPLERBUFFER = 421, - FILTER = 422, - IMAGE1D = 423, - IMAGE2D = 424, - IMAGE3D = 425, - IMAGECUBE = 426, - IMAGE1DARRAY = 427, - IMAGE2DARRAY = 428, - IIMAGE1D = 429, - IIMAGE2D = 430, - IIMAGE3D = 431, - IIMAGECUBE = 432, - IIMAGE1DARRAY = 433, - IIMAGE2DARRAY = 434, - UIMAGE1D = 435, - UIMAGE2D = 436, - UIMAGE3D = 437, - UIMAGECUBE = 438, - UIMAGE1DARRAY = 439, - UIMAGE2DARRAY = 440, - IMAGE1DSHADOW = 441, - IMAGE2DSHADOW = 442, - IMAGEBUFFER = 443, - IIMAGEBUFFER = 444, - UIMAGEBUFFER = 445, - IMAGE1DARRAYSHADOW = 446, - IMAGE2DARRAYSHADOW = 447, - ROW_MAJOR = 448 + TYPE_IDENTIFIER = 332, + NEW_IDENTIFIER = 333, + FLOATCONSTANT = 334, + INTCONSTANT = 335, + UINTCONSTANT = 336, + BOOLCONSTANT = 337, + FIELD_SELECTION = 338, + LEFT_OP = 339, + RIGHT_OP = 340, + INC_OP = 341, + DEC_OP = 342, + LE_OP = 343, + GE_OP = 344, + EQ_OP = 345, + NE_OP = 346, + AND_OP = 347, + OR_OP = 348, + XOR_OP = 349, + MUL_ASSIGN = 350, + DIV_ASSIGN = 351, + ADD_ASSIGN = 352, + MOD_ASSIGN = 353, + LEFT_ASSIGN = 354, + RIGHT_ASSIGN = 355, + AND_ASSIGN = 356, + XOR_ASSIGN = 357, + OR_ASSIGN = 358, + SUB_ASSIGN = 359, + INVARIANT = 360, + LOWP = 361, + MEDIUMP = 362, + HIGHP = 363, + SUPERP = 364, + PRECISION = 365, + VERSION = 366, + EXTENSION = 367, + LINE = 368, + COLON = 369, + EOL = 370, + INTERFACE = 371, + OUTPUT = 372, + PRAGMA_DEBUG_ON = 373, + PRAGMA_DEBUG_OFF = 374, + PRAGMA_OPTIMIZE_ON = 375, + PRAGMA_OPTIMIZE_OFF = 376, + PRAGMA_INVARIANT_ALL = 377, + LAYOUT_TOK = 378, + ASM = 379, + CLASS = 380, + UNION = 381, + ENUM = 382, + TYPEDEF = 383, + TEMPLATE = 384, + THIS = 385, + PACKED_TOK = 386, + GOTO = 387, + INLINE_TOK = 388, + NOINLINE = 389, + VOLATILE = 390, + PUBLIC_TOK = 391, + STATIC = 392, + EXTERN = 393, + EXTERNAL = 394, + LONG_TOK = 395, + SHORT_TOK = 396, + DOUBLE_TOK = 397, + HALF = 398, + FIXED_TOK = 399, + UNSIGNED = 400, + INPUT_TOK = 401, + OUPTUT = 402, + HVEC2 = 403, + HVEC3 = 404, + HVEC4 = 405, + DVEC2 = 406, + DVEC3 = 407, + DVEC4 = 408, + FVEC2 = 409, + FVEC3 = 410, + FVEC4 = 411, + SAMPLER2DRECT = 412, + SAMPLER3DRECT = 413, + SAMPLER2DRECTSHADOW = 414, + SIZEOF = 415, + CAST = 416, + NAMESPACE = 417, + USING = 418, + ERROR_TOK = 419, + COMMON = 420, + PARTITION = 421, + ACTIVE = 422, + SAMPLERBUFFER = 423, + FILTER = 424, + IMAGE1D = 425, + IMAGE2D = 426, + IMAGE3D = 427, + IMAGECUBE = 428, + IMAGE1DARRAY = 429, + IMAGE2DARRAY = 430, + IIMAGE1D = 431, + IIMAGE2D = 432, + IIMAGE3D = 433, + IIMAGECUBE = 434, + IIMAGE1DARRAY = 435, + IIMAGE2DARRAY = 436, + UIMAGE1D = 437, + UIMAGE2D = 438, + UIMAGE3D = 439, + UIMAGECUBE = 440, + UIMAGE1DARRAY = 441, + UIMAGE2DARRAY = 442, + IMAGE1DSHADOW = 443, + IMAGE2DSHADOW = 444, + IMAGEBUFFER = 445, + IIMAGEBUFFER = 446, + UIMAGEBUFFER = 447, + IMAGE1DARRAYSHADOW = 448, + IMAGE2DARRAYSHADOW = 449, + ROW_MAJOR = 450 }; #endif @@ -374,7 +376,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 378 "glsl_parser.cpp" +#line 380 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -399,7 +401,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 403 "glsl_parser.cpp" +#line 405 "glsl_parser.cpp" #ifdef short # undef short @@ -616,20 +618,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 3738 +#define YYLAST 3692 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 218 +#define YYNTOKENS 220 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 87 +#define YYNNTS 93 /* YYNRULES -- Number of rules. */ -#define YYNRULES 279 +#define YYNRULES 291 /* YYNRULES -- Number of states. */ -#define YYNSTATES 415 +#define YYNSTATES 434 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 448 +#define YYMAXUTOK 450 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -640,16 +642,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 202, 2, 2, 2, 206, 209, 2, - 194, 195, 204, 200, 199, 201, 198, 205, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 213, 215, - 207, 214, 208, 212, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 204, 2, 2, 2, 208, 211, 2, + 196, 197, 206, 202, 201, 203, 200, 207, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 215, 217, + 209, 216, 210, 214, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 196, 2, 197, 210, 2, 2, 2, 2, 2, + 2, 198, 2, 199, 212, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 216, 211, 217, 203, 2, 2, 2, + 2, 2, 2, 218, 213, 219, 205, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -681,7 +683,8 @@ static const yytype_uint8 yytranslate[] = 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193 + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195 }; #if YYDEBUG @@ -690,151 +693,158 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 9, 10, 14, 17, 20, 23, - 26, 29, 30, 33, 39, 41, 44, 46, 48, 50, - 52, 54, 56, 60, 62, 67, 69, 73, 76, 79, - 81, 83, 85, 89, 92, 95, 98, 100, 103, 107, - 110, 112, 114, 116, 118, 121, 124, 127, 129, 131, - 133, 135, 137, 141, 145, 149, 151, 155, 159, 161, - 165, 169, 171, 175, 179, 183, 187, 189, 193, 197, - 199, 203, 205, 209, 211, 215, 217, 221, 223, 227, - 229, 233, 235, 241, 243, 247, 249, 251, 253, 255, - 257, 259, 261, 263, 265, 267, 269, 271, 275, 277, - 280, 283, 288, 291, 293, 295, 298, 302, 306, 309, - 315, 319, 322, 326, 329, 330, 332, 334, 336, 338, - 340, 344, 350, 357, 365, 374, 380, 382, 385, 390, - 396, 403, 411, 416, 419, 421, 424, 429, 431, 435, - 437, 441, 443, 445, 447, 449, 451, 453, 456, 458, - 461, 464, 468, 470, 472, 474, 476, 479, 481, 483, - 486, 489, 491, 493, 496, 498, 502, 507, 509, 511, - 513, 515, 517, 519, 521, 523, 525, 527, 529, 531, - 533, 535, 537, 539, 541, 543, 545, 547, 549, 551, - 553, 555, 557, 559, 561, 563, 565, 567, 569, 571, - 573, 575, 577, 579, 581, 583, 585, 587, 589, 591, - 593, 595, 597, 599, 601, 603, 605, 607, 609, 611, - 613, 615, 617, 619, 621, 627, 632, 634, 637, 641, - 643, 647, 649, 654, 656, 658, 660, 662, 664, 666, - 668, 670, 672, 674, 676, 679, 683, 685, 687, 690, - 694, 696, 699, 701, 704, 710, 714, 716, 718, 723, - 729, 733, 736, 742, 750, 757, 759, 761, 763, 764, - 767, 771, 774, 777, 780, 784, 787, 789, 791, 793 + 26, 29, 30, 33, 35, 37, 39, 45, 47, 50, + 52, 54, 56, 58, 60, 62, 64, 68, 70, 75, + 77, 81, 84, 87, 89, 91, 93, 97, 100, 103, + 106, 108, 111, 115, 118, 120, 122, 124, 127, 130, + 133, 135, 138, 142, 145, 147, 150, 153, 156, 158, + 160, 162, 164, 166, 170, 174, 178, 180, 184, 188, + 190, 194, 198, 200, 204, 208, 212, 216, 218, 222, + 226, 228, 232, 234, 238, 240, 244, 246, 250, 252, + 256, 258, 262, 264, 270, 272, 276, 278, 280, 282, + 284, 286, 288, 290, 292, 294, 296, 298, 300, 304, + 306, 309, 312, 317, 320, 322, 324, 327, 331, 335, + 338, 344, 348, 351, 355, 358, 359, 361, 363, 365, + 367, 369, 373, 379, 386, 394, 403, 409, 411, 414, + 419, 425, 432, 440, 445, 448, 450, 453, 458, 460, + 464, 466, 470, 472, 474, 476, 478, 480, 482, 485, + 487, 490, 493, 497, 499, 501, 503, 505, 508, 510, + 512, 515, 518, 520, 522, 525, 527, 531, 536, 538, + 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, + 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, + 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, + 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, + 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, + 640, 642, 644, 646, 648, 650, 656, 661, 663, 666, + 670, 672, 676, 678, 683, 685, 687, 689, 691, 693, + 695, 697, 699, 701, 703, 705, 708, 709, 714, 716, + 718, 721, 725, 727, 730, 732, 735, 741, 745, 747, + 749, 754, 760, 764, 767, 773, 781, 788, 790, 792, + 794, 795, 798, 802, 805, 808, 811, 815, 818, 820, + 822, 824 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 219, 0, -1, -1, 221, 223, 220, 225, -1, -1, - 109, 78, 113, -1, 116, 113, -1, 117, 113, -1, - 118, 113, -1, 119, 113, -1, 120, 113, -1, -1, - 223, 224, -1, 110, 76, 112, 76, 113, -1, 303, - -1, 225, 303, -1, 76, -1, 226, -1, 78, -1, - 79, -1, 77, -1, 80, -1, 194, 253, 195, -1, - 227, -1, 228, 196, 229, 197, -1, 230, -1, 228, - 198, 76, -1, 228, 84, -1, 228, 85, -1, 253, - -1, 231, -1, 232, -1, 228, 198, 232, -1, 234, - 195, -1, 233, 195, -1, 235, 74, -1, 235, -1, - 235, 251, -1, 234, 199, 251, -1, 236, 194, -1, - 274, -1, 76, -1, 81, -1, 228, -1, 84, 237, - -1, 85, 237, -1, 238, 237, -1, 200, -1, 201, - -1, 202, -1, 203, -1, 237, -1, 239, 204, 237, - -1, 239, 205, 237, -1, 239, 206, 237, -1, 239, - -1, 240, 200, 239, -1, 240, 201, 239, -1, 240, - -1, 241, 82, 240, -1, 241, 83, 240, -1, 241, - -1, 242, 207, 241, -1, 242, 208, 241, -1, 242, - 86, 241, -1, 242, 87, 241, -1, 242, -1, 243, - 88, 242, -1, 243, 89, 242, -1, 243, -1, 244, - 209, 243, -1, 244, -1, 245, 210, 244, -1, 245, - -1, 246, 211, 245, -1, 246, -1, 247, 90, 246, - -1, 247, -1, 248, 92, 247, -1, 248, -1, 249, - 91, 248, -1, 249, -1, 249, 212, 253, 213, 251, - -1, 250, -1, 237, 252, 251, -1, 214, -1, 93, - -1, 94, -1, 96, -1, 95, -1, 102, -1, 97, - -1, 98, -1, 99, -1, 100, -1, 101, -1, 251, - -1, 253, 199, 251, -1, 250, -1, 256, 215, -1, - 264, 215, -1, 108, 278, 275, 215, -1, 257, 195, - -1, 259, -1, 258, -1, 259, 261, -1, 258, 199, - 261, -1, 266, 76, 194, -1, 274, 76, -1, 274, - 76, 196, 254, 197, -1, 271, 262, 260, -1, 262, - 260, -1, 271, 262, 263, -1, 262, 263, -1, -1, - 33, -1, 34, -1, 35, -1, 274, -1, 265, -1, - 264, 199, 76, -1, 264, 199, 76, 196, 197, -1, - 264, 199, 76, 196, 254, 197, -1, 264, 199, 76, - 196, 197, 214, 284, -1, 264, 199, 76, 196, 254, - 197, 214, 284, -1, 264, 199, 76, 214, 284, -1, - 266, -1, 266, 76, -1, 266, 76, 196, 197, -1, - 266, 76, 196, 254, 197, -1, 266, 76, 196, 197, - 214, 284, -1, 266, 76, 196, 254, 197, 214, 284, - -1, 266, 76, 214, 284, -1, 103, 76, -1, 274, - -1, 272, 274, -1, 121, 194, 268, 195, -1, 269, - -1, 268, 199, 269, -1, 76, -1, 76, 214, 78, - -1, 40, -1, 39, -1, 38, -1, 4, -1, 273, - -1, 267, -1, 267, 273, -1, 270, -1, 270, 273, - -1, 103, 273, -1, 103, 270, 273, -1, 103, -1, - 4, -1, 3, -1, 37, -1, 32, 37, -1, 33, - -1, 34, -1, 32, 33, -1, 32, 34, -1, 36, - -1, 275, -1, 278, 275, -1, 276, -1, 276, 196, - 197, -1, 276, 196, 254, 197, -1, 277, -1, 279, - -1, 76, -1, 74, -1, 6, -1, 7, -1, 8, - -1, 5, -1, 29, -1, 30, -1, 31, -1, 20, - -1, 21, -1, 22, -1, 23, -1, 24, -1, 25, - -1, 26, -1, 27, -1, 28, -1, 41, -1, 42, - -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, - -1, 48, -1, 49, -1, 50, -1, 51, -1, 155, - -1, 52, -1, 53, -1, 54, -1, 55, -1, 157, - -1, 56, -1, 57, -1, 58, -1, 59, -1, 60, - -1, 61, -1, 62, -1, 63, -1, 64, -1, 65, - -1, 66, -1, 67, -1, 68, -1, 69, -1, 70, - -1, 71, -1, 72, -1, 106, -1, 105, -1, 104, - -1, 73, 76, 216, 280, 217, -1, 73, 216, 280, - 217, -1, 281, -1, 280, 281, -1, 274, 282, 215, - -1, 283, -1, 282, 199, 283, -1, 76, -1, 76, - 196, 254, 197, -1, 251, -1, 255, -1, 288, -1, - 287, -1, 285, -1, 292, -1, 293, -1, 296, -1, - 297, -1, 298, -1, 302, -1, 216, 217, -1, 216, - 291, 217, -1, 290, -1, 287, -1, 216, 217, -1, - 216, 291, 217, -1, 286, -1, 291, 286, -1, 215, - -1, 253, 215, -1, 14, 194, 253, 195, 294, -1, - 286, 12, 286, -1, 286, -1, 253, -1, 266, 76, - 214, 284, -1, 17, 194, 253, 195, 288, -1, 18, - 253, 213, -1, 19, 213, -1, 75, 194, 295, 195, - 289, -1, 11, 286, 75, 194, 253, 195, 215, -1, - 13, 194, 299, 301, 195, 289, -1, 292, -1, 285, - -1, 295, -1, -1, 300, 215, -1, 300, 215, 253, - -1, 10, 215, -1, 9, 215, -1, 16, 215, -1, - 16, 253, 215, -1, 15, 215, -1, 304, -1, 255, - -1, 222, -1, 256, 290, -1 + 221, 0, -1, -1, 223, 225, 222, 228, -1, -1, + 111, 80, 115, -1, 118, 115, -1, 119, 115, -1, + 120, 115, -1, 121, 115, -1, 122, 115, -1, -1, + 225, 227, -1, 76, -1, 77, -1, 78, -1, 112, + 226, 114, 226, 115, -1, 311, -1, 228, 311, -1, + 76, -1, 78, -1, 229, -1, 80, -1, 81, -1, + 79, -1, 82, -1, 196, 260, 197, -1, 230, -1, + 231, 198, 232, 199, -1, 233, -1, 231, 200, 226, + -1, 231, 86, -1, 231, 87, -1, 260, -1, 234, + -1, 235, -1, 231, 200, 240, -1, 237, 197, -1, + 236, 197, -1, 238, 74, -1, 238, -1, 238, 258, + -1, 237, 201, 258, -1, 239, 196, -1, 281, -1, + 229, -1, 83, -1, 242, 197, -1, 241, 197, -1, + 243, 74, -1, 243, -1, 243, 258, -1, 242, 201, + 258, -1, 229, 196, -1, 231, -1, 86, 244, -1, + 87, 244, -1, 245, 244, -1, 202, -1, 203, -1, + 204, -1, 205, -1, 244, -1, 246, 206, 244, -1, + 246, 207, 244, -1, 246, 208, 244, -1, 246, -1, + 247, 202, 246, -1, 247, 203, 246, -1, 247, -1, + 248, 84, 247, -1, 248, 85, 247, -1, 248, -1, + 249, 209, 248, -1, 249, 210, 248, -1, 249, 88, + 248, -1, 249, 89, 248, -1, 249, -1, 250, 90, + 249, -1, 250, 91, 249, -1, 250, -1, 251, 211, + 250, -1, 251, -1, 252, 212, 251, -1, 252, -1, + 253, 213, 252, -1, 253, -1, 254, 92, 253, -1, + 254, -1, 255, 94, 254, -1, 255, -1, 256, 93, + 255, -1, 256, -1, 256, 214, 260, 215, 258, -1, + 257, -1, 244, 259, 258, -1, 216, -1, 95, -1, + 96, -1, 98, -1, 97, -1, 104, -1, 99, -1, + 100, -1, 101, -1, 102, -1, 103, -1, 258, -1, + 260, 201, 258, -1, 257, -1, 263, 217, -1, 271, + 217, -1, 110, 285, 282, 217, -1, 264, 197, -1, + 266, -1, 265, -1, 266, 268, -1, 265, 201, 268, + -1, 273, 229, 196, -1, 281, 226, -1, 281, 226, + 198, 261, 199, -1, 278, 269, 267, -1, 269, 267, + -1, 278, 269, 270, -1, 269, 270, -1, -1, 33, + -1, 34, -1, 35, -1, 281, -1, 272, -1, 271, + 201, 226, -1, 271, 201, 226, 198, 199, -1, 271, + 201, 226, 198, 261, 199, -1, 271, 201, 226, 198, + 199, 216, 291, -1, 271, 201, 226, 198, 261, 199, + 216, 291, -1, 271, 201, 226, 216, 291, -1, 273, + -1, 273, 226, -1, 273, 226, 198, 199, -1, 273, + 226, 198, 261, 199, -1, 273, 226, 198, 199, 216, + 291, -1, 273, 226, 198, 261, 199, 216, 291, -1, + 273, 226, 216, 291, -1, 105, 229, -1, 281, -1, + 279, 281, -1, 123, 196, 275, 197, -1, 276, -1, + 275, 201, 276, -1, 226, -1, 226, 216, 80, -1, + 40, -1, 39, -1, 38, -1, 4, -1, 280, -1, + 274, -1, 274, 280, -1, 277, -1, 277, 280, -1, + 105, 280, -1, 105, 277, 280, -1, 105, -1, 4, + -1, 3, -1, 37, -1, 32, 37, -1, 33, -1, + 34, -1, 32, 33, -1, 32, 34, -1, 36, -1, + 282, -1, 285, 282, -1, 283, -1, 283, 198, 199, + -1, 283, 198, 261, 199, -1, 284, -1, 286, -1, + 77, -1, 74, -1, 6, -1, 7, -1, 8, -1, + 5, -1, 29, -1, 30, -1, 31, -1, 20, -1, + 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, + 26, -1, 27, -1, 28, -1, 41, -1, 42, -1, + 43, -1, 44, -1, 45, -1, 46, -1, 47, -1, + 48, -1, 49, -1, 50, -1, 51, -1, 157, -1, + 52, -1, 53, -1, 54, -1, 55, -1, 159, -1, + 56, -1, 57, -1, 58, -1, 59, -1, 60, -1, + 61, -1, 62, -1, 63, -1, 64, -1, 65, -1, + 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, + 71, -1, 72, -1, 108, -1, 107, -1, 106, -1, + 73, 226, 218, 287, 219, -1, 73, 218, 287, 219, + -1, 288, -1, 287, 288, -1, 281, 289, 217, -1, + 290, -1, 289, 201, 290, -1, 226, -1, 226, 198, + 261, 199, -1, 258, -1, 262, -1, 295, -1, 294, + -1, 292, -1, 300, -1, 301, -1, 304, -1, 305, + -1, 306, -1, 310, -1, 218, 219, -1, -1, 218, + 296, 299, 219, -1, 298, -1, 294, -1, 218, 219, + -1, 218, 299, 219, -1, 293, -1, 299, 293, -1, + 217, -1, 260, 217, -1, 14, 196, 260, 197, 302, + -1, 293, 12, 293, -1, 293, -1, 260, -1, 273, + 226, 216, 291, -1, 17, 196, 260, 197, 295, -1, + 18, 260, 215, -1, 19, 215, -1, 75, 196, 303, + 197, 297, -1, 11, 293, 75, 196, 260, 197, 217, + -1, 13, 196, 307, 309, 197, 297, -1, 300, -1, + 292, -1, 303, -1, -1, 308, 217, -1, 308, 217, + 260, -1, 10, 217, -1, 9, 217, -1, 16, 217, + -1, 16, 260, 217, -1, 15, 217, -1, 312, -1, + 262, -1, 224, -1, 263, 298, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 213, 213, 212, 219, 221, 246, 247, 248, 249, - 250, 262, 264, 268, 277, 285, 296, 300, 307, 314, - 321, 328, 335, 342, 343, 349, 353, 360, 366, 375, - 379, 383, 384, 393, 394, 398, 399, 403, 409, 421, - 425, 431, 438, 449, 450, 456, 462, 472, 473, 474, - 475, 479, 480, 486, 492, 501, 502, 508, 517, 518, - 524, 533, 534, 540, 546, 552, 561, 562, 568, 577, - 578, 587, 588, 597, 598, 607, 608, 617, 618, 627, - 628, 637, 638, 647, 648, 657, 658, 659, 660, 661, - 662, 663, 664, 665, 666, 667, 671, 675, 691, 695, - 699, 703, 712, 716, 717, 721, 726, 734, 745, 755, - 770, 777, 782, 793, 806, 809, 814, 819, 828, 832, - 833, 842, 851, 860, 869, 878, 891, 902, 911, 920, - 929, 938, 947, 956, 970, 977, 988, 995, 996, 1015, - 1044, 1085, 1090, 1095, 1103, 1111, 1112, 1113, 1118, 1119, - 1124, 1129, 1135, 1143, 1148, 1153, 1158, 1164, 1169, 1174, - 1179, 1184, 1192, 1196, 1204, 1205, 1211, 1220, 1226, 1232, - 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, - 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, - 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, - 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280, - 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, - 1291, 1295, 1305, 1315, 1328, 1334, 1343, 1348, 1356, 1371, - 1376, 1384, 1390, 1399, 1403, 1409, 1410, 1414, 1415, 1416, - 1417, 1418, 1419, 1420, 1424, 1430, 1439, 1440, 1444, 1450, - 1459, 1469, 1481, 1487, 1496, 1505, 1510, 1518, 1522, 1536, - 1540, 1541, 1545, 1552, 1559, 1569, 1570, 1574, 1576, 1582, - 1587, 1596, 1602, 1608, 1614, 1620, 1629, 1630, 1631, 1635 + 0, 218, 218, 217, 229, 231, 271, 272, 273, 274, + 275, 287, 289, 293, 294, 295, 299, 308, 316, 327, + 328, 332, 339, 346, 353, 360, 367, 374, 375, 381, + 385, 392, 398, 407, 411, 415, 416, 425, 426, 430, + 431, 435, 441, 453, 457, 463, 470, 480, 481, 485, + 486, 490, 496, 508, 519, 520, 526, 532, 542, 543, + 544, 545, 549, 550, 556, 562, 571, 572, 578, 587, + 588, 594, 603, 604, 610, 616, 622, 631, 632, 638, + 647, 648, 657, 658, 667, 668, 677, 678, 687, 688, + 697, 698, 707, 708, 717, 718, 727, 728, 729, 730, + 731, 732, 733, 734, 735, 736, 737, 741, 745, 761, + 765, 770, 774, 783, 787, 788, 792, 797, 805, 819, + 829, 844, 851, 856, 867, 880, 883, 888, 893, 902, + 906, 907, 917, 927, 937, 947, 957, 971, 982, 991, + 1000, 1009, 1018, 1027, 1036, 1050, 1057, 1068, 1075, 1076, + 1095, 1147, 1188, 1193, 1198, 1206, 1214, 1215, 1216, 1221, + 1222, 1227, 1232, 1238, 1246, 1251, 1256, 1261, 1267, 1272, + 1277, 1282, 1287, 1295, 1299, 1307, 1308, 1314, 1323, 1329, + 1335, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, + 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362, + 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372, + 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, + 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, + 1393, 1394, 1398, 1408, 1418, 1431, 1438, 1447, 1452, 1460, + 1475, 1480, 1488, 1495, 1504, 1508, 1514, 1515, 1519, 1520, + 1521, 1522, 1523, 1524, 1525, 1529, 1536, 1535, 1549, 1550, + 1554, 1560, 1569, 1579, 1591, 1597, 1606, 1615, 1620, 1628, + 1632, 1646, 1650, 1651, 1655, 1662, 1669, 1679, 1680, 1684, + 1686, 1692, 1697, 1706, 1712, 1718, 1724, 1730, 1739, 1740, + 1741, 1745 }; #endif @@ -857,38 +867,41 @@ static const char *const yytname[] = "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", "USAMPLER2DARRAY", "STRUCT", "VOID_TOK", "WHILE", "IDENTIFIER", - "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", - "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", - "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", - "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", - "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", - "LOWP", "MEDIUMP", "HIGHP", "SUPERP", "PRECISION", "VERSION", - "EXTENSION", "LINE", "COLON", "EOL", "INTERFACE", "OUTPUT", - "PRAGMA_DEBUG_ON", "PRAGMA_DEBUG_OFF", "PRAGMA_OPTIMIZE_ON", - "PRAGMA_OPTIMIZE_OFF", "PRAGMA_INVARIANT_ALL", "LAYOUT_TOK", "ASM", - "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", "THIS", "PACKED_TOK", - "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", - "EXTERN", "EXTERNAL", "LONG_TOK", "SHORT_TOK", "DOUBLE_TOK", "HALF", - "FIXED_TOK", "UNSIGNED", "INPUT_TOK", "OUPTUT", "HVEC2", "HVEC3", - "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4", - "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF", - "CAST", "NAMESPACE", "USING", "ERROR_TOK", "COMMON", "PARTITION", - "ACTIVE", "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", "IMAGE3D", - "IMAGECUBE", "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", - "IIMAGE3D", "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", - "UIMAGE2D", "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", - "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER", - "UIMAGEBUFFER", "IMAGE1DARRAYSHADOW", "IMAGE2DARRAYSHADOW", "ROW_MAJOR", - "'('", "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", "'~'", - "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'", - "'='", "';'", "'{'", "'}'", "$accept", "translation_unit", "$@1", - "version_statement", "pragma_statement", "extension_statement_list", - "extension_statement", "external_declaration_list", - "variable_identifier", "primary_expression", "postfix_expression", - "integer_expression", "function_call", "function_call_or_method", - "function_call_generic", "function_call_header_no_parameters", + "TYPE_IDENTIFIER", "NEW_IDENTIFIER", "FLOATCONSTANT", "INTCONSTANT", + "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", + "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", + "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", + "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", + "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", "LOWP", "MEDIUMP", "HIGHP", + "SUPERP", "PRECISION", "VERSION", "EXTENSION", "LINE", "COLON", "EOL", + "INTERFACE", "OUTPUT", "PRAGMA_DEBUG_ON", "PRAGMA_DEBUG_OFF", + "PRAGMA_OPTIMIZE_ON", "PRAGMA_OPTIMIZE_OFF", "PRAGMA_INVARIANT_ALL", + "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", + "THIS", "PACKED_TOK", "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", + "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", "LONG_TOK", "SHORT_TOK", + "DOUBLE_TOK", "HALF", "FIXED_TOK", "UNSIGNED", "INPUT_TOK", "OUPTUT", + "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", + "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", + "SIZEOF", "CAST", "NAMESPACE", "USING", "ERROR_TOK", "COMMON", + "PARTITION", "ACTIVE", "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", + "IMAGE3D", "IMAGECUBE", "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", + "IIMAGE2D", "IIMAGE3D", "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", + "UIMAGE1D", "UIMAGE2D", "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", + "UIMAGE2DARRAY", "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", + "IIMAGEBUFFER", "UIMAGEBUFFER", "IMAGE1DARRAYSHADOW", + "IMAGE2DARRAYSHADOW", "ROW_MAJOR", "'('", "')'", "'['", "']'", "'.'", + "','", "'+'", "'-'", "'!'", "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", + "'&'", "'^'", "'|'", "'?'", "':'", "'='", "';'", "'{'", "'}'", "$accept", + "translation_unit", "$@1", "version_statement", "pragma_statement", + "extension_statement_list", "any_identifier", "extension_statement", + "external_declaration_list", "variable_identifier", "primary_expression", + "postfix_expression", "integer_expression", "function_call", + "function_call_or_method", "function_call_generic", + "function_call_header_no_parameters", "function_call_header_with_parameters", "function_call_header", - "function_identifier", "unary_expression", "unary_operator", + "function_identifier", "method_call_generic", + "method_call_header_no_parameters", "method_call_header_with_parameters", + "method_call_header", "unary_expression", "unary_operator", "multiplicative_expression", "additive_expression", "shift_expression", "relational_expression", "equality_expression", "and_expression", "exclusive_or_expression", "inclusive_or_expression", @@ -907,7 +920,7 @@ static const char *const yytname[] = "precision_qualifier", "struct_specifier", "struct_declaration_list", "struct_declaration", "struct_declarator_list", "struct_declarator", "initializer", "declaration_statement", "statement", "simple_statement", - "compound_statement", "statement_no_new_scope", + "compound_statement", "$@2", "statement_no_new_scope", "compound_statement_no_new_scope", "statement_list", "expression_statement", "selection_statement", "selection_rest_statement", "condition", "switch_statement", @@ -941,76 +954,80 @@ static const yytype_uint16 yytoknum[] = 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 446, 447, 448, 40, 41, 91, 93, 46, 44, - 43, 45, 33, 126, 42, 47, 37, 60, 62, 38, - 94, 124, 63, 58, 61, 59, 123, 125 + 445, 446, 447, 448, 449, 450, 40, 41, 91, 93, + 46, 44, 43, 45, 33, 126, 42, 47, 37, 60, + 62, 38, 94, 124, 63, 58, 61, 59, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 218, 220, 219, 221, 221, 222, 222, 222, 222, - 222, 223, 223, 224, 225, 225, 226, 227, 227, 227, - 227, 227, 227, 228, 228, 228, 228, 228, 228, 229, - 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, - 236, 236, 236, 237, 237, 237, 237, 238, 238, 238, - 238, 239, 239, 239, 239, 240, 240, 240, 241, 241, - 241, 242, 242, 242, 242, 242, 243, 243, 243, 244, - 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, - 249, 250, 250, 251, 251, 252, 252, 252, 252, 252, - 252, 252, 252, 252, 252, 252, 253, 253, 254, 255, - 255, 255, 256, 257, 257, 258, 258, 259, 260, 260, - 261, 261, 261, 261, 262, 262, 262, 262, 263, 264, - 264, 264, 264, 264, 264, 264, 265, 265, 265, 265, - 265, 265, 265, 265, 266, 266, 267, 268, 268, 269, - 269, 270, 270, 270, 271, 272, 272, 272, 272, 272, - 272, 272, 272, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 274, 274, 275, 275, 275, 276, 276, 276, - 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - 277, 278, 278, 278, 279, 279, 280, 280, 281, 282, - 282, 283, 283, 284, 285, 286, 286, 287, 287, 287, - 287, 287, 287, 287, 288, 288, 289, 289, 290, 290, - 291, 291, 292, 292, 293, 294, 294, 295, 295, 296, - 297, 297, 298, 298, 298, 299, 299, 300, 300, 301, - 301, 302, 302, 302, 302, 302, 303, 303, 303, 304 + 0, 220, 222, 221, 223, 223, 224, 224, 224, 224, + 224, 225, 225, 226, 226, 226, 227, 228, 228, 229, + 229, 230, 230, 230, 230, 230, 230, 231, 231, 231, + 231, 231, 231, 232, 233, 234, 234, 235, 235, 236, + 236, 237, 237, 238, 239, 239, 239, 240, 240, 241, + 241, 242, 242, 243, 244, 244, 244, 244, 245, 245, + 245, 245, 246, 246, 246, 246, 247, 247, 247, 248, + 248, 248, 249, 249, 249, 249, 249, 250, 250, 250, + 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, + 256, 256, 257, 257, 258, 258, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 260, 260, 261, + 262, 262, 262, 263, 264, 264, 265, 265, 266, 267, + 267, 268, 268, 268, 268, 269, 269, 269, 269, 270, + 271, 271, 271, 271, 271, 271, 271, 272, 272, 272, + 272, 272, 272, 272, 272, 273, 273, 274, 275, 275, + 276, 276, 277, 277, 277, 278, 279, 279, 279, 279, + 279, 279, 279, 279, 280, 280, 280, 280, 280, 280, + 280, 280, 280, 281, 281, 282, 282, 282, 283, 283, + 283, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, + 284, 284, 285, 285, 285, 286, 286, 287, 287, 288, + 289, 289, 290, 290, 291, 292, 293, 293, 294, 294, + 294, 294, 294, 294, 294, 295, 296, 295, 297, 297, + 298, 298, 299, 299, 300, 300, 301, 302, 302, 303, + 303, 304, 305, 305, 306, 306, 306, 307, 307, 308, + 308, 309, 309, 310, 310, 310, 310, 310, 311, 311, + 311, 312 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 4, 0, 3, 2, 2, 2, 2, - 2, 0, 2, 5, 1, 2, 1, 1, 1, 1, - 1, 1, 3, 1, 4, 1, 3, 2, 2, 1, - 1, 1, 3, 2, 2, 2, 1, 2, 3, 2, - 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, - 1, 1, 3, 3, 3, 1, 3, 3, 1, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 5, 1, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, - 2, 4, 2, 1, 1, 2, 3, 3, 2, 5, - 3, 2, 3, 2, 0, 1, 1, 1, 1, 1, - 3, 5, 6, 7, 8, 5, 1, 2, 4, 5, - 6, 7, 4, 2, 1, 2, 4, 1, 3, 1, - 3, 1, 1, 1, 1, 1, 1, 2, 1, 2, - 2, 3, 1, 1, 1, 1, 2, 1, 1, 2, - 2, 1, 1, 2, 1, 3, 4, 1, 1, 1, + 2, 0, 2, 1, 1, 1, 5, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 3, 1, 4, 1, + 3, 2, 2, 1, 1, 1, 3, 2, 2, 2, + 1, 2, 3, 2, 1, 1, 1, 2, 2, 2, + 1, 2, 3, 2, 1, 2, 2, 2, 1, 1, + 1, 1, 1, 3, 3, 3, 1, 3, 3, 1, + 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 5, 1, 3, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 2, 2, 4, 2, 1, 1, 2, 3, 3, 2, + 5, 3, 2, 3, 2, 0, 1, 1, 1, 1, + 1, 3, 5, 6, 7, 8, 5, 1, 2, 4, + 5, 6, 7, 4, 2, 1, 2, 4, 1, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, + 2, 2, 3, 1, 1, 1, 1, 2, 1, 1, + 2, 2, 1, 1, 2, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 5, 4, 1, 2, 3, 1, - 3, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 3, 1, 1, 2, 3, - 1, 2, 1, 2, 5, 3, 1, 1, 4, 5, - 3, 2, 5, 7, 6, 1, 1, 1, 0, 2, - 3, 2, 2, 2, 3, 2, 1, 1, 1, 2 + 1, 1, 1, 1, 1, 5, 4, 1, 2, 3, + 1, 3, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 0, 4, 1, 1, + 2, 3, 1, 2, 1, 2, 5, 3, 1, 1, + 4, 5, 3, 2, 5, 7, 6, 1, 1, 1, + 0, 2, 3, 2, 2, 2, 3, 2, 1, 1, + 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1019,637 +1036,620 @@ static const yytype_uint8 yyr2[] = static const yytype_uint16 yydefact[] = { 4, 0, 0, 11, 0, 1, 2, 5, 0, 0, - 12, 0, 154, 153, 174, 171, 172, 173, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 175, 176, 177, - 0, 157, 158, 161, 155, 143, 142, 141, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 199, - 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 0, 170, 169, 152, 223, 222, 221, 0, 0, 0, - 0, 0, 0, 0, 198, 203, 278, 3, 277, 0, - 0, 104, 114, 0, 119, 126, 146, 148, 0, 145, - 134, 162, 164, 167, 0, 168, 14, 276, 0, 159, - 160, 156, 0, 0, 133, 0, 150, 0, 6, 7, - 8, 9, 10, 0, 15, 99, 0, 279, 102, 114, - 144, 115, 116, 117, 105, 0, 114, 0, 100, 127, - 147, 149, 135, 0, 163, 0, 0, 0, 0, 226, - 151, 0, 139, 0, 137, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 16, 20, 18, 19, - 21, 42, 0, 0, 0, 47, 48, 49, 50, 252, - 0, 248, 17, 23, 43, 25, 30, 31, 0, 0, - 36, 0, 51, 0, 55, 58, 61, 66, 69, 71, - 73, 75, 77, 79, 81, 83, 96, 0, 234, 0, - 134, 237, 250, 236, 235, 0, 238, 239, 240, 241, - 242, 243, 106, 111, 113, 118, 0, 120, 107, 0, - 0, 165, 51, 98, 0, 40, 13, 0, 231, 0, - 229, 225, 227, 101, 0, 136, 0, 272, 271, 0, - 0, 0, 275, 273, 0, 0, 0, 261, 0, 44, - 45, 0, 244, 0, 27, 28, 0, 0, 34, 33, - 0, 170, 37, 39, 86, 87, 89, 88, 91, 92, - 93, 94, 95, 90, 85, 0, 46, 0, 0, 0, + 12, 13, 14, 15, 0, 165, 164, 185, 182, 183, + 184, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 186, 187, 188, 0, 168, 169, 172, 166, 154, 153, + 152, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 210, 211, 212, 213, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 0, 181, 180, 163, 234, 233, 232, + 0, 0, 0, 0, 0, 0, 0, 209, 214, 290, + 3, 289, 0, 0, 115, 125, 0, 130, 137, 157, + 159, 0, 156, 145, 173, 175, 178, 0, 179, 17, + 288, 0, 170, 171, 167, 0, 0, 19, 20, 144, + 0, 161, 0, 6, 7, 8, 9, 10, 0, 18, + 110, 0, 291, 113, 125, 155, 126, 127, 128, 116, + 0, 125, 0, 111, 13, 15, 138, 0, 158, 160, + 146, 0, 174, 0, 0, 0, 237, 0, 162, 0, + 150, 0, 148, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 24, 22, 23, 25, 46, 0, + 0, 0, 58, 59, 60, 61, 264, 256, 260, 21, + 27, 54, 29, 34, 35, 0, 0, 40, 0, 62, + 0, 66, 69, 72, 77, 80, 82, 84, 86, 88, + 90, 92, 94, 107, 0, 245, 0, 145, 248, 262, + 247, 246, 0, 249, 250, 251, 252, 253, 254, 117, + 122, 124, 129, 0, 131, 0, 0, 118, 176, 62, + 109, 0, 44, 16, 242, 0, 240, 236, 238, 0, + 112, 0, 147, 0, 284, 283, 0, 0, 0, 287, + 285, 0, 0, 0, 273, 0, 55, 56, 0, 255, + 0, 31, 32, 0, 0, 38, 37, 0, 181, 41, + 43, 97, 98, 100, 99, 102, 103, 104, 105, 106, + 101, 96, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 253, 249, - 251, 108, 110, 112, 0, 0, 128, 0, 233, 132, - 166, 224, 0, 0, 228, 140, 138, 0, 266, 265, - 268, 0, 274, 0, 260, 152, 257, 0, 0, 22, - 245, 0, 29, 26, 32, 38, 84, 52, 53, 54, - 56, 57, 59, 60, 64, 65, 62, 63, 67, 68, - 70, 72, 74, 76, 78, 80, 0, 97, 0, 121, - 0, 125, 0, 129, 0, 230, 0, 267, 0, 0, - 0, 0, 0, 0, 24, 0, 0, 0, 122, 130, - 0, 232, 0, 269, 0, 256, 254, 259, 0, 247, - 262, 246, 82, 109, 123, 0, 131, 0, 270, 264, - 0, 258, 124, 263, 255 + 0, 0, 0, 0, 0, 265, 261, 263, 119, 121, + 123, 0, 0, 139, 0, 244, 143, 177, 0, 0, + 239, 235, 151, 149, 0, 278, 277, 280, 0, 286, + 0, 272, 163, 269, 0, 0, 26, 0, 0, 33, + 30, 0, 36, 0, 0, 50, 42, 95, 63, 64, + 65, 67, 68, 70, 71, 75, 76, 73, 74, 78, + 79, 81, 83, 85, 87, 89, 91, 0, 108, 0, + 132, 0, 136, 0, 140, 0, 241, 0, 279, 0, + 0, 0, 0, 0, 0, 257, 28, 53, 48, 47, + 0, 181, 51, 0, 0, 0, 133, 141, 0, 243, + 0, 281, 0, 268, 266, 271, 0, 259, 274, 258, + 52, 93, 120, 134, 0, 142, 0, 282, 276, 0, + 270, 135, 275, 267 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 9, 3, 86, 6, 10, 87, 182, 183, - 184, 341, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 285, 207, 234, 208, 209, 90, - 91, 92, 223, 134, 135, 224, 93, 94, 95, 96, - 153, 154, 97, 136, 98, 99, 235, 101, 102, 103, - 104, 105, 148, 149, 239, 240, 319, 211, 212, 213, - 214, 400, 401, 215, 216, 217, 396, 338, 218, 219, - 220, 330, 378, 379, 221, 106, 107 + -1, 2, 9, 3, 89, 6, 160, 10, 90, 189, + 190, 191, 348, 192, 193, 194, 195, 196, 197, 198, + 352, 353, 354, 355, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 292, + 214, 241, 215, 216, 93, 94, 95, 230, 139, 140, + 231, 96, 97, 98, 99, 161, 162, 100, 141, 101, + 102, 242, 104, 105, 106, 107, 108, 155, 156, 245, + 246, 326, 218, 219, 220, 221, 270, 418, 419, 222, + 223, 224, 414, 345, 225, 226, 227, 337, 389, 390, + 228, 109, 110 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -321 +#define YYPACT_NINF -366 static const yytype_int16 yypact[] = { - -86, -57, 45, -321, -56, -321, -50, -321, -10, 3320, - -321, -26, -321, -321, -321, -321, -321, -321, -321, -321, - -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, - 79, -321, -321, -321, -321, -321, -321, -321, -321, -321, - -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, - -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, - -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, - -70, -321, -321, 43, -321, -321, -321, 18, -22, -12, - -5, 2, 25, -101, -321, -321, -321, 3320, -321, -43, - -55, -54, 6, -148, -321, 52, 211, 211, 3509, -321, - -321, -321, -47, -321, 3581, -321, -321, -321, 110, -321, - -321, -321, -14, 3509, -321, 211, -321, 3581, -321, -321, - -321, -321, -321, 131, -321, -321, 389, -321, -321, 15, - -321, -321, -321, -321, -321, 3509, 109, 136, -321, -152, - -321, -321, -321, 2400, -321, 105, 3509, 143, 1781, -321, - -321, 7, 9, -107, -321, 10, 12, 1249, 27, 36, - 17, 2015, 40, 2952, 22, 42, -65, -321, -321, -321, - -321, -321, 2952, 2952, 2952, -321, -321, -321, -321, -321, - 604, -321, -321, -321, -20, -321, -321, -321, 47, -92, - 3136, 46, -67, 2952, -24, -16, 111, -73, 108, 37, - 41, 39, 162, 161, -82, -321, -321, -147, -321, 44, - 61, -321, -321, -321, -321, 819, -321, -321, -321, -321, - -321, -321, -321, -321, -321, 181, 3509, -160, -321, 2584, - 2952, -321, -321, -321, 63, -321, -321, 1898, 62, -146, - -321, -321, -321, -321, 183, -321, 131, -321, -321, 187, - 1664, 2952, -321, -321, -144, 2952, -140, -321, 2216, -321, - -321, -81, -321, 1034, -321, -321, 2952, 3437, -321, -321, - 2952, 70, -321, -321, -321, -321, -321, -321, -321, -321, - -321, -321, -321, -321, -321, 2952, -321, 2952, 2952, 2952, - 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, - 2952, 2952, 2952, 2952, 2952, 2952, 2952, 2952, -321, -321, - -321, 74, -321, -321, 2768, 2952, 64, 69, -321, -321, - -321, -321, 2952, 143, -321, -321, -321, 82, -321, -321, - 2216, -74, -321, -68, -321, 235, 78, 203, 85, -321, - -321, 84, 78, 88, -321, -321, -321, -321, -321, -321, - -24, -24, -16, -16, 111, 111, 111, 111, -73, -73, - 108, 37, 41, 39, 162, 161, -129, -321, 2952, 71, - 86, -321, 2952, 72, 87, -321, 2952, -321, 73, 92, - 1249, 75, 76, 1463, -321, 2952, 95, 2952, 80, -321, - 2952, -321, -63, 2952, 1463, 277, -321, -321, 2952, -321, - -321, -321, -321, -321, -321, 2952, -321, 81, 78, -321, - 1249, -321, -321, -321, -321 + -57, -43, 62, -366, -50, -366, -30, -366, 67, 3341, + -366, -366, -366, -366, -6, -366, -366, -366, -366, -366, + -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, + -366, -366, -366, 8, -366, -366, -366, -366, -366, -366, + -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, + -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, + -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, + -366, -366, -366, -65, -366, -366, 226, -366, -366, -366, + 51, -31, -28, 6, 13, 15, -44, -366, -366, -366, + 3341, -366, -183, -47, -29, 18, -169, -366, 140, 24, + 24, 3460, -366, -366, -366, -24, -366, 3533, -366, -366, + -366, 67, -366, -366, -366, 3460, -48, -366, -366, -366, + 24, -366, 3533, -366, -366, -366, -366, -366, 67, -366, + -366, 408, -366, -366, 55, -366, -366, -366, -366, -366, + 3460, 200, 67, -366, -20, -18, -178, 23, -366, -366, + -366, 2225, -366, 72, 67, 1598, -366, 3460, -366, 4, + 10, -84, -366, 11, 14, 1059, 40, 42, 29, 1836, + 43, 2783, 34, 54, -366, -366, -366, -366, -366, 2783, + 2783, 2783, -366, -366, -366, -366, -366, 32, -366, 56, + -366, -71, -366, -366, -366, 57, -81, 2969, 61, -27, + 2783, 35, -88, -41, -70, 33, 60, 41, 59, 181, + 180, -89, -366, -366, -168, -366, 58, 80, -366, -366, + -366, -366, 625, -366, -366, -366, -366, -366, -366, -366, + -366, -366, 67, 3460, -177, 2411, 2783, -366, -366, -366, + -366, 78, -366, -366, 81, -137, -366, -366, -366, 1717, + -366, 201, -366, 67, -366, -366, 205, 1478, 2783, -366, + -366, -134, 2783, -115, -366, 2039, -366, -366, -60, -366, + 1059, -366, -366, 2783, 140, -366, -366, 2783, 85, -366, + -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, + -366, -366, 2783, -366, 2783, 2783, 2783, 2783, 2783, 2783, + 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, 2783, + 2783, 2783, 2783, 2783, 2783, -366, -366, -366, 86, -366, + -366, 2597, 2783, 69, 87, -366, -366, -366, 2783, 67, + -366, -366, -366, -366, 91, -366, -366, 2039, -59, -366, + -46, -366, 129, 88, 67, 93, -366, 842, 89, 88, + -366, 95, -366, 96, -37, 3155, -366, -366, -366, -366, + -366, 35, 35, -88, -88, -41, -41, -41, -41, -70, + -70, 33, 60, 41, 59, 181, 180, -96, -366, 2783, + 76, 97, -366, 2783, 79, 98, -366, 2783, -366, 77, + 101, 1059, 83, 90, 1275, -366, -366, -366, -366, -366, + 2783, 102, -366, 2783, 108, 2783, 94, -366, 2783, -366, + -26, 2783, 1275, 297, -366, -366, 2783, -366, -366, -366, + -366, -366, -366, -366, 2783, -366, 100, 88, -366, 1059, + -366, -366, -366, -366 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, - -321, -321, -321, -321, 26, -321, -321, -321, -321, -135, - -321, -91, -88, -106, -90, -3, -6, -4, -2, -1, - 0, -321, -139, -174, -321, -156, -217, 11, 13, -321, - -321, -321, 83, 170, 164, 89, -321, -321, -243, -321, - -321, 56, -71, -321, -321, -72, -9, -32, -321, -321, - 227, -321, 160, -131, -321, -15, -195, 57, -154, -320, - -69, -84, 222, 133, 66, -321, -321, -13, -321, -321, - -321, -321, -321, -321, -321, 231, -321 + -366, -366, -366, -366, -366, -366, -7, -366, -366, -62, + -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, + -366, -366, -366, -366, -101, -366, -113, -109, -121, -61, + 5, 3, 9, 16, 2, 7, -366, -142, -100, -366, + -164, -225, 21, 22, -366, -366, -366, 82, 186, 173, + 92, -366, -366, -242, -366, -366, 68, -73, -366, -366, + -74, -9, -67, -366, -366, 243, -366, 170, -147, -366, + 0, -298, 73, -159, -365, -58, -366, -80, 239, 63, + 84, -366, -366, -2, -366, -366, -366, -366, -366, -366, + -366, 246, -366 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -170 +#define YYTABLE_NINF -115 static const yytype_int16 yytable[] = { - 100, 116, 115, 249, 233, 254, 112, 256, 232, 305, - 130, -169, 317, 294, 295, 337, 272, 242, 261, 130, - 88, 4, 89, 1, 140, 141, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 314, 259, 260, 131, - 132, 133, 228, 150, 229, 5, 12, 13, 131, 132, - 133, 137, 307, 323, 315, 307, 318, 7, 286, 307, - 8, 310, 230, 399, 264, 265, 11, 138, 308, 324, - 307, 332, 144, 334, 399, 30, 31, 32, 100, 33, - 34, 35, 36, 37, 385, 151, 108, 337, 245, 142, - 233, 118, 246, 123, 232, 331, 345, 370, 88, 333, - 89, 119, 336, 269, 147, 374, 242, 270, 120, 310, - 342, 346, 109, 110, 339, 121, 111, 210, 307, 114, - 371, 380, 74, 75, 76, 307, 225, 381, 139, -41, - 306, 307, 407, 367, 296, 297, 307, 147, 122, 147, - 128, 318, 131, 132, 133, 129, 113, 284, 210, 143, - 366, 386, 347, 348, 349, 232, 232, 232, 232, 232, - 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, - 232, 210, 125, 126, 336, 233, 266, 389, 267, 232, - 287, 288, 289, 233, 290, 291, 145, 232, 354, 355, - 356, 357, 404, 292, 293, 406, 298, 299, 318, 350, - 351, -103, 146, 411, 352, 353, 210, 152, 358, 359, - 412, 402, 227, 318, 12, 13, 318, 225, 236, 238, - 392, 250, 243, 244, 318, 247, 395, 248, 147, 233, - 251, 318, 252, 232, 255, 257, 258, 408, 12, 13, - 273, 210, 268, 30, 31, 32, 300, 33, 34, 210, - 302, 301, 303, 304, 210, -40, 414, 311, 322, 125, - 320, 325, 327, 116, 115, -35, 373, 30, 31, 32, - 368, 33, 34, 35, 36, 37, 376, 307, 372, 382, - 383, 384, -41, 388, 391, 387, 390, 394, 393, 410, - 398, 180, 403, 344, 405, 361, 413, 360, 362, 222, - 226, 363, 326, 364, 117, 365, 237, 328, 375, 312, - 409, 127, 397, 263, 0, 313, 329, 377, 124, 0, - 0, 210, 0, 0, 0, 0, 0, 0, 0, 0, + 103, 14, 121, 120, 312, 261, 256, 263, 248, 240, + 324, 11, 12, 13, 119, 271, 272, 268, 301, 302, + 235, 321, 135, 344, 382, 148, 149, 15, 16, 417, + 91, 92, 142, 314, 130, 131, 147, 4, 236, 322, + 152, 112, 113, 299, 300, 114, 158, 417, 143, 315, + 239, 136, 137, 138, 1, 159, 33, 34, 35, 135, + 36, 37, 5, 317, 329, 7, 116, 314, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 266, 267, + 330, 103, 8, 339, 123, 407, 314, 124, 136, 137, + 138, 146, 150, 240, 338, 344, 381, 279, 340, 293, + 341, 343, 248, 385, 153, 314, 154, 423, 111, 349, + 425, 91, 92, 252, 297, 298, 276, 253, 430, 403, + 277, 125, 217, 305, 306, 313, 431, 273, 126, 274, + 127, 232, 15, 16, 239, 234, 325, 346, 391, 303, + 304, 314, 314, 11, 12, 13, 154, 244, 154, 377, + 133, 392, 128, 115, 404, 314, 217, 77, 78, 79, + 399, 33, 34, 35, 400, 36, 37, 38, 39, 40, + 157, 426, 134, 343, 151, 314, -19, 356, -20, 240, + 365, 366, 367, 368, 361, 362, 240, 243, 317, 291, + 363, 364, 357, 358, 359, 360, 239, 239, 239, 239, + 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 351, 217, 378, -114, 144, 12, 145, 237, + 239, 250, 325, 410, 232, 318, 251, 239, 254, 15, + 16, 255, 413, 136, 137, 138, 257, 240, 258, 262, + 154, 294, 295, 296, 369, 370, 259, 427, 217, 264, + 265, 269, -45, 308, 275, 402, 217, 280, 33, 34, + 35, 217, 36, 37, 38, 39, 40, 350, 121, 120, + 433, 307, 309, 310, 311, 130, -44, 327, 239, 328, + 334, 332, -39, 325, 379, 383, 384, 387, 396, 314, + 394, 397, 405, 398, 411, 408, 406, 409, 412, -49, + 420, 187, 117, 421, 118, 325, 416, 422, 325, 429, + 424, 372, 371, 375, 233, 319, 325, 432, 373, 376, + 229, 333, 244, 122, 325, 320, 374, 249, 217, 386, + 335, 132, 428, 347, 415, 388, 129, 393, 217, 0, + 0, 336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 217, 0, 0, 217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 210, 0, 0, 210, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 210, 0, 0, 0, 0, - 0, 0, 12, 13, 14, 15, 16, 17, 155, 156, - 157, 210, 158, 159, 160, 161, 162, 163, 164, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 0, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 165, 166, 167, 168, 169, 170, - 171, 0, 0, 172, 173, 0, 0, 0, 0, 0, + 0, 0, 0, 217, 0, 0, 0, 0, 0, 0, + 0, 15, 16, 17, 18, 19, 20, 163, 164, 165, + 217, 166, 167, 168, 169, 170, 171, 172, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 0, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 173, 117, 75, 118, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 73, 74, 75, 76, 0, 77, 0, 0, + 0, 0, 0, 76, 77, 78, 79, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 84, 0, 85, 0, 0, 0, + 0, 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 174, 0, 0, 0, 0, 0, 175, - 176, 177, 178, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 179, 180, 181, 12, 13, 14, - 15, 16, 17, 155, 156, 157, 0, 158, 159, 160, - 161, 162, 163, 164, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 165, - 166, 167, 168, 169, 170, 171, 0, 0, 172, 173, + 0, 0, 0, 0, 181, 0, 0, 0, 0, 0, + 182, 183, 184, 185, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 186, 187, 188, 15, 16, + 17, 18, 19, 20, 163, 164, 165, 0, 166, 167, + 168, 169, 170, 171, 172, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 173, 117, 75, 118, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 0, 77, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 83, 0, 0, 0, 0, + 76, 77, 78, 79, 0, 80, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, - 0, 0, 0, 0, 175, 176, 177, 178, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, - 180, 262, 12, 13, 14, 15, 16, 17, 155, 156, - 157, 0, 158, 159, 160, 161, 162, 163, 164, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 0, 33, 34, 35, 36, 37, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 181, 0, 0, 0, 0, 0, 182, 183, 184, + 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 186, 187, 316, 15, 16, 17, 18, 19, + 20, 163, 164, 165, 0, 166, 167, 168, 169, 170, + 171, 172, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 165, 166, 167, 168, 169, 170, - 171, 0, 0, 172, 173, 0, 0, 0, 0, 0, + 68, 69, 70, 71, 72, 73, 74, 173, 117, 75, + 118, 174, 175, 176, 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 73, 74, 75, 76, 0, 77, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, + 79, 0, 80, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, + 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 181, 0, + 0, 0, 0, 0, 182, 183, 184, 185, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, + 187, 395, 15, 16, 17, 18, 19, 20, 163, 164, + 165, 0, 166, 167, 168, 169, 170, 171, 172, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 0, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 173, 117, 75, 118, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 76, 77, 78, 79, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 174, 0, 0, 0, 0, 0, 175, - 176, 177, 178, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 179, 180, 309, 12, 13, 14, - 15, 16, 17, 155, 156, 157, 0, 158, 159, 160, - 161, 162, 163, 164, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 165, - 166, 167, 168, 169, 170, 171, 0, 0, 172, 173, + 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 0, 77, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, - 0, 0, 0, 0, 175, 176, 177, 178, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, - 180, 340, 12, 13, 14, 15, 16, 17, 155, 156, - 157, 0, 158, 159, 160, 161, 162, 163, 164, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 0, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 165, 166, 167, 168, 169, 170, - 171, 0, 0, 172, 173, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 181, 0, 0, 0, 0, + 0, 182, 183, 184, 185, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 186, 187, 15, 16, + 17, 18, 19, 20, 163, 164, 165, 0, 166, 167, + 168, 169, 170, 171, 172, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 173, 117, 75, 118, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 73, 74, 75, 76, 0, 77, 0, 0, + 76, 77, 78, 79, 0, 80, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 84, 0, 85, 0, 0, 0, + 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 174, 0, 0, 0, 0, 0, 175, - 176, 177, 178, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 179, 180, 12, 13, 14, 15, - 16, 17, 155, 156, 157, 0, 158, 159, 160, 161, - 162, 163, 164, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 165, 166, - 167, 168, 169, 170, 171, 0, 0, 172, 173, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 73, 74, 75, 76, - 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 83, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 181, 0, 0, 0, 0, 0, 182, 183, 184, + 185, 15, 16, 17, 18, 19, 20, 0, 0, 0, + 0, 0, 186, 131, 0, 0, 0, 0, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 0, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 0, 117, 75, 118, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 84, 0, - 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 76, 77, 78, 79, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 86, 0, 17, 18, 19, 20, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 0, 0, 0, 0, 0, 87, 0, 88, 0, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 0, 181, 75, 0, 0, 0, 0, + 182, 183, 184, 185, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 186, 0, 0, 0, 0, + 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, - 0, 0, 0, 175, 176, 177, 178, 12, 13, 14, - 15, 16, 17, 0, 0, 0, 0, 0, 179, 126, - 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 0, 0, 17, 18, 19, 20, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 0, 0, 0, 0, 0, 87, 0, 88, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, - 166, 167, 168, 169, 170, 171, 0, 0, 172, 173, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 0, 77, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 83, 14, 15, 16, 17, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 0, 0, 0, 0, 0, 0, 84, - 0, 85, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 0, 72, 174, 0, - 0, 0, 0, 0, 175, 176, 177, 178, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, - 0, 0, 0, 0, 0, 74, 75, 76, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 247, 0, 0, + 0, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 0, 0, 0, 0, 0, 0, 84, 0, 85, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 0, 72, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 241, 0, - 0, 0, 74, 75, 76, 0, 0, 0, 0, 0, + 0, 17, 18, 19, 20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 87, 0, 88, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 0, 117, 75, 118, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 331, 0, 0, 0, + 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, - 0, 0, 0, 84, 0, 85, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 0, 166, 167, 168, 169, 170, 171, 0, 0, 172, - 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 321, 0, 0, 0, 74, - 75, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, - 0, 0, 0, 0, 0, 175, 176, 177, 178, 12, - 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, - 253, 0, 0, 0, 0, 0, 18, 19, 20, 21, + 0, 0, 181, 0, 0, 0, 0, 0, 182, 183, + 184, 185, 15, 16, 17, 18, 19, 20, 0, 0, + 0, 0, 0, 260, 0, 0, 0, 0, 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 0, 33, 34, 35, 36, 37, 38, 39, 40, + 32, 33, 34, 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 0, 166, 167, 168, 169, 170, 171, 0, 0, - 172, 173, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 335, - 74, 75, 76, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 83, 0, 0, + 71, 72, 73, 74, 0, 117, 75, 118, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 342, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, - 174, 0, 0, 0, 0, 0, 175, 176, 177, 178, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 0, 166, 167, 168, 169, - 170, 171, 0, 0, 172, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 75, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 17, 18, 19, 20, 0, 181, 0, 0, 0, 0, + 0, 182, 183, 184, 185, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 0, 117, 75, 118, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, - 15, 16, 17, 0, 174, 0, 0, 231, 0, 0, - 175, 176, 177, 178, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, - 166, 167, 168, 169, 170, 171, 0, 0, 172, 173, + 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, - 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 17, 18, 19, 20, + 0, 181, 0, 0, 238, 0, 0, 182, 183, 184, + 185, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 0, 117, 75, 118, + 174, 175, 176, 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 14, 15, 16, 17, 0, 174, 0, - 0, 316, 0, 0, 175, 176, 177, 178, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 0, 166, 167, 168, 169, 170, 171, - 0, 0, 172, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 74, 75, 76, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, + 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 17, 18, 19, 20, 0, 181, 0, 0, + 323, 0, 0, 182, 183, 184, 185, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 0, 117, 75, 118, 174, 175, 176, 177, + 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, - 17, 0, 174, 0, 0, 369, 0, 0, 175, 176, - 177, 178, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 0, 166, 167, - 168, 169, 170, 171, 0, 0, 172, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 74, 75, 76, 0, + 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, + 19, 20, 0, 181, 0, 0, 380, 0, 0, 182, + 183, 184, 185, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 0, 117, + 75, 118, 174, 175, 176, 177, 178, 0, 0, 179, + 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, + 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 14, 15, 16, 17, 0, 174, 0, 0, 0, - 0, 0, 175, 176, 177, 178, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 38, 39, 40, + 0, 0, 0, 0, 17, 18, 19, 20, 0, 181, + 0, 0, 0, 0, 0, 182, 183, 184, 185, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 271, 0, 166, 167, 168, 169, 170, 171, 0, 0, - 172, 173, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 72, 73, 278, 0, 117, 75, 118, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 75, 76, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 84, 0, 85, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 13, 14, 15, 16, 17, 0, - 174, 0, 0, 0, 0, 0, 175, 176, 177, 178, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 0, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 17, 18, 19, 20, 0, 181, 0, 0, 0, 0, + 0, 182, 183, 184, 185, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 401, + 0, 117, 75, 118, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 73, 74, 75, 76, 0, 77, 0, - 0, 0, 0, 0, 0, 0, 78, 79, 80, 81, - 82, 83, 14, 15, 16, 17, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, - 0, 0, 0, 0, 0, 84, 0, 85, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 87, 0, 88, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 16, 17, 18, 19, 20, + 0, 181, 0, 0, 0, 0, 0, 182, 183, 184, + 185, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 0, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 0, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 76, 77, 78, 79, + 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, + 82, 83, 84, 85, 86, 17, 18, 19, 20, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 87, 0, + 88, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 0, 343, 14, 15, 16, 17, 171, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 74, 75, 76, 0, 0, 0, 0, 0, 0, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 0, 72, 14, 15, 16, 17, - 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, - 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 74, 75, 76, 0, 0, 0, 0, - 0, 0, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 0, 72, 0, 0, - 0, 0, 0, 0, 84, 0, 85, 0, 0, 0, + 70, 71, 72, 73, 74, 0, 0, 75, 17, 18, + 19, 20, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 77, 78, 79, 0, + 0, 0, 0, 0, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 0, 0, + 75, 0, 0, 0, 0, 0, 0, 87, 0, 88, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 84, 0, 85 + 87, 0, 88 }; static const yytype_int16 yycheck[] = { - 9, 73, 73, 157, 143, 161, 76, 163, 143, 91, - 4, 76, 229, 86, 87, 258, 190, 148, 174, 4, - 9, 78, 9, 109, 96, 97, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 196, 172, 173, 33, - 34, 35, 194, 115, 196, 0, 3, 4, 33, 34, - 35, 199, 199, 199, 214, 199, 230, 113, 193, 199, - 110, 215, 214, 383, 84, 85, 76, 215, 215, 215, - 199, 215, 104, 213, 394, 32, 33, 34, 87, 36, - 37, 38, 39, 40, 213, 117, 112, 330, 195, 98, - 229, 113, 199, 194, 229, 251, 270, 314, 87, 255, - 87, 113, 258, 195, 113, 322, 237, 199, 113, 263, - 266, 285, 33, 34, 195, 113, 37, 126, 199, 76, - 315, 195, 104, 105, 106, 199, 135, 195, 76, 194, - 212, 199, 195, 307, 207, 208, 199, 146, 113, 148, - 195, 315, 33, 34, 35, 199, 216, 214, 157, 196, - 306, 368, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 180, 215, 216, 330, 314, 196, 372, 198, 314, - 204, 205, 206, 322, 200, 201, 76, 322, 294, 295, - 296, 297, 387, 82, 83, 390, 88, 89, 372, 290, - 291, 195, 216, 398, 292, 293, 215, 76, 298, 299, - 405, 385, 76, 387, 3, 4, 390, 226, 113, 76, - 376, 194, 215, 214, 398, 215, 380, 215, 237, 368, - 194, 405, 215, 368, 194, 213, 194, 393, 3, 4, - 194, 250, 195, 32, 33, 34, 209, 36, 37, 258, - 211, 210, 90, 92, 263, 194, 410, 76, 196, 215, - 197, 78, 75, 335, 335, 195, 197, 32, 33, 34, - 196, 36, 37, 38, 39, 40, 194, 199, 214, 76, - 195, 197, 194, 197, 197, 214, 214, 195, 215, 12, - 214, 216, 197, 267, 214, 301, 215, 300, 302, 129, - 136, 303, 246, 304, 77, 305, 146, 250, 323, 226, - 394, 89, 381, 180, -1, 226, 250, 330, 87, -1, - -1, 330, -1, -1, -1, -1, -1, -1, -1, -1, + 9, 8, 76, 76, 93, 169, 165, 171, 155, 151, + 235, 76, 77, 78, 76, 86, 87, 181, 88, 89, + 198, 198, 4, 265, 322, 99, 100, 3, 4, 394, + 9, 9, 201, 201, 217, 218, 98, 80, 216, 216, + 107, 33, 34, 84, 85, 37, 120, 412, 217, 217, + 151, 33, 34, 35, 111, 122, 32, 33, 34, 4, + 36, 37, 0, 222, 201, 115, 73, 201, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 179, 180, + 217, 90, 112, 217, 115, 383, 201, 115, 33, 34, + 35, 98, 101, 235, 258, 337, 321, 197, 262, 200, + 215, 265, 249, 328, 111, 201, 115, 405, 114, 273, + 408, 90, 90, 197, 202, 203, 197, 201, 416, 215, + 201, 115, 131, 90, 91, 214, 424, 198, 115, 200, + 115, 140, 3, 4, 235, 142, 236, 197, 197, 209, + 210, 201, 201, 76, 77, 78, 155, 154, 157, 313, + 197, 197, 196, 218, 379, 201, 165, 106, 107, 108, + 197, 32, 33, 34, 201, 36, 37, 38, 39, 40, + 218, 197, 201, 337, 198, 201, 196, 277, 196, 321, + 301, 302, 303, 304, 297, 298, 328, 115, 347, 216, + 299, 300, 292, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 274, 222, 314, 197, 76, 77, 78, 196, + 321, 217, 322, 387, 233, 232, 216, 328, 217, 3, + 4, 217, 391, 33, 34, 35, 196, 379, 196, 196, + 249, 206, 207, 208, 305, 306, 217, 411, 257, 215, + 196, 219, 196, 212, 197, 355, 265, 196, 32, 33, + 34, 270, 36, 37, 38, 39, 40, 274, 342, 342, + 429, 211, 213, 92, 94, 217, 196, 199, 379, 198, + 75, 80, 197, 383, 198, 216, 199, 196, 199, 201, + 197, 196, 216, 197, 217, 216, 199, 199, 197, 197, + 400, 218, 76, 403, 78, 405, 216, 199, 408, 12, + 216, 308, 307, 311, 141, 233, 416, 217, 309, 312, + 134, 253, 329, 80, 424, 233, 310, 157, 337, 329, + 257, 92, 412, 270, 392, 337, 90, 344, 347, -1, + -1, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 391, -1, -1, 394, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 380, -1, -1, 383, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 394, -1, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 410, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, -1, 108, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 155, -1, 157, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 412, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 429, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, -1, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 194, -1, -1, -1, -1, -1, 200, - 201, 202, 203, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 215, 216, 217, 3, 4, 5, - 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, + -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, - 106, -1, 108, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, - -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, - -1, -1, -1, -1, 200, 201, 202, 203, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, - 216, 217, 3, 4, 5, 6, 7, 8, 9, 10, - 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 196, -1, -1, -1, -1, -1, + 202, 203, 204, 205, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 217, 218, 219, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, -1, 108, -1, -1, + 105, 106, 107, 108, -1, 110, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 155, -1, 157, -1, -1, -1, + -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 194, -1, -1, -1, -1, -1, 200, - 201, 202, 203, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 215, 216, 217, 3, 4, 5, - 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, + -1, 196, -1, -1, -1, -1, -1, 202, 203, 204, + 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 217, 218, 219, 3, 4, 5, 6, 7, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, -1, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, - 106, -1, 108, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 121, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, -1, 110, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, - -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, + -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, - -1, -1, -1, -1, 200, 201, 202, 203, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, - 216, 217, 3, 4, 5, 6, 7, 8, 9, 10, + -1, -1, -1, -1, -1, -1, -1, -1, 196, -1, + -1, -1, -1, -1, 202, 203, 204, 205, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 217, + 218, 219, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, @@ -1657,295 +1657,312 @@ static const yytype_int16 yycheck[] = 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 81, 82, 83, -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 103, 104, 105, 106, -1, 108, -1, -1, + -1, -1, -1, -1, 105, 106, 107, 108, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 155, -1, 157, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 194, -1, -1, -1, -1, -1, 200, - 201, 202, 203, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 215, 216, 3, 4, 5, 6, - 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, + -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, + -1, 202, 203, 204, 205, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 217, 218, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, - -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, + 105, 106, 107, 108, -1, 110, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 155, -1, - 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, - -1, -1, -1, 200, 201, 202, 203, 3, 4, 5, - 6, 7, 8, -1, -1, -1, -1, -1, 215, 216, - -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, - 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, - 106, -1, 108, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 121, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, -1, -1, -1, -1, -1, -1, 155, - -1, 157, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, -1, 76, 194, -1, - -1, -1, -1, -1, 200, 201, 202, 203, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, - -1, -1, -1, -1, -1, 104, 105, 106, -1, -1, + -1, 196, -1, -1, -1, -1, -1, 202, 203, 204, + 205, 3, 4, 5, 6, 7, 8, -1, -1, -1, + -1, -1, 217, 218, -1, -1, -1, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, -1, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, -1, 76, 77, 78, 79, 80, 81, + 82, 83, -1, -1, 86, 87, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, + -1, 123, -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, -1, -1, -1, -1, 155, -1, 157, 41, + -1, -1, -1, -1, -1, 157, -1, 159, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, -1, 76, -1, -1, -1, -1, -1, + 72, 73, 74, -1, 196, 77, -1, -1, -1, -1, + 202, 203, 204, 205, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 217, -1, -1, -1, -1, + -1, -1, -1, -1, 106, 107, 108, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, + -1, -1, -1, -1, -1, 157, -1, 159, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, -1, -1, 77, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 219, -1, -1, + -1, -1, -1, 106, 107, 108, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, + -1, -1, -1, -1, 157, -1, 159, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, + -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 219, -1, -1, -1, + -1, -1, 106, 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 217, -1, - -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 157, -1, 159, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 196, -1, -1, -1, -1, -1, 202, 203, + 204, 205, 3, 4, 5, 6, 7, 8, -1, -1, + -1, -1, -1, 217, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, -1, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, + 81, 82, 83, -1, -1, 86, 87, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 105, 106, 107, 108, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 123, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 157, -1, 159, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 5, 6, 7, 8, -1, 196, -1, -1, -1, -1, + -1, 202, 203, 204, 205, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, - -1, -1, -1, 155, -1, 157, 41, 42, 43, 44, + -1, -1, -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - -1, 76, 77, 78, 79, 80, 81, -1, -1, 84, - 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 217, -1, -1, -1, 104, - 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 155, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, - -1, -1, -1, -1, -1, 200, 201, 202, 203, 3, - 4, 5, 6, 7, 8, -1, -1, -1, -1, -1, - 215, -1, -1, -1, -1, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, -1, 76, 77, 78, 79, 80, 81, -1, -1, - 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, - 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 121, -1, -1, + -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, + -1, 196, -1, -1, 199, -1, -1, 202, 203, 204, + 205, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, + 79, 80, 81, 82, 83, -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 155, -1, 157, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, - 194, -1, -1, -1, -1, -1, 200, 201, 202, 203, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, - 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 157, -1, + 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, 196, -1, -1, + 199, -1, -1, 202, 203, 204, 205, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, -1, 76, 77, 78, 79, 80, 81, 82, + 83, -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 155, -1, 157, -1, -1, + -1, -1, -1, 106, 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, - 6, 7, 8, -1, 194, -1, -1, 197, -1, -1, - 200, 201, 202, 203, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, - 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 104, 105, - 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, - -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 7, 8, -1, 196, -1, -1, 199, -1, -1, 202, + 203, 204, 205, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, + 77, 78, 79, 80, 81, 82, 83, -1, -1, 86, + 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, + 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 7, 8, -1, 194, -1, - -1, 197, -1, -1, 200, 201, 202, 203, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, -1, 76, 77, 78, 79, 80, 81, - -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 7, 8, -1, 196, + -1, -1, -1, -1, -1, 202, 203, 204, 205, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, + 81, 82, 83, -1, -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 155, -1, 157, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 106, 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, - 8, -1, 194, -1, -1, 197, -1, -1, 200, 201, - 202, 203, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, - 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 155, -1, 157, + 5, 6, 7, 8, -1, 196, -1, -1, -1, -1, + -1, 202, 203, 204, 205, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, 107, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 5, 6, 7, 8, -1, 194, -1, -1, -1, - -1, -1, 200, 201, 202, 203, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, -1, 76, 77, 78, 79, 80, 81, -1, -1, - 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, + -1, 196, -1, -1, -1, -1, -1, 202, 203, 204, + 205, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, -1, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, -1, -1, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 155, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 105, 106, 107, 108, + -1, 110, -1, -1, -1, -1, -1, -1, -1, 118, + 119, 120, 121, 122, 123, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 3, 4, 5, 6, 7, 8, -1, - 194, -1, -1, -1, -1, -1, 200, 201, 202, 203, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 30, 31, -1, -1, -1, -1, -1, -1, 157, -1, + 159, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, -1, 76, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 70, 71, 72, 73, 74, -1, -1, 77, 5, 6, + 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, -1, 106, 107, 108, -1, + -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, -1, -1, + 77, -1, -1, -1, -1, -1, -1, 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 103, 104, 105, 106, -1, 108, -1, - -1, -1, -1, -1, -1, -1, 116, 117, 118, 119, - 120, 121, 5, 6, 7, 8, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, - -1, -1, -1, -1, -1, 155, -1, 157, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 5, 6, 7, 8, 81, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 104, 105, 106, -1, -1, -1, -1, -1, -1, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, -1, 76, 5, 6, 7, 8, - -1, -1, 155, -1, 157, -1, -1, -1, -1, -1, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 104, 105, 106, -1, -1, -1, -1, - -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, -1, 76, -1, -1, - -1, -1, -1, -1, 155, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 155, -1, 157 + 157, -1, 159 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 109, 219, 221, 78, 0, 223, 113, 110, 220, - 224, 76, 3, 4, 5, 6, 7, 8, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 76, 103, 104, 105, 106, 108, 116, 117, - 118, 119, 120, 121, 155, 157, 222, 225, 255, 256, - 257, 258, 259, 264, 265, 266, 267, 270, 272, 273, - 274, 275, 276, 277, 278, 279, 303, 304, 112, 33, - 34, 37, 76, 216, 76, 270, 273, 278, 113, 113, - 113, 113, 113, 194, 303, 215, 216, 290, 195, 199, - 4, 33, 34, 35, 261, 262, 271, 199, 215, 76, - 273, 273, 274, 196, 275, 76, 216, 274, 280, 281, - 273, 275, 76, 268, 269, 9, 10, 11, 13, 14, - 15, 16, 17, 18, 19, 75, 76, 77, 78, 79, - 80, 81, 84, 85, 194, 200, 201, 202, 203, 215, - 216, 217, 226, 227, 228, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 253, 255, 256, - 274, 285, 286, 287, 288, 291, 292, 293, 296, 297, - 298, 302, 261, 260, 263, 274, 262, 76, 194, 196, - 214, 197, 237, 250, 254, 274, 113, 280, 76, 282, - 283, 217, 281, 215, 214, 195, 199, 215, 215, 286, - 194, 194, 215, 215, 253, 194, 253, 213, 194, 237, - 237, 253, 217, 291, 84, 85, 196, 198, 195, 195, - 199, 74, 251, 194, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 214, 252, 237, 204, 205, 206, - 200, 201, 82, 83, 86, 87, 207, 208, 88, 89, - 209, 210, 211, 90, 92, 91, 212, 199, 215, 217, - 286, 76, 260, 263, 196, 214, 197, 254, 251, 284, - 197, 217, 196, 199, 215, 78, 269, 75, 285, 292, - 299, 253, 215, 253, 213, 103, 253, 266, 295, 195, - 217, 229, 253, 76, 232, 251, 251, 237, 237, 237, - 239, 239, 240, 240, 241, 241, 241, 241, 242, 242, - 243, 244, 245, 246, 247, 248, 253, 251, 196, 197, - 254, 284, 214, 197, 254, 283, 194, 295, 300, 301, - 195, 195, 76, 195, 197, 213, 254, 214, 197, 284, - 214, 197, 253, 215, 195, 286, 294, 288, 214, 287, - 289, 290, 251, 197, 284, 214, 284, 195, 253, 289, - 12, 284, 284, 215, 286 + 0, 111, 221, 223, 80, 0, 225, 115, 112, 222, + 227, 76, 77, 78, 226, 3, 4, 5, 6, 7, + 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 77, 105, 106, 107, 108, + 110, 118, 119, 120, 121, 122, 123, 157, 159, 224, + 228, 262, 263, 264, 265, 266, 271, 272, 273, 274, + 277, 279, 280, 281, 282, 283, 284, 285, 286, 311, + 312, 114, 33, 34, 37, 218, 226, 76, 78, 229, + 277, 280, 285, 115, 115, 115, 115, 115, 196, 311, + 217, 218, 298, 197, 201, 4, 33, 34, 35, 268, + 269, 278, 201, 217, 76, 78, 226, 229, 280, 280, + 281, 198, 282, 226, 281, 287, 288, 218, 280, 282, + 226, 275, 276, 9, 10, 11, 13, 14, 15, 16, + 17, 18, 19, 75, 79, 80, 81, 82, 83, 86, + 87, 196, 202, 203, 204, 205, 217, 218, 219, 229, + 230, 231, 233, 234, 235, 236, 237, 238, 239, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 260, 262, 263, 281, 292, 293, + 294, 295, 299, 300, 301, 304, 305, 306, 310, 268, + 267, 270, 281, 269, 226, 198, 216, 196, 199, 244, + 257, 261, 281, 115, 226, 289, 290, 219, 288, 287, + 217, 216, 197, 201, 217, 217, 293, 196, 196, 217, + 217, 260, 196, 260, 215, 196, 244, 244, 260, 219, + 296, 86, 87, 198, 200, 197, 197, 201, 74, 258, + 196, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 216, 259, 244, 206, 207, 208, 202, 203, 84, + 85, 88, 89, 209, 210, 90, 91, 211, 212, 213, + 92, 94, 93, 214, 201, 217, 219, 293, 226, 267, + 270, 198, 216, 199, 261, 258, 291, 199, 198, 201, + 217, 219, 80, 276, 75, 292, 300, 307, 260, 217, + 260, 215, 105, 260, 273, 303, 197, 299, 232, 260, + 226, 229, 240, 241, 242, 243, 258, 258, 244, 244, + 244, 246, 246, 247, 247, 248, 248, 248, 248, 249, + 249, 250, 251, 252, 253, 254, 255, 260, 258, 198, + 199, 261, 291, 216, 199, 261, 290, 196, 303, 308, + 309, 197, 197, 226, 197, 219, 199, 196, 197, 197, + 201, 74, 258, 215, 261, 216, 199, 291, 216, 199, + 260, 217, 197, 293, 302, 295, 216, 294, 297, 298, + 258, 258, 199, 291, 216, 291, 197, 260, 297, 12, + 291, 291, 217, 293 }; #define yyerrok (yyerrstatus = 0) @@ -2636,7 +2653,7 @@ YYLTYPE yylloc; } /* Line 1251 of yacc.c */ -#line 2640 "glsl_parser.cpp" +#line 2657 "glsl_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2824,43 +2841,69 @@ yyreduce: case 2: /* Line 1464 of yacc.c */ -#line 213 "glsl_parser.ypp" +#line 218 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} break; - case 5: + case 3: /* Line 1464 of yacc.c */ #line 222 "glsl_parser.ypp" { + delete state->symbols; + state->symbols = new(ralloc_parent(state)) glsl_symbol_table; + _mesa_glsl_initialize_types(state); + ;} + break; + + case 5: + +/* Line 1464 of yacc.c */ +#line 232 "glsl_parser.ypp" + { + bool supported = false; + switch ((yyvsp[(2) - (3)].n)) { case 100: state->es_shader = true; + supported = state->Const.GLSL_100ES; + break; case 110: + supported = state->Const.GLSL_110; + break; case 120: + supported = state->Const.GLSL_120; + break; case 130: - /* FINISHME: Check against implementation support versions. */ - state->language_version = (yyvsp[(2) - (3)].n); - state->version_string = - talloc_asprintf(state, "GLSL%s %d.%02d", - state->es_shader ? " ES" : "", - state->language_version / 100, - state->language_version % 100); + supported = state->Const.GLSL_130; break; default: - _mesa_glsl_error(& (yylsp[(2) - (3)]), state, "Shading language version" - "%u is not supported\n", (yyvsp[(2) - (3)].n)); + supported = false; break; } + + state->language_version = (yyvsp[(2) - (3)].n); + state->version_string = + ralloc_asprintf(state, "GLSL%s %d.%02d", + state->es_shader ? " ES" : "", + state->language_version / 100, + state->language_version % 100); + + if (!supported) { + _mesa_glsl_error(& (yylsp[(2) - (3)]), state, "%s is not supported. " + "Supported versions are: %s\n", + state->version_string, + state->supported_version_string); + } ;} break; case 10: /* Line 1464 of yacc.c */ -#line 251 "glsl_parser.ypp" +#line 276 "glsl_parser.ypp" { if (state->language_version < 120) { _mesa_glsl_warning(& (yylsp[(1) - (2)]), state, @@ -2872,10 +2915,10 @@ yyreduce: ;} break; - case 13: + case 16: /* Line 1464 of yacc.c */ -#line 269 "glsl_parser.ypp" +#line 300 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2883,10 +2926,10 @@ yyreduce: ;} break; - case 14: + case 17: /* Line 1464 of yacc.c */ -#line 278 "glsl_parser.ypp" +#line 309 "glsl_parser.ypp" { /* FINISHME: The NULL test is required because pragmas are set to * FINISHME: NULL. (See production rule for external_declaration.) @@ -2896,10 +2939,10 @@ yyreduce: ;} break; - case 15: + case 18: /* Line 1464 of yacc.c */ -#line 286 "glsl_parser.ypp" +#line 317 "glsl_parser.ypp" { /* FINISHME: The NULL test is required because pragmas are set to * FINISHME: NULL. (See production rule for external_declaration.) @@ -2909,10 +2952,10 @@ yyreduce: ;} break; - case 17: + case 21: /* Line 1464 of yacc.c */ -#line 301 "glsl_parser.ypp" +#line 333 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -2921,10 +2964,10 @@ yyreduce: ;} break; - case 18: + case 22: /* Line 1464 of yacc.c */ -#line 308 "glsl_parser.ypp" +#line 340 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -2933,10 +2976,10 @@ yyreduce: ;} break; - case 19: + case 23: /* Line 1464 of yacc.c */ -#line 315 "glsl_parser.ypp" +#line 347 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -2945,10 +2988,10 @@ yyreduce: ;} break; - case 20: + case 24: /* Line 1464 of yacc.c */ -#line 322 "glsl_parser.ypp" +#line 354 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -2957,10 +3000,10 @@ yyreduce: ;} break; - case 21: + case 25: /* Line 1464 of yacc.c */ -#line 329 "glsl_parser.ypp" +#line 361 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -2969,19 +3012,19 @@ yyreduce: ;} break; - case 22: + case 26: /* Line 1464 of yacc.c */ -#line 336 "glsl_parser.ypp" +#line 368 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} break; - case 24: + case 28: /* Line 1464 of yacc.c */ -#line 344 "glsl_parser.ypp" +#line 376 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -2989,19 +3032,19 @@ yyreduce: ;} break; - case 25: + case 29: /* Line 1464 of yacc.c */ -#line 350 "glsl_parser.ypp" +#line 382 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} break; - case 26: + case 30: /* Line 1464 of yacc.c */ -#line 354 "glsl_parser.ypp" +#line 386 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -3010,10 +3053,10 @@ yyreduce: ;} break; - case 27: + case 31: /* Line 1464 of yacc.c */ -#line 361 "glsl_parser.ypp" +#line 393 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3021,10 +3064,10 @@ yyreduce: ;} break; - case 28: + case 32: /* Line 1464 of yacc.c */ -#line 367 "glsl_parser.ypp" +#line 399 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3032,10 +3075,10 @@ yyreduce: ;} break; - case 32: + case 36: /* Line 1464 of yacc.c */ -#line 385 "glsl_parser.ypp" +#line 417 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3043,10 +3086,10 @@ yyreduce: ;} break; - case 37: + case 41: /* Line 1464 of yacc.c */ -#line 404 "glsl_parser.ypp" +#line 436 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -3054,10 +3097,10 @@ yyreduce: ;} break; - case 38: + case 42: /* Line 1464 of yacc.c */ -#line 410 "glsl_parser.ypp" +#line 442 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3065,10 +3108,10 @@ yyreduce: ;} break; - case 40: + case 44: /* Line 1464 of yacc.c */ -#line 426 "glsl_parser.ypp" +#line 458 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3076,10 +3119,10 @@ yyreduce: ;} break; - case 41: + case 45: /* Line 1464 of yacc.c */ -#line 432 "glsl_parser.ypp" +#line 464 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3088,10 +3131,10 @@ yyreduce: ;} break; - case 42: + case 46: /* Line 1464 of yacc.c */ -#line 439 "glsl_parser.ypp" +#line 471 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3100,10 +3143,44 @@ yyreduce: ;} break; - case 44: + case 51: /* Line 1464 of yacc.c */ -#line 451 "glsl_parser.ypp" +#line 491 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (2)].expression); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(2) - (2)].expression)->link); + ;} + break; + + case 52: + +/* Line 1464 of yacc.c */ +#line 497 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (3)].expression); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(3) - (3)].expression)->link); + ;} + break; + + case 53: + +/* Line 1464 of yacc.c */ +#line 509 "glsl_parser.ypp" + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (2)].identifier)); + (yyval.expression) = new(ctx) ast_function_expression(callee); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 55: + +/* Line 1464 of yacc.c */ +#line 521 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3111,10 +3188,10 @@ yyreduce: ;} break; - case 45: + case 56: /* Line 1464 of yacc.c */ -#line 457 "glsl_parser.ypp" +#line 527 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3122,10 +3199,10 @@ yyreduce: ;} break; - case 46: + case 57: /* Line 1464 of yacc.c */ -#line 463 "glsl_parser.ypp" +#line 533 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3133,38 +3210,38 @@ yyreduce: ;} break; - case 47: + case 58: /* Line 1464 of yacc.c */ -#line 472 "glsl_parser.ypp" +#line 542 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; - case 48: + case 59: /* Line 1464 of yacc.c */ -#line 473 "glsl_parser.ypp" +#line 543 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; - case 49: + case 60: /* Line 1464 of yacc.c */ -#line 474 "glsl_parser.ypp" +#line 544 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; - case 50: + case 61: /* Line 1464 of yacc.c */ -#line 475 "glsl_parser.ypp" +#line 545 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; - case 52: + case 63: /* Line 1464 of yacc.c */ -#line 481 "glsl_parser.ypp" +#line 551 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3172,10 +3249,10 @@ yyreduce: ;} break; - case 53: + case 64: /* Line 1464 of yacc.c */ -#line 487 "glsl_parser.ypp" +#line 557 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3183,10 +3260,10 @@ yyreduce: ;} break; - case 54: + case 65: /* Line 1464 of yacc.c */ -#line 493 "glsl_parser.ypp" +#line 563 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3194,10 +3271,10 @@ yyreduce: ;} break; - case 56: + case 67: /* Line 1464 of yacc.c */ -#line 503 "glsl_parser.ypp" +#line 573 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3205,10 +3282,10 @@ yyreduce: ;} break; - case 57: + case 68: /* Line 1464 of yacc.c */ -#line 509 "glsl_parser.ypp" +#line 579 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3216,10 +3293,10 @@ yyreduce: ;} break; - case 59: + case 70: /* Line 1464 of yacc.c */ -#line 519 "glsl_parser.ypp" +#line 589 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3227,10 +3304,10 @@ yyreduce: ;} break; - case 60: + case 71: /* Line 1464 of yacc.c */ -#line 525 "glsl_parser.ypp" +#line 595 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3238,10 +3315,10 @@ yyreduce: ;} break; - case 62: + case 73: /* Line 1464 of yacc.c */ -#line 535 "glsl_parser.ypp" +#line 605 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3249,10 +3326,10 @@ yyreduce: ;} break; - case 63: + case 74: /* Line 1464 of yacc.c */ -#line 541 "glsl_parser.ypp" +#line 611 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3260,10 +3337,10 @@ yyreduce: ;} break; - case 64: + case 75: /* Line 1464 of yacc.c */ -#line 547 "glsl_parser.ypp" +#line 617 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3271,10 +3348,10 @@ yyreduce: ;} break; - case 65: + case 76: /* Line 1464 of yacc.c */ -#line 553 "glsl_parser.ypp" +#line 623 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3282,10 +3359,10 @@ yyreduce: ;} break; - case 67: + case 78: /* Line 1464 of yacc.c */ -#line 563 "glsl_parser.ypp" +#line 633 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3293,10 +3370,10 @@ yyreduce: ;} break; - case 68: + case 79: /* Line 1464 of yacc.c */ -#line 569 "glsl_parser.ypp" +#line 639 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3304,10 +3381,10 @@ yyreduce: ;} break; - case 70: + case 81: /* Line 1464 of yacc.c */ -#line 579 "glsl_parser.ypp" +#line 649 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3315,10 +3392,10 @@ yyreduce: ;} break; - case 72: + case 83: /* Line 1464 of yacc.c */ -#line 589 "glsl_parser.ypp" +#line 659 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3326,10 +3403,10 @@ yyreduce: ;} break; - case 74: + case 85: /* Line 1464 of yacc.c */ -#line 599 "glsl_parser.ypp" +#line 669 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3337,10 +3414,10 @@ yyreduce: ;} break; - case 76: + case 87: /* Line 1464 of yacc.c */ -#line 609 "glsl_parser.ypp" +#line 679 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3348,10 +3425,10 @@ yyreduce: ;} break; - case 78: + case 89: /* Line 1464 of yacc.c */ -#line 619 "glsl_parser.ypp" +#line 689 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3359,10 +3436,10 @@ yyreduce: ;} break; - case 80: + case 91: /* Line 1464 of yacc.c */ -#line 629 "glsl_parser.ypp" +#line 699 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3370,10 +3447,10 @@ yyreduce: ;} break; - case 82: + case 93: /* Line 1464 of yacc.c */ -#line 639 "glsl_parser.ypp" +#line 709 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); @@ -3381,10 +3458,10 @@ yyreduce: ;} break; - case 84: + case 95: /* Line 1464 of yacc.c */ -#line 649 "glsl_parser.ypp" +#line 719 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3392,96 +3469,96 @@ yyreduce: ;} break; - case 85: + case 96: /* Line 1464 of yacc.c */ -#line 657 "glsl_parser.ypp" +#line 727 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; - case 86: + case 97: /* Line 1464 of yacc.c */ -#line 658 "glsl_parser.ypp" +#line 728 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; - case 87: + case 98: /* Line 1464 of yacc.c */ -#line 659 "glsl_parser.ypp" +#line 729 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; - case 88: + case 99: /* Line 1464 of yacc.c */ -#line 660 "glsl_parser.ypp" +#line 730 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; - case 89: + case 100: /* Line 1464 of yacc.c */ -#line 661 "glsl_parser.ypp" +#line 731 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; - case 90: + case 101: /* Line 1464 of yacc.c */ -#line 662 "glsl_parser.ypp" +#line 732 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; - case 91: + case 102: /* Line 1464 of yacc.c */ -#line 663 "glsl_parser.ypp" +#line 733 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; - case 92: + case 103: /* Line 1464 of yacc.c */ -#line 664 "glsl_parser.ypp" +#line 734 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; - case 93: + case 104: /* Line 1464 of yacc.c */ -#line 665 "glsl_parser.ypp" +#line 735 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; - case 94: + case 105: /* Line 1464 of yacc.c */ -#line 666 "glsl_parser.ypp" +#line 736 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; - case 95: + case 106: /* Line 1464 of yacc.c */ -#line 667 "glsl_parser.ypp" +#line 737 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; - case 96: + case 107: /* Line 1464 of yacc.c */ -#line 672 "glsl_parser.ypp" +#line 742 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} break; - case 97: + case 108: /* Line 1464 of yacc.c */ -#line 676 "glsl_parser.ypp" +#line 746 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3496,28 +3573,29 @@ yyreduce: ;} break; - case 99: + case 110: /* Line 1464 of yacc.c */ -#line 696 "glsl_parser.ypp" +#line 766 "glsl_parser.ypp" { + state->symbols->pop_scope(); (yyval.node) = (yyvsp[(1) - (2)].function); ;} break; - case 100: + case 111: /* Line 1464 of yacc.c */ -#line 700 "glsl_parser.ypp" +#line 771 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} break; - case 101: + case 112: /* Line 1464 of yacc.c */ -#line 704 "glsl_parser.ypp" +#line 775 "glsl_parser.ypp" { (yyvsp[(3) - (4)].type_specifier)->precision = (yyvsp[(2) - (4)].n); (yyvsp[(3) - (4)].type_specifier)->is_precision_statement = true; @@ -3525,43 +3603,46 @@ yyreduce: ;} break; - case 105: + case 116: /* Line 1464 of yacc.c */ -#line 722 "glsl_parser.ypp" +#line 793 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); ;} break; - case 106: + case 117: /* Line 1464 of yacc.c */ -#line 727 "glsl_parser.ypp" +#line 798 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); ;} break; - case 107: + case 118: /* Line 1464 of yacc.c */ -#line 735 "glsl_parser.ypp" +#line 806 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); (yyval.function)->set_location(yylloc); (yyval.function)->return_type = (yyvsp[(1) - (3)].fully_specified_type); (yyval.function)->identifier = (yyvsp[(2) - (3)].identifier); + + state->symbols->add_function(new(state) ir_function((yyvsp[(2) - (3)].identifier))); + state->symbols->push_scope(); ;} break; - case 108: + case 119: /* Line 1464 of yacc.c */ -#line 746 "glsl_parser.ypp" +#line 820 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3573,10 +3654,10 @@ yyreduce: ;} break; - case 109: + case 120: /* Line 1464 of yacc.c */ -#line 756 "glsl_parser.ypp" +#line 830 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3590,10 +3671,10 @@ yyreduce: ;} break; - case 110: + case 121: /* Line 1464 of yacc.c */ -#line 771 "glsl_parser.ypp" +#line 845 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i; @@ -3602,20 +3683,20 @@ yyreduce: ;} break; - case 111: + case 122: /* Line 1464 of yacc.c */ -#line 778 "glsl_parser.ypp" +#line 852 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier); ;} break; - case 112: + case 123: /* Line 1464 of yacc.c */ -#line 783 "glsl_parser.ypp" +#line 857 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i; @@ -3628,10 +3709,10 @@ yyreduce: ;} break; - case 113: + case 124: /* Line 1464 of yacc.c */ -#line 794 "glsl_parser.ypp" +#line 868 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3642,39 +3723,39 @@ yyreduce: ;} break; - case 114: + case 125: /* Line 1464 of yacc.c */ -#line 806 "glsl_parser.ypp" +#line 880 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); ;} break; - case 115: + case 126: /* Line 1464 of yacc.c */ -#line 810 "glsl_parser.ypp" +#line 884 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.in = 1; ;} break; - case 116: + case 127: /* Line 1464 of yacc.c */ -#line 815 "glsl_parser.ypp" +#line 889 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.out = 1; ;} break; - case 117: + case 128: /* Line 1464 of yacc.c */ -#line 820 "glsl_parser.ypp" +#line 894 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.in = 1; @@ -3682,10 +3763,10 @@ yyreduce: ;} break; - case 120: + case 131: /* Line 1464 of yacc.c */ -#line 834 "glsl_parser.ypp" +#line 908 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3693,13 +3774,14 @@ yyreduce: (yyval.declarator_list) = (yyvsp[(1) - (3)].declarator_list); (yyval.declarator_list)->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(3) - (3)].identifier), ir_var_auto)); ;} break; - case 121: + case 132: /* Line 1464 of yacc.c */ -#line 843 "glsl_parser.ypp" +#line 918 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3707,13 +3789,14 @@ yyreduce: (yyval.declarator_list) = (yyvsp[(1) - (5)].declarator_list); (yyval.declarator_list)->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(3) - (5)].identifier), ir_var_auto)); ;} break; - case 122: + case 133: /* Line 1464 of yacc.c */ -#line 852 "glsl_parser.ypp" +#line 928 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3721,13 +3804,14 @@ yyreduce: (yyval.declarator_list) = (yyvsp[(1) - (6)].declarator_list); (yyval.declarator_list)->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(3) - (6)].identifier), ir_var_auto)); ;} break; - case 123: + case 134: /* Line 1464 of yacc.c */ -#line 861 "glsl_parser.ypp" +#line 938 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3735,13 +3819,14 @@ yyreduce: (yyval.declarator_list) = (yyvsp[(1) - (7)].declarator_list); (yyval.declarator_list)->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(3) - (7)].identifier), ir_var_auto)); ;} break; - case 124: + case 135: /* Line 1464 of yacc.c */ -#line 870 "glsl_parser.ypp" +#line 948 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3749,13 +3834,14 @@ yyreduce: (yyval.declarator_list) = (yyvsp[(1) - (8)].declarator_list); (yyval.declarator_list)->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(3) - (8)].identifier), ir_var_auto)); ;} break; - case 125: + case 136: /* Line 1464 of yacc.c */ -#line 879 "glsl_parser.ypp" +#line 958 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3763,13 +3849,14 @@ yyreduce: (yyval.declarator_list) = (yyvsp[(1) - (5)].declarator_list); (yyval.declarator_list)->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(3) - (5)].identifier), ir_var_auto)); ;} break; - case 126: + case 137: /* Line 1464 of yacc.c */ -#line 892 "glsl_parser.ypp" +#line 972 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3782,10 +3869,10 @@ yyreduce: ;} break; - case 127: + case 138: /* Line 1464 of yacc.c */ -#line 903 "glsl_parser.ypp" +#line 983 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3796,10 +3883,10 @@ yyreduce: ;} break; - case 128: + case 139: /* Line 1464 of yacc.c */ -#line 912 "glsl_parser.ypp" +#line 992 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3810,10 +3897,10 @@ yyreduce: ;} break; - case 129: + case 140: /* Line 1464 of yacc.c */ -#line 921 "glsl_parser.ypp" +#line 1001 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3824,10 +3911,10 @@ yyreduce: ;} break; - case 130: + case 141: /* Line 1464 of yacc.c */ -#line 930 "glsl_parser.ypp" +#line 1010 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3838,10 +3925,10 @@ yyreduce: ;} break; - case 131: + case 142: /* Line 1464 of yacc.c */ -#line 939 "glsl_parser.ypp" +#line 1019 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3852,10 +3939,10 @@ yyreduce: ;} break; - case 132: + case 143: /* Line 1464 of yacc.c */ -#line 948 "glsl_parser.ypp" +#line 1028 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3866,10 +3953,10 @@ yyreduce: ;} break; - case 133: + case 144: /* Line 1464 of yacc.c */ -#line 957 "glsl_parser.ypp" +#line 1037 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3882,10 +3969,10 @@ yyreduce: ;} break; - case 134: + case 145: /* Line 1464 of yacc.c */ -#line 971 "glsl_parser.ypp" +#line 1051 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3894,10 +3981,10 @@ yyreduce: ;} break; - case 135: + case 146: /* Line 1464 of yacc.c */ -#line 978 "glsl_parser.ypp" +#line 1058 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3907,19 +3994,19 @@ yyreduce: ;} break; - case 136: + case 147: /* Line 1464 of yacc.c */ -#line 989 "glsl_parser.ypp" +#line 1069 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} break; - case 138: + case 149: /* Line 1464 of yacc.c */ -#line 997 "glsl_parser.ypp" +#line 1077 "glsl_parser.ypp" { if (((yyvsp[(1) - (3)].type_qualifier).flags.i & (yyvsp[(3) - (3)].type_qualifier).flags.i) != 0) { _mesa_glsl_error(& (yylsp[(3) - (3)]), state, @@ -3937,16 +4024,17 @@ yyreduce: ;} break; - case 139: + case 150: /* Line 1464 of yacc.c */ -#line 1016 "glsl_parser.ypp" +#line 1096 "glsl_parser.ypp" { bool got_one = false; memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); - if (state->ARB_fragment_coord_conventions_enable) { + /* Layout qualifiers for ARB_fragment_coord_conventions. */ + if (!got_one && state->ARB_fragment_coord_conventions_enable) { if (strcmp((yyvsp[(1) - (1)].identifier), "origin_upper_left") == 0) { got_one = true; (yyval.type_qualifier).flags.q.origin_upper_left = 1; @@ -3954,27 +4042,49 @@ yyreduce: got_one = true; (yyval.type_qualifier).flags.q.pixel_center_integer = 1; } + + if (got_one && state->ARB_fragment_coord_conventions_warn) { + _mesa_glsl_warning(& (yylsp[(1) - (1)]), state, + "GL_ARB_fragment_coord_conventions layout " + "identifier `%s' used\n", (yyvsp[(1) - (1)].identifier)); + } + } + + /* Layout qualifiers for AMD_conservative_depth. */ + if (!got_one && state->AMD_conservative_depth_enable) { + if (strcmp((yyvsp[(1) - (1)].identifier), "depth_any") == 0) { + got_one = true; + (yyval.type_qualifier).flags.q.depth_any = 1; + } else if (strcmp((yyvsp[(1) - (1)].identifier), "depth_greater") == 0) { + got_one = true; + (yyval.type_qualifier).flags.q.depth_greater = 1; + } else if (strcmp((yyvsp[(1) - (1)].identifier), "depth_less") == 0) { + got_one = true; + (yyval.type_qualifier).flags.q.depth_less = 1; + } else if (strcmp((yyvsp[(1) - (1)].identifier), "depth_unchanged") == 0) { + got_one = true; + (yyval.type_qualifier).flags.q.depth_unchanged = 1; + } + + if (got_one && state->AMD_conservative_depth_warn) { + _mesa_glsl_warning(& (yylsp[(1) - (1)]), state, + "GL_AMD_conservative_depth " + "layout qualifier `%s' is used\n", (yyvsp[(1) - (1)].identifier)); + } } - /* If the identifier didn't match any known layout identifiers, - * emit an error. - */ if (!got_one) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "unrecognized layout identifier " "`%s'\n", (yyvsp[(1) - (1)].identifier)); YYERROR; - } else if (state->ARB_fragment_coord_conventions_warn) { - _mesa_glsl_warning(& (yylsp[(1) - (1)]), state, - "GL_ARB_fragment_coord_conventions layout " - "identifier `%s' used\n", (yyvsp[(1) - (1)].identifier)); } ;} break; - case 140: + case 151: /* Line 1464 of yacc.c */ -#line 1045 "glsl_parser.ypp" +#line 1148 "glsl_parser.ypp" { bool got_one = false; @@ -4014,80 +4124,80 @@ yyreduce: ;} break; - case 141: + case 152: /* Line 1464 of yacc.c */ -#line 1086 "glsl_parser.ypp" +#line 1189 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.smooth = 1; ;} break; - case 142: + case 153: /* Line 1464 of yacc.c */ -#line 1091 "glsl_parser.ypp" +#line 1194 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.flat = 1; ;} break; - case 143: + case 154: /* Line 1464 of yacc.c */ -#line 1096 "glsl_parser.ypp" +#line 1199 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.noperspective = 1; ;} break; - case 144: + case 155: /* Line 1464 of yacc.c */ -#line 1104 "glsl_parser.ypp" +#line 1207 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.constant = 1; ;} break; - case 147: + case 158: /* Line 1464 of yacc.c */ -#line 1114 "glsl_parser.ypp" +#line 1217 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier); (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i; ;} break; - case 149: + case 160: /* Line 1464 of yacc.c */ -#line 1120 "glsl_parser.ypp" +#line 1223 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier); (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i; ;} break; - case 150: + case 161: /* Line 1464 of yacc.c */ -#line 1125 "glsl_parser.ypp" +#line 1228 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).flags.q.invariant = 1; ;} break; - case 151: + case 162: /* Line 1464 of yacc.c */ -#line 1130 "glsl_parser.ypp" +#line 1233 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (3)].type_qualifier); (yyval.type_qualifier).flags.i |= (yyvsp[(3) - (3)].type_qualifier).flags.i; @@ -4095,50 +4205,50 @@ yyreduce: ;} break; - case 152: + case 163: /* Line 1464 of yacc.c */ -#line 1136 "glsl_parser.ypp" +#line 1239 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.invariant = 1; ;} break; - case 153: + case 164: /* Line 1464 of yacc.c */ -#line 1144 "glsl_parser.ypp" +#line 1247 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.constant = 1; ;} break; - case 154: + case 165: /* Line 1464 of yacc.c */ -#line 1149 "glsl_parser.ypp" +#line 1252 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.attribute = 1; ;} break; - case 155: + case 166: /* Line 1464 of yacc.c */ -#line 1154 "glsl_parser.ypp" +#line 1257 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.varying = 1; ;} break; - case 156: + case 167: /* Line 1464 of yacc.c */ -#line 1159 "glsl_parser.ypp" +#line 1262 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.centroid = 1; @@ -4146,79 +4256,79 @@ yyreduce: ;} break; - case 157: + case 168: /* Line 1464 of yacc.c */ -#line 1165 "glsl_parser.ypp" +#line 1268 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.in = 1; ;} break; - case 158: + case 169: /* Line 1464 of yacc.c */ -#line 1170 "glsl_parser.ypp" +#line 1273 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.out = 1; ;} break; - case 159: + case 170: /* Line 1464 of yacc.c */ -#line 1175 "glsl_parser.ypp" +#line 1278 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.in = 1; ;} break; - case 160: + case 171: /* Line 1464 of yacc.c */ -#line 1180 "glsl_parser.ypp" +#line 1283 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.out = 1; ;} break; - case 161: + case 172: /* Line 1464 of yacc.c */ -#line 1185 "glsl_parser.ypp" +#line 1288 "glsl_parser.ypp" { memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier))); (yyval.type_qualifier).flags.q.uniform = 1; ;} break; - case 162: + case 173: /* Line 1464 of yacc.c */ -#line 1193 "glsl_parser.ypp" +#line 1296 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (1)].type_specifier); ;} break; - case 163: + case 174: /* Line 1464 of yacc.c */ -#line 1197 "glsl_parser.ypp" +#line 1300 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); ;} break; - case 165: + case 176: /* Line 1464 of yacc.c */ -#line 1206 "glsl_parser.ypp" +#line 1309 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4226,10 +4336,10 @@ yyreduce: ;} break; - case 166: + case 177: /* Line 1464 of yacc.c */ -#line 1212 "glsl_parser.ypp" +#line 1315 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4237,10 +4347,10 @@ yyreduce: ;} break; - case 167: + case 178: /* Line 1464 of yacc.c */ -#line 1221 "glsl_parser.ypp" +#line 1324 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4248,10 +4358,10 @@ yyreduce: ;} break; - case 168: + case 179: /* Line 1464 of yacc.c */ -#line 1227 "glsl_parser.ypp" +#line 1330 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4259,10 +4369,10 @@ yyreduce: ;} break; - case 169: + case 180: /* Line 1464 of yacc.c */ -#line 1233 "glsl_parser.ypp" +#line 1336 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4270,367 +4380,367 @@ yyreduce: ;} break; - case 170: + case 181: /* Line 1464 of yacc.c */ -#line 1241 "glsl_parser.ypp" +#line 1344 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; - case 171: + case 182: /* Line 1464 of yacc.c */ -#line 1242 "glsl_parser.ypp" +#line 1345 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; - case 172: + case 183: /* Line 1464 of yacc.c */ -#line 1243 "glsl_parser.ypp" +#line 1346 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; - case 173: + case 184: /* Line 1464 of yacc.c */ -#line 1244 "glsl_parser.ypp" +#line 1347 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; - case 174: + case 185: /* Line 1464 of yacc.c */ -#line 1245 "glsl_parser.ypp" +#line 1348 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; - case 175: + case 186: /* Line 1464 of yacc.c */ -#line 1246 "glsl_parser.ypp" +#line 1349 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; - case 176: + case 187: /* Line 1464 of yacc.c */ -#line 1247 "glsl_parser.ypp" +#line 1350 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; - case 177: + case 188: /* Line 1464 of yacc.c */ -#line 1248 "glsl_parser.ypp" +#line 1351 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; - case 178: + case 189: /* Line 1464 of yacc.c */ -#line 1249 "glsl_parser.ypp" +#line 1352 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; - case 179: + case 190: /* Line 1464 of yacc.c */ -#line 1250 "glsl_parser.ypp" +#line 1353 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; - case 180: + case 191: /* Line 1464 of yacc.c */ -#line 1251 "glsl_parser.ypp" +#line 1354 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; - case 181: + case 192: /* Line 1464 of yacc.c */ -#line 1252 "glsl_parser.ypp" +#line 1355 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; - case 182: + case 193: /* Line 1464 of yacc.c */ -#line 1253 "glsl_parser.ypp" +#line 1356 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; - case 183: + case 194: /* Line 1464 of yacc.c */ -#line 1254 "glsl_parser.ypp" +#line 1357 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; - case 184: + case 195: /* Line 1464 of yacc.c */ -#line 1255 "glsl_parser.ypp" +#line 1358 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; - case 185: + case 196: /* Line 1464 of yacc.c */ -#line 1256 "glsl_parser.ypp" +#line 1359 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; - case 186: + case 197: /* Line 1464 of yacc.c */ -#line 1257 "glsl_parser.ypp" +#line 1360 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; - case 187: + case 198: /* Line 1464 of yacc.c */ -#line 1258 "glsl_parser.ypp" +#line 1361 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; - case 188: + case 199: /* Line 1464 of yacc.c */ -#line 1259 "glsl_parser.ypp" +#line 1362 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; - case 189: + case 200: /* Line 1464 of yacc.c */ -#line 1260 "glsl_parser.ypp" +#line 1363 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; - case 190: + case 201: /* Line 1464 of yacc.c */ -#line 1261 "glsl_parser.ypp" +#line 1364 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; - case 191: + case 202: /* Line 1464 of yacc.c */ -#line 1262 "glsl_parser.ypp" +#line 1365 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; - case 192: + case 203: /* Line 1464 of yacc.c */ -#line 1263 "glsl_parser.ypp" +#line 1366 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; - case 193: + case 204: /* Line 1464 of yacc.c */ -#line 1264 "glsl_parser.ypp" +#line 1367 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; - case 194: + case 205: /* Line 1464 of yacc.c */ -#line 1265 "glsl_parser.ypp" +#line 1368 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; - case 195: + case 206: /* Line 1464 of yacc.c */ -#line 1266 "glsl_parser.ypp" +#line 1369 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; - case 196: + case 207: /* Line 1464 of yacc.c */ -#line 1267 "glsl_parser.ypp" +#line 1370 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; - case 197: + case 208: /* Line 1464 of yacc.c */ -#line 1268 "glsl_parser.ypp" +#line 1371 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; - case 198: + case 209: /* Line 1464 of yacc.c */ -#line 1269 "glsl_parser.ypp" +#line 1372 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; - case 199: + case 210: /* Line 1464 of yacc.c */ -#line 1270 "glsl_parser.ypp" +#line 1373 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; - case 200: + case 211: /* Line 1464 of yacc.c */ -#line 1271 "glsl_parser.ypp" +#line 1374 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; - case 201: + case 212: /* Line 1464 of yacc.c */ -#line 1272 "glsl_parser.ypp" +#line 1375 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; - case 202: + case 213: /* Line 1464 of yacc.c */ -#line 1273 "glsl_parser.ypp" +#line 1376 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; - case 203: + case 214: /* Line 1464 of yacc.c */ -#line 1274 "glsl_parser.ypp" +#line 1377 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; - case 204: + case 215: /* Line 1464 of yacc.c */ -#line 1275 "glsl_parser.ypp" +#line 1378 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; - case 205: + case 216: /* Line 1464 of yacc.c */ -#line 1276 "glsl_parser.ypp" +#line 1379 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; - case 206: + case 217: /* Line 1464 of yacc.c */ -#line 1277 "glsl_parser.ypp" +#line 1380 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; - case 207: + case 218: /* Line 1464 of yacc.c */ -#line 1278 "glsl_parser.ypp" +#line 1381 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; - case 208: + case 219: /* Line 1464 of yacc.c */ -#line 1279 "glsl_parser.ypp" +#line 1382 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; - case 209: + case 220: /* Line 1464 of yacc.c */ -#line 1280 "glsl_parser.ypp" +#line 1383 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; - case 210: + case 221: /* Line 1464 of yacc.c */ -#line 1281 "glsl_parser.ypp" +#line 1384 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; - case 211: + case 222: /* Line 1464 of yacc.c */ -#line 1282 "glsl_parser.ypp" +#line 1385 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; - case 212: + case 223: /* Line 1464 of yacc.c */ -#line 1283 "glsl_parser.ypp" +#line 1386 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; - case 213: + case 224: /* Line 1464 of yacc.c */ -#line 1284 "glsl_parser.ypp" +#line 1387 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; - case 214: + case 225: /* Line 1464 of yacc.c */ -#line 1285 "glsl_parser.ypp" +#line 1388 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; - case 215: + case 226: /* Line 1464 of yacc.c */ -#line 1286 "glsl_parser.ypp" +#line 1389 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; - case 216: + case 227: /* Line 1464 of yacc.c */ -#line 1287 "glsl_parser.ypp" +#line 1390 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; - case 217: + case 228: /* Line 1464 of yacc.c */ -#line 1288 "glsl_parser.ypp" +#line 1391 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; - case 218: + case 229: /* Line 1464 of yacc.c */ -#line 1289 "glsl_parser.ypp" +#line 1392 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; - case 219: + case 230: /* Line 1464 of yacc.c */ -#line 1290 "glsl_parser.ypp" +#line 1393 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; - case 220: + case 231: /* Line 1464 of yacc.c */ -#line 1291 "glsl_parser.ypp" +#line 1394 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; - case 221: + case 232: /* Line 1464 of yacc.c */ -#line 1295 "glsl_parser.ypp" +#line 1398 "glsl_parser.ypp" { if (!state->es_shader && state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4643,10 +4753,10 @@ yyreduce: ;} break; - case 222: + case 233: /* Line 1464 of yacc.c */ -#line 1305 "glsl_parser.ypp" +#line 1408 "glsl_parser.ypp" { if (!state->es_shader && state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4659,10 +4769,10 @@ yyreduce: ;} break; - case 223: + case 234: /* Line 1464 of yacc.c */ -#line 1315 "glsl_parser.ypp" +#line 1418 "glsl_parser.ypp" { if (!state->es_shader && state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4675,21 +4785,22 @@ yyreduce: ;} break; - case 224: + case 235: /* Line 1464 of yacc.c */ -#line 1329 "glsl_parser.ypp" +#line 1432 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); (yyval.struct_specifier)->set_location(yylloc); + state->symbols->add_type((yyvsp[(2) - (5)].identifier), glsl_type::void_type); ;} break; - case 225: + case 236: /* Line 1464 of yacc.c */ -#line 1335 "glsl_parser.ypp" +#line 1439 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4697,30 +4808,30 @@ yyreduce: ;} break; - case 226: + case 237: /* Line 1464 of yacc.c */ -#line 1344 "glsl_parser.ypp" +#line 1448 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); ;} break; - case 227: + case 238: /* Line 1464 of yacc.c */ -#line 1349 "glsl_parser.ypp" +#line 1453 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); ;} break; - case 228: + case 239: /* Line 1464 of yacc.c */ -#line 1357 "glsl_parser.ypp" +#line 1461 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4734,41 +4845,42 @@ yyreduce: ;} break; - case 229: + case 240: /* Line 1464 of yacc.c */ -#line 1372 "glsl_parser.ypp" +#line 1476 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); ;} break; - case 230: + case 241: /* Line 1464 of yacc.c */ -#line 1377 "glsl_parser.ypp" +#line 1481 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); ;} break; - case 231: + case 242: /* Line 1464 of yacc.c */ -#line 1385 "glsl_parser.ypp" +#line 1489 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); (yyval.declaration)->set_location(yylloc); + state->symbols->add_variable(new(state) ir_variable(NULL, (yyvsp[(1) - (1)].identifier), ir_var_auto)); ;} break; - case 232: + case 243: /* Line 1464 of yacc.c */ -#line 1391 "glsl_parser.ypp" +#line 1496 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4776,31 +4888,31 @@ yyreduce: ;} break; - case 235: + case 246: /* Line 1464 of yacc.c */ -#line 1409 "glsl_parser.ypp" +#line 1514 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 240: + case 251: /* Line 1464 of yacc.c */ -#line 1417 "glsl_parser.ypp" +#line 1522 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 241: + case 252: /* Line 1464 of yacc.c */ -#line 1418 "glsl_parser.ypp" +#line 1523 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 244: + case 255: /* Line 1464 of yacc.c */ -#line 1425 "glsl_parser.ypp" +#line 1530 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4808,28 +4920,38 @@ yyreduce: ;} break; - case 245: + case 256: + +/* Line 1464 of yacc.c */ +#line 1536 "glsl_parser.ypp" + { + state->symbols->push_scope(); + ;} + break; + + case 257: /* Line 1464 of yacc.c */ -#line 1431 "glsl_parser.ypp" +#line 1540 "glsl_parser.ypp" { void *ctx = state; - (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); + (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(3) - (4)].node)); (yyval.compound_statement)->set_location(yylloc); + state->symbols->pop_scope(); ;} break; - case 246: + case 258: /* Line 1464 of yacc.c */ -#line 1439 "glsl_parser.ypp" +#line 1549 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 248: + case 260: /* Line 1464 of yacc.c */ -#line 1445 "glsl_parser.ypp" +#line 1555 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4837,10 +4959,10 @@ yyreduce: ;} break; - case 249: + case 261: /* Line 1464 of yacc.c */ -#line 1451 "glsl_parser.ypp" +#line 1561 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4848,10 +4970,10 @@ yyreduce: ;} break; - case 250: + case 262: /* Line 1464 of yacc.c */ -#line 1460 "glsl_parser.ypp" +#line 1570 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "<nil> statement\n"); @@ -4863,10 +4985,10 @@ yyreduce: ;} break; - case 251: + case 263: /* Line 1464 of yacc.c */ -#line 1470 "glsl_parser.ypp" +#line 1580 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, "<nil> statement\n"); @@ -4877,10 +4999,10 @@ yyreduce: ;} break; - case 252: + case 264: /* Line 1464 of yacc.c */ -#line 1482 "glsl_parser.ypp" +#line 1592 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4888,10 +5010,10 @@ yyreduce: ;} break; - case 253: + case 265: /* Line 1464 of yacc.c */ -#line 1488 "glsl_parser.ypp" +#line 1598 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4899,10 +5021,10 @@ yyreduce: ;} break; - case 254: + case 266: /* Line 1464 of yacc.c */ -#line 1497 "glsl_parser.ypp" +#line 1607 "glsl_parser.ypp" { (yyval.node) = new(state) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].selection_rest_statement).then_statement, (yyvsp[(5) - (5)].selection_rest_statement).else_statement); @@ -4910,39 +5032,39 @@ yyreduce: ;} break; - case 255: + case 267: /* Line 1464 of yacc.c */ -#line 1506 "glsl_parser.ypp" +#line 1616 "glsl_parser.ypp" { (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (3)].node); (yyval.selection_rest_statement).else_statement = (yyvsp[(3) - (3)].node); ;} break; - case 256: + case 268: /* Line 1464 of yacc.c */ -#line 1511 "glsl_parser.ypp" +#line 1621 "glsl_parser.ypp" { (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (1)].node); (yyval.selection_rest_statement).else_statement = NULL; ;} break; - case 257: + case 269: /* Line 1464 of yacc.c */ -#line 1519 "glsl_parser.ypp" +#line 1629 "glsl_parser.ypp" { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression); ;} break; - case 258: + case 270: /* Line 1464 of yacc.c */ -#line 1523 "glsl_parser.ypp" +#line 1633 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4955,10 +5077,10 @@ yyreduce: ;} break; - case 262: + case 274: /* Line 1464 of yacc.c */ -#line 1546 "glsl_parser.ypp" +#line 1656 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4967,10 +5089,10 @@ yyreduce: ;} break; - case 263: + case 275: /* Line 1464 of yacc.c */ -#line 1553 "glsl_parser.ypp" +#line 1663 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4979,10 +5101,10 @@ yyreduce: ;} break; - case 264: + case 276: /* Line 1464 of yacc.c */ -#line 1560 "glsl_parser.ypp" +#line 1670 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4991,39 +5113,39 @@ yyreduce: ;} break; - case 268: + case 280: /* Line 1464 of yacc.c */ -#line 1576 "glsl_parser.ypp" +#line 1686 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 269: + case 281: /* Line 1464 of yacc.c */ -#line 1583 "glsl_parser.ypp" +#line 1693 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; ;} break; - case 270: + case 282: /* Line 1464 of yacc.c */ -#line 1588 "glsl_parser.ypp" +#line 1698 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); ;} break; - case 271: + case 283: /* Line 1464 of yacc.c */ -#line 1597 "glsl_parser.ypp" +#line 1707 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -5031,10 +5153,10 @@ yyreduce: ;} break; - case 272: + case 284: /* Line 1464 of yacc.c */ -#line 1603 "glsl_parser.ypp" +#line 1713 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -5042,10 +5164,10 @@ yyreduce: ;} break; - case 273: + case 285: /* Line 1464 of yacc.c */ -#line 1609 "glsl_parser.ypp" +#line 1719 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -5053,10 +5175,10 @@ yyreduce: ;} break; - case 274: + case 286: /* Line 1464 of yacc.c */ -#line 1615 "glsl_parser.ypp" +#line 1725 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -5064,10 +5186,10 @@ yyreduce: ;} break; - case 275: + case 287: /* Line 1464 of yacc.c */ -#line 1621 "glsl_parser.ypp" +#line 1731 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5075,44 +5197,46 @@ yyreduce: ;} break; - case 276: + case 288: /* Line 1464 of yacc.c */ -#line 1629 "glsl_parser.ypp" +#line 1739 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; - case 277: + case 289: /* Line 1464 of yacc.c */ -#line 1630 "glsl_parser.ypp" +#line 1740 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 278: + case 290: /* Line 1464 of yacc.c */ -#line 1631 "glsl_parser.ypp" +#line 1741 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 279: + case 291: /* Line 1464 of yacc.c */ -#line 1636 "glsl_parser.ypp" +#line 1746 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); (yyval.function_definition)->set_location(yylloc); (yyval.function_definition)->prototype = (yyvsp[(1) - (2)].function); (yyval.function_definition)->body = (yyvsp[(2) - (2)].compound_statement); + + state->symbols->pop_scope(); ;} break; /* Line 1464 of yacc.c */ -#line 5116 "glsl_parser.cpp" +#line 5240 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 1bf3b3538c7..7f36492f7a1 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -112,123 +112,125 @@ VOID_TOK = 329, WHILE = 330, IDENTIFIER = 331, - FLOATCONSTANT = 332, - INTCONSTANT = 333, - UINTCONSTANT = 334, - BOOLCONSTANT = 335, - FIELD_SELECTION = 336, - LEFT_OP = 337, - RIGHT_OP = 338, - INC_OP = 339, - DEC_OP = 340, - LE_OP = 341, - GE_OP = 342, - EQ_OP = 343, - NE_OP = 344, - AND_OP = 345, - OR_OP = 346, - XOR_OP = 347, - MUL_ASSIGN = 348, - DIV_ASSIGN = 349, - ADD_ASSIGN = 350, - MOD_ASSIGN = 351, - LEFT_ASSIGN = 352, - RIGHT_ASSIGN = 353, - AND_ASSIGN = 354, - XOR_ASSIGN = 355, - OR_ASSIGN = 356, - SUB_ASSIGN = 357, - INVARIANT = 358, - LOWP = 359, - MEDIUMP = 360, - HIGHP = 361, - SUPERP = 362, - PRECISION = 363, - VERSION = 364, - EXTENSION = 365, - LINE = 366, - COLON = 367, - EOL = 368, - INTERFACE = 369, - OUTPUT = 370, - PRAGMA_DEBUG_ON = 371, - PRAGMA_DEBUG_OFF = 372, - PRAGMA_OPTIMIZE_ON = 373, - PRAGMA_OPTIMIZE_OFF = 374, - PRAGMA_INVARIANT_ALL = 375, - LAYOUT_TOK = 376, - ASM = 377, - CLASS = 378, - UNION = 379, - ENUM = 380, - TYPEDEF = 381, - TEMPLATE = 382, - THIS = 383, - PACKED_TOK = 384, - GOTO = 385, - INLINE_TOK = 386, - NOINLINE = 387, - VOLATILE = 388, - PUBLIC_TOK = 389, - STATIC = 390, - EXTERN = 391, - EXTERNAL = 392, - LONG_TOK = 393, - SHORT_TOK = 394, - DOUBLE_TOK = 395, - HALF = 396, - FIXED_TOK = 397, - UNSIGNED = 398, - INPUT_TOK = 399, - OUPTUT = 400, - HVEC2 = 401, - HVEC3 = 402, - HVEC4 = 403, - DVEC2 = 404, - DVEC3 = 405, - DVEC4 = 406, - FVEC2 = 407, - FVEC3 = 408, - FVEC4 = 409, - SAMPLER2DRECT = 410, - SAMPLER3DRECT = 411, - SAMPLER2DRECTSHADOW = 412, - SIZEOF = 413, - CAST = 414, - NAMESPACE = 415, - USING = 416, - ERROR_TOK = 417, - COMMON = 418, - PARTITION = 419, - ACTIVE = 420, - SAMPLERBUFFER = 421, - FILTER = 422, - IMAGE1D = 423, - IMAGE2D = 424, - IMAGE3D = 425, - IMAGECUBE = 426, - IMAGE1DARRAY = 427, - IMAGE2DARRAY = 428, - IIMAGE1D = 429, - IIMAGE2D = 430, - IIMAGE3D = 431, - IIMAGECUBE = 432, - IIMAGE1DARRAY = 433, - IIMAGE2DARRAY = 434, - UIMAGE1D = 435, - UIMAGE2D = 436, - UIMAGE3D = 437, - UIMAGECUBE = 438, - UIMAGE1DARRAY = 439, - UIMAGE2DARRAY = 440, - IMAGE1DSHADOW = 441, - IMAGE2DSHADOW = 442, - IMAGEBUFFER = 443, - IIMAGEBUFFER = 444, - UIMAGEBUFFER = 445, - IMAGE1DARRAYSHADOW = 446, - IMAGE2DARRAYSHADOW = 447, - ROW_MAJOR = 448 + TYPE_IDENTIFIER = 332, + NEW_IDENTIFIER = 333, + FLOATCONSTANT = 334, + INTCONSTANT = 335, + UINTCONSTANT = 336, + BOOLCONSTANT = 337, + FIELD_SELECTION = 338, + LEFT_OP = 339, + RIGHT_OP = 340, + INC_OP = 341, + DEC_OP = 342, + LE_OP = 343, + GE_OP = 344, + EQ_OP = 345, + NE_OP = 346, + AND_OP = 347, + OR_OP = 348, + XOR_OP = 349, + MUL_ASSIGN = 350, + DIV_ASSIGN = 351, + ADD_ASSIGN = 352, + MOD_ASSIGN = 353, + LEFT_ASSIGN = 354, + RIGHT_ASSIGN = 355, + AND_ASSIGN = 356, + XOR_ASSIGN = 357, + OR_ASSIGN = 358, + SUB_ASSIGN = 359, + INVARIANT = 360, + LOWP = 361, + MEDIUMP = 362, + HIGHP = 363, + SUPERP = 364, + PRECISION = 365, + VERSION = 366, + EXTENSION = 367, + LINE = 368, + COLON = 369, + EOL = 370, + INTERFACE = 371, + OUTPUT = 372, + PRAGMA_DEBUG_ON = 373, + PRAGMA_DEBUG_OFF = 374, + PRAGMA_OPTIMIZE_ON = 375, + PRAGMA_OPTIMIZE_OFF = 376, + PRAGMA_INVARIANT_ALL = 377, + LAYOUT_TOK = 378, + ASM = 379, + CLASS = 380, + UNION = 381, + ENUM = 382, + TYPEDEF = 383, + TEMPLATE = 384, + THIS = 385, + PACKED_TOK = 386, + GOTO = 387, + INLINE_TOK = 388, + NOINLINE = 389, + VOLATILE = 390, + PUBLIC_TOK = 391, + STATIC = 392, + EXTERN = 393, + EXTERNAL = 394, + LONG_TOK = 395, + SHORT_TOK = 396, + DOUBLE_TOK = 397, + HALF = 398, + FIXED_TOK = 399, + UNSIGNED = 400, + INPUT_TOK = 401, + OUPTUT = 402, + HVEC2 = 403, + HVEC3 = 404, + HVEC4 = 405, + DVEC2 = 406, + DVEC3 = 407, + DVEC4 = 408, + FVEC2 = 409, + FVEC3 = 410, + FVEC4 = 411, + SAMPLER2DRECT = 412, + SAMPLER3DRECT = 413, + SAMPLER2DRECTSHADOW = 414, + SIZEOF = 415, + CAST = 416, + NAMESPACE = 417, + USING = 418, + ERROR_TOK = 419, + COMMON = 420, + PARTITION = 421, + ACTIVE = 422, + SAMPLERBUFFER = 423, + FILTER = 424, + IMAGE1D = 425, + IMAGE2D = 426, + IMAGE3D = 427, + IMAGECUBE = 428, + IMAGE1DARRAY = 429, + IMAGE2DARRAY = 430, + IIMAGE1D = 431, + IIMAGE2D = 432, + IIMAGE3D = 433, + IIMAGECUBE = 434, + IIMAGE1DARRAY = 435, + IIMAGE2DARRAY = 436, + UIMAGE1D = 437, + UIMAGE2D = 438, + UIMAGE3D = 439, + UIMAGECUBE = 440, + UIMAGE1DARRAY = 441, + UIMAGE2DARRAY = 442, + IMAGE1DSHADOW = 443, + IMAGE2DSHADOW = 444, + IMAGEBUFFER = 445, + IIMAGEBUFFER = 446, + UIMAGEBUFFER = 447, + IMAGE1DARRAYSHADOW = 448, + IMAGE2DARRAYSHADOW = 449, + ROW_MAJOR = 450 }; #endif @@ -272,7 +274,7 @@ typedef union YYSTYPE /* Line 1685 of yacc.c */ -#line 276 "glsl_parser.h" +#line 278 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 3982167c482..2c0498ece7a 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -93,7 +93,8 @@ %token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D %token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY %token STRUCT VOID_TOK WHILE -%token <identifier> IDENTIFIER +%token <identifier> IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER +%type <identifier> any_identifier %token <real> FLOATCONSTANT %token <n> INTCONSTANT UINTCONSTANT BOOLCONSTANT %token <identifier> FIELD_SELECTION @@ -184,6 +185,10 @@ %type <expression> function_call_generic %type <expression> function_call_or_method %type <expression> function_call +%type <expression> method_call_generic +%type <expression> method_call_header_with_parameters +%type <expression> method_call_header_no_parameters +%type <expression> method_call_header %type <n> assignment_operator %type <n> unary_operator %type <expression> function_identifier @@ -214,31 +219,51 @@ translation_unit: _mesa_glsl_initialize_types(state); } external_declaration_list + { + delete state->symbols; + state->symbols = new(ralloc_parent(state)) glsl_symbol_table; + _mesa_glsl_initialize_types(state); + } ; version_statement: /* blank - no #version specified: defaults are already set */ | VERSION INTCONSTANT EOL { + bool supported = false; + switch ($2) { case 100: state->es_shader = true; + supported = state->Const.GLSL_100ES; + break; case 110: + supported = state->Const.GLSL_110; + break; case 120: + supported = state->Const.GLSL_120; + break; case 130: - /* FINISHME: Check against implementation support versions. */ - state->language_version = $2; - state->version_string = - talloc_asprintf(state, "GLSL%s %d.%02d", - state->es_shader ? " ES" : "", - state->language_version / 100, - state->language_version % 100); + supported = state->Const.GLSL_130; break; default: - _mesa_glsl_error(& @2, state, "Shading language version" - "%u is not supported\n", $2); + supported = false; break; } + + state->language_version = $2; + state->version_string = + ralloc_asprintf(state, "GLSL%s %d.%02d", + state->es_shader ? " ES" : "", + state->language_version / 100, + state->language_version % 100); + + if (!supported) { + _mesa_glsl_error(& @2, state, "%s is not supported. " + "Supported versions are: %s\n", + state->version_string, + state->supported_version_string); + } } ; @@ -264,8 +289,14 @@ extension_statement_list: | extension_statement_list extension_statement ; +any_identifier: + IDENTIFIER + | TYPE_IDENTIFIER + | NEW_IDENTIFIER + ; + extension_statement: - EXTENSION IDENTIFIER COLON IDENTIFIER EOL + EXTENSION any_identifier COLON any_identifier EOL { if (!_mesa_glsl_process_extension($2, & @2, $4, & @4, state)) { YYERROR; @@ -294,6 +325,7 @@ external_declaration_list: variable_identifier: IDENTIFIER + | NEW_IDENTIFIER ; primary_expression: @@ -350,7 +382,7 @@ postfix_expression: { $$ = $1; } - | postfix_expression '.' IDENTIFIER + | postfix_expression '.' any_identifier { void *ctx = state; $$ = new(ctx) ast_expression(ast_field_selection, $1, NULL, NULL); @@ -381,7 +413,7 @@ function_call: function_call_or_method: function_call_generic - | postfix_expression '.' function_call_generic + | postfix_expression '.' method_call_generic { void *ctx = state; $$ = new(ctx) ast_expression(ast_field_selection, $1, $3, NULL); @@ -428,7 +460,7 @@ function_identifier: $$ = new(ctx) ast_function_expression($1); $$->set_location(yylloc); } - | IDENTIFIER + | variable_identifier { void *ctx = state; ast_expression *callee = new(ctx) ast_expression($1); @@ -444,6 +476,44 @@ function_identifier: } ; +method_call_generic: + method_call_header_with_parameters ')' + | method_call_header_no_parameters ')' + ; + +method_call_header_no_parameters: + method_call_header VOID_TOK + | method_call_header + ; + +method_call_header_with_parameters: + method_call_header assignment_expression + { + $$ = $1; + $$->set_location(yylloc); + $$->expressions.push_tail(& $2->link); + } + | method_call_header_with_parameters ',' assignment_expression + { + $$ = $1; + $$->set_location(yylloc); + $$->expressions.push_tail(& $3->link); + } + ; + + // Grammar Note: Constructors look like methods, but lexical + // analysis recognized most of them as keywords. They are now + // recognized through "type_specifier". +method_call_header: + variable_identifier '(' + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression($1); + $$ = new(ctx) ast_function_expression(callee); + $$->set_location(yylloc); + } + ; + // Grammar Note: No traditional style type casts. unary_expression: postfix_expression @@ -694,6 +764,7 @@ constant_expression: declaration: function_prototype ';' { + state->symbols->pop_scope(); $$ = $1; } | init_declarator_list ';' @@ -731,18 +802,21 @@ function_header_with_parameters: ; function_header: - fully_specified_type IDENTIFIER '(' + fully_specified_type variable_identifier '(' { void *ctx = state; $$ = new(ctx) ast_function(); $$->set_location(yylloc); $$->return_type = $1; $$->identifier = $2; + + state->symbols->add_function(new(state) ir_function($2)); + state->symbols->push_scope(); } ; parameter_declarator: - type_specifier IDENTIFIER + type_specifier any_identifier { void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); @@ -752,7 +826,7 @@ parameter_declarator: $$->type->specifier = $1; $$->identifier = $2; } - | type_specifier IDENTIFIER '[' constant_expression ']' + | type_specifier any_identifier '[' constant_expression ']' { void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); @@ -830,7 +904,7 @@ parameter_type_specifier: init_declarator_list: single_declaration - | init_declarator_list ',' IDENTIFIER + | init_declarator_list ',' any_identifier { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, NULL); @@ -838,8 +912,9 @@ init_declarator_list: $$ = $1; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' IDENTIFIER '[' ']' + | init_declarator_list ',' any_identifier '[' ']' { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, NULL); @@ -847,8 +922,9 @@ init_declarator_list: $$ = $1; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' + | init_declarator_list ',' any_identifier '[' constant_expression ']' { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, NULL); @@ -856,8 +932,9 @@ init_declarator_list: $$ = $1; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' IDENTIFIER '[' ']' '=' initializer + | init_declarator_list ',' any_identifier '[' ']' '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, $7); @@ -865,8 +942,9 @@ init_declarator_list: $$ = $1; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' '=' initializer + | init_declarator_list ',' any_identifier '[' constant_expression ']' '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, $8); @@ -874,8 +952,9 @@ init_declarator_list: $$ = $1; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } - | init_declarator_list ',' IDENTIFIER '=' initializer + | init_declarator_list ',' any_identifier '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, $5); @@ -883,6 +962,7 @@ init_declarator_list: $$ = $1; $$->declarations.push_tail(&decl->link); + state->symbols->add_variable(new(state) ir_variable(NULL, $3, ir_var_auto)); } ; @@ -899,7 +979,7 @@ single_declaration: $$->set_location(yylloc); } } - | fully_specified_type IDENTIFIER + | fully_specified_type any_identifier { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); @@ -908,7 +988,7 @@ single_declaration: $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type IDENTIFIER '[' ']' + | fully_specified_type any_identifier '[' ']' { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, NULL); @@ -917,7 +997,7 @@ single_declaration: $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type IDENTIFIER '[' constant_expression ']' + | fully_specified_type any_identifier '[' constant_expression ']' { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, NULL); @@ -926,7 +1006,7 @@ single_declaration: $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type IDENTIFIER '[' ']' '=' initializer + | fully_specified_type any_identifier '[' ']' '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, $6); @@ -935,7 +1015,7 @@ single_declaration: $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type IDENTIFIER '[' constant_expression ']' '=' initializer + | fully_specified_type any_identifier '[' constant_expression ']' '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, $7); @@ -944,7 +1024,7 @@ single_declaration: $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | fully_specified_type IDENTIFIER '=' initializer + | fully_specified_type any_identifier '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); @@ -953,7 +1033,7 @@ single_declaration: $$->set_location(yylloc); $$->declarations.push_tail(&decl->link); } - | INVARIANT IDENTIFIER // Vertex only. + | INVARIANT variable_identifier // Vertex only. { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); @@ -1012,13 +1092,14 @@ layout_qualifier_id_list: ; layout_qualifier_id: - IDENTIFIER + any_identifier { bool got_one = false; memset(& $$, 0, sizeof($$)); - if (state->ARB_fragment_coord_conventions_enable) { + /* Layout qualifiers for ARB_fragment_coord_conventions. */ + if (!got_one && state->ARB_fragment_coord_conventions_enable) { if (strcmp($1, "origin_upper_left") == 0) { got_one = true; $$.flags.q.origin_upper_left = 1; @@ -1026,22 +1107,44 @@ layout_qualifier_id: got_one = true; $$.flags.q.pixel_center_integer = 1; } + + if (got_one && state->ARB_fragment_coord_conventions_warn) { + _mesa_glsl_warning(& @1, state, + "GL_ARB_fragment_coord_conventions layout " + "identifier `%s' used\n", $1); + } + } + + /* Layout qualifiers for AMD_conservative_depth. */ + if (!got_one && state->AMD_conservative_depth_enable) { + if (strcmp($1, "depth_any") == 0) { + got_one = true; + $$.flags.q.depth_any = 1; + } else if (strcmp($1, "depth_greater") == 0) { + got_one = true; + $$.flags.q.depth_greater = 1; + } else if (strcmp($1, "depth_less") == 0) { + got_one = true; + $$.flags.q.depth_less = 1; + } else if (strcmp($1, "depth_unchanged") == 0) { + got_one = true; + $$.flags.q.depth_unchanged = 1; + } + + if (got_one && state->AMD_conservative_depth_warn) { + _mesa_glsl_warning(& @1, state, + "GL_AMD_conservative_depth " + "layout qualifier `%s' is used\n", $1); + } } - /* If the identifier didn't match any known layout identifiers, - * emit an error. - */ if (!got_one) { _mesa_glsl_error(& @1, state, "unrecognized layout identifier " "`%s'\n", $1); YYERROR; - } else if (state->ARB_fragment_coord_conventions_warn) { - _mesa_glsl_warning(& @1, state, - "GL_ARB_fragment_coord_conventions layout " - "identifier `%s' used\n", $1); } } - | IDENTIFIER '=' INTCONSTANT + | any_identifier '=' INTCONSTANT { bool got_one = false; @@ -1229,7 +1332,7 @@ type_specifier_nonarray: $$ = new(ctx) ast_type_specifier($1); $$->set_location(yylloc); } - | IDENTIFIER + | TYPE_IDENTIFIER { void *ctx = state; $$ = new(ctx) ast_type_specifier($1); @@ -1325,11 +1428,12 @@ precision_qualifier: ; struct_specifier: - STRUCT IDENTIFIER '{' struct_declaration_list '}' + STRUCT any_identifier '{' struct_declaration_list '}' { void *ctx = state; $$ = new(ctx) ast_struct_specifier($2, $4); $$->set_location(yylloc); + state->symbols->add_type($2, glsl_type::void_type); } | STRUCT '{' struct_declaration_list '}' { @@ -1381,13 +1485,14 @@ struct_declarator_list: ; struct_declarator: - IDENTIFIER + any_identifier { void *ctx = state; $$ = new(ctx) ast_declaration($1, false, NULL, NULL); $$->set_location(yylloc); + state->symbols->add_variable(new(state) ir_variable(NULL, $1, ir_var_auto)); } - | IDENTIFIER '[' constant_expression ']' + | any_identifier '[' constant_expression ']' { void *ctx = state; $$ = new(ctx) ast_declaration($1, true, $3, NULL); @@ -1427,11 +1532,16 @@ compound_statement: $$ = new(ctx) ast_compound_statement(true, NULL); $$->set_location(yylloc); } - | '{' statement_list '}' + | '{' + { + state->symbols->push_scope(); + } + statement_list '}' { void *ctx = state; - $$ = new(ctx) ast_compound_statement(true, $2); + $$ = new(ctx) ast_compound_statement(true, $3); $$->set_location(yylloc); + state->symbols->pop_scope(); } ; @@ -1519,7 +1629,7 @@ condition: { $$ = (ast_node *) $1; } - | fully_specified_type IDENTIFIER '=' initializer + | fully_specified_type any_identifier '=' initializer { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); @@ -1639,5 +1749,7 @@ function_definition: $$->set_location(yylloc); $$->prototype = $1; $$->body = $2; + + state->symbols->pop_scope(); } ; diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 77885d4e1e3..d7a37aef46d 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -26,10 +26,10 @@ #include <assert.h> extern "C" { -#include <talloc.h> #include "main/core.h" /* for struct gl_context */ } +#include "ralloc.h" #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" @@ -48,7 +48,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx, this->scanner = NULL; this->translation_unit.make_empty(); this->symbols = new(mem_ctx) glsl_symbol_table; - this->info_log = talloc_strdup(mem_ctx, ""); + this->info_log = ralloc_strdup(mem_ctx, ""); this->error = false; this->loop_or_switch_nesting = NULL; @@ -79,6 +79,38 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx, this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + + /* Note: Once the OpenGL 3.0 'forward compatible' context or the OpenGL 3.2 + * Core context is supported, this logic will need change. Older versions of + * GLSL are no longer supported outside the compatibility contexts of 3.x. + */ + this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2) + || ctx->Extensions.ARB_ES2_compatibility; + this->Const.GLSL_110 = (ctx->API == API_OPENGL); + this->Const.GLSL_120 = (ctx->API == API_OPENGL) + && (ctx->Const.GLSLVersion >= 120); + this->Const.GLSL_130 = (ctx->API == API_OPENGL) + && (ctx->Const.GLSLVersion >= 130); + + const unsigned lowest_version = + (ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility + ? 100 : 110; + const unsigned highest_version = + (ctx->API == API_OPENGL) ? ctx->Const.GLSLVersion : 100; + char *supported = ralloc_strdup(this, ""); + + for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) { + const char *const prefix = (ver == lowest_version) + ? "" + : ((ver == highest_version) ? ", and " : ", "); + + ralloc_asprintf_append(& supported, "%s%d.%02d%s", + prefix, + ver / 100, ver % 100, + (ver == 100) ? " ES" : ""); + } + + this->supported_version_string = supported; } const char * @@ -104,15 +136,14 @@ _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, state->error = true; assert(state->info_log != NULL); - state->info_log = talloc_asprintf_append(state->info_log, - "%u:%u(%u): error: ", + ralloc_asprintf_append(&state->info_log, "%u:%u(%u): error: ", locp->source, locp->first_line, locp->first_column); va_start(ap, fmt); - state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + ralloc_vasprintf_append(&state->info_log, fmt, ap); va_end(ap); - state->info_log = talloc_strdup_append(state->info_log, "\n"); + ralloc_strcat(&state->info_log, "\n"); } @@ -123,15 +154,14 @@ _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state, va_list ap; assert(state->info_log != NULL); - state->info_log = talloc_asprintf_append(state->info_log, - "%u:%u(%u): warning: ", + ralloc_asprintf_append(&state->info_log, "%u:%u(%u): warning: ", locp->source, locp->first_line, locp->first_column); va_start(ap, fmt); - state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + ralloc_vasprintf_append(&state->info_log, fmt, ap); va_end(ap); - state->info_log = talloc_strdup_append(state->info_log, "\n"); + ralloc_strcat(&state->info_log, "\n"); } @@ -219,6 +249,13 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, state->ARB_shader_stencil_export_warn = (ext_mode == extension_warn); unsupported = !state->extensions->ARB_shader_stencil_export; } + } else if (strcmp(name, "GL_AMD_conservative_depth") == 0) { + /* The AMD_conservative spec does not forbid requiring the extension in + * the vertex shader. + */ + state->AMD_conservative_depth_enable = (ext_mode != extension_disable); + state->AMD_conservative_depth_warn = (ext_mode == extension_warn); + unsupported = !state->extensions->AMD_conservative_depth; } else { unsupported = true; } @@ -705,7 +742,7 @@ ast_struct_specifier::ast_struct_specifier(char *identifier, { if (identifier == NULL) { static unsigned anon_count = 1; - identifier = talloc_asprintf(this, "#anon_struct_%04x", anon_count); + identifier = ralloc_asprintf(this, "#anon_struct_%04x", anon_count); anon_count++; } name = identifier; @@ -727,6 +764,7 @@ do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iteration progress = do_if_simplification(ir) || progress; progress = do_discard_simplification(ir) || progress; progress = do_copy_propagation(ir) || progress; + /*progress = do_copy_propagation_elements(ir) || progress;*/ if (linked) progress = do_dead_code(ir) || progress; else diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 030d27a2627..10cb673c694 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -31,7 +31,7 @@ #ifdef __cplusplus -#include <cstdlib> +#include <stdlib.h> #include "glsl_symbol_table.h" enum _mesa_glsl_parser_targets { @@ -46,21 +46,21 @@ struct _mesa_glsl_parse_state { _mesa_glsl_parse_state(struct gl_context *ctx, GLenum target, void *mem_ctx); - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { - void *mem = talloc_zero_size(ctx, size); + void *mem = rzalloc_size(ctx, size); assert(mem != NULL); return mem; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. */ + * ralloc_free in that case. */ static void operator delete(void *mem) { - talloc_free(mem); + ralloc_free(mem); } void *scanner; @@ -73,6 +73,16 @@ struct _mesa_glsl_parse_state { enum _mesa_glsl_parser_targets target; /** + * Printable list of GLSL versions supported by the current context + * + * \note + * This string should probably be generated per-context instead of per + * invokation of the compiler. This should be changed when the method of + * tracking supported GLSL versions changes. + */ + const char *supported_version_string; + + /** * Implementation defined limits that affect built-in variables, etc. * * \sa struct gl_constants (in mtypes.h) @@ -93,6 +103,22 @@ struct _mesa_glsl_parse_state { /* ARB_draw_buffers */ unsigned MaxDrawBuffers; + + /** + * Set of GLSL versions supported by the current context + * + * Knowing that version X is supported doesn't mean that versions before + * X are also supported. Version 1.00 is only supported in an ES2 + * context or when GL_ARB_ES2_compatibility is supported. In an OpenGL + * 3.0 "forward compatible" context, GLSL 1.10 and 1.20 are \b not + * supported. + */ + /*@{*/ + unsigned GLSL_100ES:1; + unsigned GLSL_110:1; + unsigned GLSL_120:1; + unsigned GLSL_130:1; + /*@}*/ } Const; /** @@ -144,6 +170,8 @@ struct _mesa_glsl_parse_state { unsigned EXT_texture_array_warn:1; unsigned ARB_shader_stencil_export_enable:1; unsigned ARB_shader_stencil_export_warn:1; + unsigned AMD_conservative_depth_enable:1; + unsigned AMD_conservative_depth_warn:1; /*@}*/ /** Extensions supported by the OpenGL implementation. */ diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index 6fcfe07b9c2..2f291d4f97f 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -26,19 +26,19 @@ class symbol_table_entry { public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { - void *entry = talloc_size(ctx, size); + void *entry = ralloc_size(ctx, size); assert(entry != NULL); return entry; } - /* If the user *does* call delete, that's OK, we will just talloc_free. */ + /* If the user *does* call delete, that's OK, we will just ralloc_free. */ static void operator delete(void *entry) { - talloc_free(entry); + ralloc_free(entry); } symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} @@ -54,13 +54,13 @@ glsl_symbol_table::glsl_symbol_table() { this->language_version = 120; this->table = _mesa_symbol_table_ctor(); - this->mem_ctx = talloc_init("symbol table entries"); + this->mem_ctx = ralloc_context(NULL); } glsl_symbol_table::~glsl_symbol_table() { _mesa_symbol_table_dtor(table); - talloc_free(mem_ctx); + ralloc_free(mem_ctx); } void glsl_symbol_table::push_scope() diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 28a44ebe91c..637bc033b93 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -44,36 +44,34 @@ class symbol_table_entry; */ struct glsl_symbol_table { private: - static int + static void _glsl_symbol_table_destructor (glsl_symbol_table *table) { table->~glsl_symbol_table(); - - return 0; } public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { void *table; - table = talloc_size(ctx, size); + table = ralloc_size(ctx, size); assert(table != NULL); - talloc_set_destructor(table, (int (*)(void*)) _glsl_symbol_table_destructor); + ralloc_set_destructor(table, (void (*)(void*)) _glsl_symbol_table_destructor); return table; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. Here, C++ will have already called the - * destructor so tell talloc not to do that again. */ + * ralloc_free in that case. Here, C++ will have already called the + * destructor so tell ralloc not to do that again. */ static void operator delete(void *table) { - talloc_set_destructor(table, NULL); - talloc_free(table); + ralloc_set_destructor(table, NULL); + ralloc_free(table); } glsl_symbol_table(); diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 95b85926482..76b4f3e4cb0 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include <cstdio> +#include <stdio.h> #include <stdlib.h> #include "main/core.h" /* for Elements */ #include "glsl_symbol_table.h" @@ -37,10 +37,10 @@ hash_table *glsl_type::record_types = NULL; void *glsl_type::mem_ctx = NULL; void -glsl_type::init_talloc_type_ctx(void) +glsl_type::init_ralloc_type_ctx(void) { if (glsl_type::mem_ctx == NULL) { - glsl_type::mem_ctx = talloc_autofree_context(); + glsl_type::mem_ctx = ralloc_autofree_context(); assert(glsl_type::mem_ctx != NULL); } } @@ -55,8 +55,8 @@ glsl_type::glsl_type(GLenum gl_type, vector_elements(vector_elements), matrix_columns(matrix_columns), length(0) { - init_talloc_type_ctx(); - this->name = talloc_strdup(this->mem_ctx, name); + init_ralloc_type_ctx(); + this->name = ralloc_strdup(this->mem_ctx, name); /* Neither dimension is zero or both dimensions are zero. */ assert((vector_elements == 0) == (matrix_columns == 0)); @@ -73,8 +73,8 @@ glsl_type::glsl_type(GLenum gl_type, vector_elements(0), matrix_columns(0), length(0) { - init_talloc_type_ctx(); - this->name = talloc_strdup(this->mem_ctx, name); + init_ralloc_type_ctx(); + this->name = ralloc_strdup(this->mem_ctx, name); memset(& fields, 0, sizeof(fields)); } @@ -88,13 +88,13 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, { unsigned int i; - init_talloc_type_ctx(); - this->name = talloc_strdup(this->mem_ctx, name); - this->fields.structure = talloc_array(this->mem_ctx, + init_ralloc_type_ctx(); + this->name = ralloc_strdup(this->mem_ctx, name); + this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; - this->fields.structure[i].name = talloc_strdup(this->fields.structure, + this->fields.structure[i].name = ralloc_strdup(this->fields.structure, fields[i].name); } } @@ -264,7 +264,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : * NUL. */ const unsigned name_length = strlen(array->name) + 10 + 3; - char *const n = (char *) talloc_size(this->mem_ctx, name_length); + char *const n = (char *) ralloc_size(this->mem_ctx, name_length); if (length == 0) snprintf(n, name_length, "%s[]", array->name); @@ -354,7 +354,7 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) if (t == NULL) { t = new glsl_type(base, array_size); - hash_table_insert(array_types, (void *) t, talloc_strdup(mem_ctx, key)); + hash_table_insert(array_types, (void *) t, ralloc_strdup(mem_ctx, key)); } assert(t->base_type == GLSL_TYPE_ARRAY); diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 57e7b09d98c..61bf5e0cfd2 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -26,14 +26,15 @@ #ifndef GLSL_TYPES_H #define GLSL_TYPES_H -#include <cstring> -#include <cassert> +#include <string.h> +#include <assert.h> extern "C" { #include "GL/gl.h" -#include <talloc.h> } +#include "ralloc.h" + struct _mesa_glsl_parse_state; struct glsl_symbol_table; @@ -77,28 +78,28 @@ struct glsl_type { * and \c GLSL_TYPE_UINT are valid. */ - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'mem_ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'mem_ctx' (or any of its ancestors). */ static void* operator new(size_t size) { if (glsl_type::mem_ctx == NULL) { - glsl_type::mem_ctx = talloc_init("glsl_type"); + glsl_type::mem_ctx = ralloc_context(NULL); assert(glsl_type::mem_ctx != NULL); } void *type; - type = talloc_size(glsl_type::mem_ctx, size); + type = ralloc_size(glsl_type::mem_ctx, size); assert(type != NULL); return type; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. */ + * ralloc_free in that case. */ static void operator delete(void *type) { - talloc_free(type); + ralloc_free(type); } /** @@ -386,13 +387,13 @@ struct glsl_type { private: /** - * talloc context for all glsl_type allocations + * ralloc context for all glsl_type allocations * * Set on the first call to \c glsl_type::new. */ static void *mem_ctx; - void init_talloc_type_ctx(void); + void init_ralloc_type_ctx(void); /** Constructor for vector and matrix types */ glsl_type(GLenum gl_type, diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 460d43b02e1..fc356ba5275 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -472,6 +472,22 @@ const char *ir_expression::operator_string() return operator_string(this->operation); } +const char* +depth_layout_string(ir_depth_layout layout) +{ + switch(layout) { + case ir_depth_layout_none: return ""; + case ir_depth_layout_any: return "depth_any"; + case ir_depth_layout_greater: return "depth_greater"; + case ir_depth_layout_less: return "depth_less"; + case ir_depth_layout_unchanged: return "depth_unchanged"; + + default: + assert(0); + return ""; + } +} + ir_expression_operation ir_expression::get_operator(const char *str) { @@ -562,7 +578,7 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) || type->is_record() || type->is_array()); if (type->is_array()) { - this->array_elements = talloc_array(this, ir_constant *, type->length); + this->array_elements = ralloc_array(this, ir_constant *, type->length); unsigned i = 0; foreach_list(node, value_list) { ir_constant *value = (ir_constant *) node; @@ -1020,7 +1036,7 @@ ir_dereference_array::ir_dereference_array(ir_rvalue *value, ir_dereference_array::ir_dereference_array(ir_variable *var, ir_rvalue *array_index) { - void *ctx = talloc_parent(var); + void *ctx = ralloc_parent(var); this->ir_type = ir_type_dereference_array; this->array_index = array_index; @@ -1053,7 +1069,7 @@ ir_dereference_record::ir_dereference_record(ir_rvalue *value, { this->ir_type = ir_type_dereference_record; this->record = value; - this->field = talloc_strdup(this, field); + this->field = ralloc_strdup(this, field); this->type = (this->record != NULL) ? this->record->type->field_type(field) : glsl_type::error_type; } @@ -1062,11 +1078,11 @@ ir_dereference_record::ir_dereference_record(ir_rvalue *value, ir_dereference_record::ir_dereference_record(ir_variable *var, const char *field) { - void *ctx = talloc_parent(var); + void *ctx = ralloc_parent(var); this->ir_type = ir_type_dereference_record; this->record = new(ctx) ir_dereference_variable(var); - this->field = talloc_strdup(this, field); + this->field = ralloc_strdup(this, field); this->type = (this->record != NULL) ? this->record->type->field_type(field) : glsl_type::error_type; } @@ -1229,7 +1245,7 @@ ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask) ir_swizzle * ir_swizzle::create(ir_rvalue *val, const char *str, unsigned vector_length) { - void *ctx = talloc_parent(val); + void *ctx = ralloc_parent(val); /* For each possible swizzle character, this table encodes the value in * \c idx_map that represents the 0th element of the vector. For invalid @@ -1318,13 +1334,14 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, { this->ir_type = ir_type_variable; this->type = type; - this->name = talloc_strdup(this, name); + this->name = ralloc_strdup(this, name); this->explicit_location = false; this->location = -1; this->warn_extension = NULL; this->constant_value = NULL; this->origin_upper_left = false; this->pixel_center_integer = false; + this->depth_layout = ir_depth_layout_none; this->used = false; if (type && type->base_type == GLSL_TYPE_SAMPLER) @@ -1362,6 +1379,21 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type) } +static bool +modes_match(unsigned a, unsigned b) +{ + if (a == b) + return true; + + /* Accept "in" vs. "const in" */ + if ((a == ir_var_const_in && b == ir_var_in) || + (b == ir_var_const_in && a == ir_var_in)) + return true; + + return false; +} + + const char * ir_function_signature::qualifiers_match(exec_list *params) { @@ -1374,7 +1406,7 @@ ir_function_signature::qualifiers_match(exec_list *params) ir_variable *b = (ir_variable *)iter_b.get(); if (a->read_only != b->read_only || - a->mode != b->mode || + !modes_match(a->mode, b->mode) || a->interpolation != b->interpolation || a->centroid != b->centroid) { @@ -1409,7 +1441,7 @@ ir_function_signature::replace_parameters(exec_list *new_params) ir_function::ir_function(const char *name) { this->ir_type = ir_type_function; - this->name = talloc_strdup(this, name); + this->name = ralloc_strdup(this, name); } @@ -1475,7 +1507,7 @@ steal_memory(ir_instruction *ir, void *new_ctx) } } - talloc_steal(new_ctx, ir); + ralloc_steal(new_ctx, ir); } diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 7b83c2836ee..f2f902c0a77 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -26,13 +26,10 @@ #ifndef IR_H #define IR_H -#include <cstdio> -#include <cstdlib> - -extern "C" { -#include <talloc.h> -} +#include <stdio.h> +#include <stdlib.h> +#include "ralloc.h" #include "glsl_types.h" #include "list.h" #include "ir_visitor.h" @@ -225,6 +222,7 @@ enum ir_variable_mode { ir_var_in, ir_var_out, ir_var_inout, + ir_var_const_in, /**< "in" param that must be a constant expression */ ir_var_system_value, /**< Ex: front-face, instance-id, etc. */ ir_var_temporary /**< Temporary variable generated during compilation. */ }; @@ -235,6 +233,25 @@ enum ir_variable_interpolation { ir_var_noperspective }; +/** + * \brief Layout qualifiers for gl_FragDepth. + * + * The AMD_conservative_depth extension allows gl_FragDepth to be redeclared + * with a layout qualifier. + */ +enum ir_depth_layout { + ir_depth_layout_none, /**< No depth layout is specified. */ + ir_depth_layout_any, + ir_depth_layout_greater, + ir_depth_layout_less, + ir_depth_layout_unchanged +}; + +/** + * \brief Convert depth layout qualifier to string. + */ +const char* +depth_layout_string(ir_depth_layout layout); class ir_variable : public ir_instruction { public: @@ -335,6 +352,14 @@ public: /*@}*/ /** + * \brief Layout qualifier for gl_FragDepth. + * + * This is not equal to \c ir_depth_layout_none if and only if this + * variable is \c gl_FragDepth and a layout qualifier is specified. + */ + ir_depth_layout depth_layout; + + /** * Was the location explicitly set in the shader? * * If the location is explicitly set in the shader, it \b cannot be changed @@ -959,7 +984,7 @@ public: /** * Get a generic ir_call object when an error occurs * - * Any allocation will be performed with 'ctx' as talloc owner. + * Any allocation will be performed with 'ctx' as ralloc owner. */ static ir_call *get_error_instruction(void *ctx); @@ -1166,21 +1191,21 @@ enum ir_texture_opcode { * selected from \c ir_texture_opcodes. In the printed IR, these will * appear as: * - * Texel offset - * | Projection divisor - * | | Shadow comparitor - * | | | - * v v v - * (tex (sampler) (coordinate) (0 0 0) (1) ( )) - * (txb (sampler) (coordinate) (0 0 0) (1) ( ) (bias)) - * (txl (sampler) (coordinate) (0 0 0) (1) ( ) (lod)) - * (txd (sampler) (coordinate) (0 0 0) (1) ( ) (dPdx dPdy)) - * (txf (sampler) (coordinate) (0 0 0) (lod)) + * Texel offset (0 or an expression) + * | Projection divisor + * | | Shadow comparitor + * | | | + * v v v + * (tex <sampler> <coordinate> 0 1 ( )) + * (txb <sampler> <coordinate> 0 1 ( ) <bias>) + * (txl <sampler> <coordinate> 0 1 ( ) <lod>) + * (txd <sampler> <coordinate> 0 1 ( ) (dPdx dPdy)) + * (txf <sampler> <coordinate> 0 <lod>) */ class ir_texture : public ir_rvalue { public: ir_texture(enum ir_texture_opcode op) - : op(op), projector(NULL), shadow_comparitor(NULL) + : op(op), projector(NULL), shadow_comparitor(NULL), offset(NULL) { this->ir_type = ir_type_texture; } @@ -1234,8 +1259,8 @@ public: */ ir_rvalue *shadow_comparitor; - /** Explicit texel offsets. */ - signed char offsets[3]; + /** Texel offset. */ + ir_rvalue *offset; union { ir_rvalue *lod; /**< Floating point LOD */ diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 1522af682bb..2c0574dc6bf 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -217,8 +217,8 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const new_tex->shadow_comparitor = this->shadow_comparitor->clone(mem_ctx, ht); } - for (int i = 0; i < 3; i++) - new_tex->offsets[i] = this->offsets[i]; + if (this->offset != NULL) + new_tex->offset = this->offset->clone(mem_ctx, ht); switch (this->op) { case ir_tex: @@ -346,7 +346,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const ir_constant *c = new(mem_ctx) ir_constant; c->type = this->type; - c->array_elements = talloc_array(c, ir_constant *, this->type->length); + c->array_elements = ralloc_array(c, ir_constant *, this->type->length); for (unsigned i = 0; i < this->type->length; i++) { c->array_elements[i] = this->array_elements[i]->clone(mem_ctx, NULL); } diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 4fd6d09a3af..2a308489656 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -86,7 +86,7 @@ ir_expression::constant_expression_value() components = op[1]->type->components(); } - void *ctx = talloc_parent(this); + void *ctx = ralloc_parent(this); /* Handle array operations here, rather than below. */ if (op[0]->type->is_array()) { @@ -507,6 +507,7 @@ ir_expression::constant_expression_value() break; case ir_binop_div: + /* FINISHME: Emit warning when division-by-zero is detected. */ assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); for (unsigned c = 0, c0 = 0, c1 = 0; c < components; @@ -514,10 +515,18 @@ ir_expression::constant_expression_value() switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: - data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1]; + if (op[1]->value.u[c1] == 0) { + data.u[c] = 0; + } else { + data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1]; + } break; case GLSL_TYPE_INT: - data.i[c] = op[0]->value.i[c0] / op[1]->value.i[c1]; + if (op[1]->value.i[c1] == 0) { + data.i[c] = 0; + } else { + data.i[c] = op[0]->value.i[c0] / op[1]->value.i[c1]; + } break; case GLSL_TYPE_FLOAT: data.f[c] = op[0]->value.f[c0] / op[1]->value.f[c1]; @@ -529,6 +538,7 @@ ir_expression::constant_expression_value() break; case ir_binop_mod: + /* FINISHME: Emit warning when division-by-zero is detected. */ assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); for (unsigned c = 0, c0 = 0, c1 = 0; c < components; @@ -536,10 +546,18 @@ ir_expression::constant_expression_value() switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: - data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1]; + if (op[1]->value.u[c1] == 0) { + data.u[c] = 0; + } else { + data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1]; + } break; case GLSL_TYPE_INT: - data.i[c] = op[0]->value.i[c0] % op[1]->value.i[c1]; + if (op[1]->value.i[c1] == 0) { + data.i[c] = 0; + } else { + data.i[c] = op[0]->value.i[c0] % op[1]->value.i[c1]; + } break; case GLSL_TYPE_FLOAT: /* We don't use fmod because it rounds toward zero; GLSL specifies @@ -845,7 +863,7 @@ ir_swizzle::constant_expression_value() } } - void *ctx = talloc_parent(this); + void *ctx = ralloc_parent(this); return new(ctx) ir_constant(this->type, &data); } return NULL; @@ -868,7 +886,7 @@ ir_dereference_variable::constant_expression_value() if (!var->constant_value) return NULL; - return var->constant_value->clone(talloc_parent(var), NULL); + return var->constant_value->clone(ralloc_parent(var), NULL); } @@ -879,7 +897,7 @@ ir_dereference_array::constant_expression_value() ir_constant *idx = this->array_index->constant_expression_value(); if ((array != NULL) && (idx != NULL)) { - void *ctx = talloc_parent(this); + void *ctx = ralloc_parent(this); if (array->type->is_matrix()) { /* Array access of a matrix results in a vector. */ @@ -984,7 +1002,7 @@ ir_call::constant_expression_value() * - Fill "data" with appopriate constant data * - Return an ir_constant directly. */ - void *mem_ctx = talloc_parent(this); + void *mem_ctx = ralloc_parent(this); ir_expression *expr = NULL; ir_constant_data data; diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 7b1b8dbfef1..0b7c537bd8a 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -78,7 +78,7 @@ ir_expression_flattening_visitor::handle_rvalue(ir_rvalue **rvalue) if (!ir || !this->predicate(ir)) return; - void *ctx = talloc_parent(ir); + void *ctx = ralloc_parent(ir); var = new(ctx) ir_variable(ir->type, "flattening_tmp", ir_var_temporary); base_ir->insert_before(var); diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 8db70119ec2..caee9296af9 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -123,6 +123,7 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) assert(0); return -1; + case ir_var_const_in: case ir_var_in: score = type_compare(param->type, actual->type); break; diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index be8b36a7cf8..4a607dc8749 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -187,6 +187,12 @@ ir_texture::accept(ir_hierarchical_visitor *v) return (s == visit_continue_with_parent) ? visit_continue : s; } + if (this->offset) { + s = this->offset->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + switch (this->op) { case ir_tex: break; diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp index 4e0b30aa90e..3585bf6b24b 100644 --- a/src/glsl/ir_import_prototypes.cpp +++ b/src/glsl/ir_import_prototypes.cpp @@ -27,7 +27,6 @@ * * \author Ian Romanick */ -#include <cstdio> #include "ir.h" #include "glsl_symbol_table.h" @@ -109,7 +108,7 @@ private: * \param dest Destination instruction stream where new \c ir_function and * \c ir_function_signature nodes will be stored * \param symbols Symbol table where new functions will be stored - * \param mem_ctx talloc memory context used for new allocations + * \param mem_ctx ralloc memory context used for new allocations */ void import_prototypes(const exec_list *source, exec_list *dest, diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index dbc9f4ab975..dd265673c55 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -43,6 +43,7 @@ bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); bool do_copy_propagation(exec_list *instructions); +bool do_copy_propagation_elements(exec_list *instructions); bool do_constant_propagation(exec_list *instructions); bool do_dead_code(exec_list *instructions); bool do_dead_code_local(exec_list *instructions); diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index c56bafd00c5..82ccc722fa2 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -97,7 +97,7 @@ void ir_print_visitor::visit(ir_variable *ir) const char *const cent = (ir->centroid) ? "centroid " : ""; const char *const inv = (ir->invariant) ? "invariant " : ""; const char *const mode[] = { "", "uniform ", "in ", "out ", "inout ", - "temporary " }; + "const_in ", "sys ", "temporary " }; const char *const interp[] = { "", "flat", "noperspective" }; printf("(%s%s%s%s) ", @@ -192,7 +192,15 @@ void ir_print_visitor::visit(ir_texture *ir) ir->coordinate->accept(this); - printf(" (%d %d %d) ", ir->offsets[0], ir->offsets[1], ir->offsets[2]); + printf(" "); + + if (ir->offset != NULL) { + ir->offset->accept(this); + } else { + printf("0"); + } + + printf(" "); if (ir->op != ir_txf) { if (ir->projector) diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 40901dc6c92..af85e06ae0e 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -21,10 +21,6 @@ * DEALINGS IN THE SOFTWARE. */ -extern "C" { -#include <talloc.h> -} - #include "ir_reader.h" #include "glsl_parser_extras.h" #include "glsl_types.h" @@ -96,7 +92,7 @@ ir_reader::read(exec_list *instructions, const char *src, bool scan_for_protos) } read_instructions(instructions, expr, NULL); - talloc_free(expr); + ralloc_free(expr); if (debug) validate_ir_tree(instructions); @@ -110,21 +106,19 @@ ir_reader::ir_read_error(s_expression *expr, const char *fmt, ...) state->error = true; if (state->current_function != NULL) - state->info_log = talloc_asprintf_append(state->info_log, - "In function %s:\n", - state->current_function->function_name()); - state->info_log = talloc_strdup_append(state->info_log, "error: "); + ralloc_asprintf_append(&state->info_log, "In function %s:\n", + state->current_function->function_name()); + ralloc_strcat(&state->info_log, "error: "); va_start(ap, fmt); - state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + ralloc_vasprintf_append(&state->info_log, fmt, ap); va_end(ap); - state->info_log = talloc_strdup_append(state->info_log, "\n"); + ralloc_strcat(&state->info_log, "\n"); if (expr != NULL) { - state->info_log = talloc_strdup_append(state->info_log, - "...in this context:\n "); + ralloc_strcat(&state->info_log, "...in this context:\n "); expr->print(); - state->info_log = talloc_strdup_append(state->info_log, "\n\n"); + ralloc_strcat(&state->info_log, "\n\n"); } } @@ -403,6 +397,8 @@ ir_reader::read_declaration(s_expression *expr) var->mode = ir_var_auto; } else if (strcmp(qualifier->value(), "in") == 0) { var->mode = ir_var_in; + } else if (strcmp(qualifier->value(), "const_in") == 0) { + var->mode = ir_var_const_in; } else if (strcmp(qualifier->value(), "out") == 0) { var->mode = ir_var_out; } else if (strcmp(qualifier->value(), "inout") == 0) { @@ -875,12 +871,12 @@ ir_reader::read_texture(s_expression *expr) s_symbol *tag = NULL; s_expression *s_sampler = NULL; s_expression *s_coord = NULL; - s_list *s_offset = NULL; + s_expression *s_offset = NULL; s_expression *s_proj = NULL; s_list *s_shadow = NULL; s_expression *s_lod = NULL; - ir_texture_opcode op; + ir_texture_opcode op = ir_tex; /* silence warning */ s_pattern tex_pattern[] = { "tex", s_sampler, s_coord, s_offset, s_proj, s_shadow }; @@ -897,6 +893,9 @@ ir_reader::read_texture(s_expression *expr) op = ir_texture::get_opcode(tag->value()); if (op == -1) return NULL; + } else { + ir_read_error(NULL, "unexpected texture pattern"); + return NULL; } ir_texture *tex = new(mem_ctx) ir_texture(op); @@ -918,18 +917,15 @@ ir_reader::read_texture(s_expression *expr) return NULL; } - // Read texel offset, i.e. (0 0 0) - s_int *offset_x; - s_int *offset_y; - s_int *offset_z; - s_pattern offset_pat[] = { offset_x, offset_y, offset_z }; - if (!MATCH(s_offset, offset_pat)) { - ir_read_error(s_offset, "expected (<int> <int> <int>)"); - return NULL; + // Read texel offset - either 0 or an rvalue. + s_int *si_offset = SX_AS_INT(s_offset); + if (si_offset == NULL || si_offset->value() != 0) { + tex->offset = read_rvalue(s_offset); + if (tex->offset == NULL) { + ir_read_error(s_offset, "expected 0 or an expression"); + return NULL; + } } - tex->offsets[0] = offset_x->value(); - tex->offsets[1] = offset_y->value(); - tex->offsets[2] = offset_z->value(); if (op != ir_txf) { s_int *proj_as_int = SX_AS_INT(s_proj); diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp index 773bfcfa3ec..ed6c7cb6a1a 100644 --- a/src/glsl/ir_rvalue_visitor.cpp +++ b/src/glsl/ir_rvalue_visitor.cpp @@ -53,6 +53,7 @@ ir_rvalue_visitor::visit_leave(ir_texture *ir) handle_rvalue(&ir->coordinate); handle_rvalue(&ir->projector); handle_rvalue(&ir->shadow_comparitor); + handle_rvalue(&ir->offset); switch (ir->op) { case ir_tex: diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 5b055f64d38..44d7549ea28 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -179,7 +179,7 @@ ir_validate::visit_enter(ir_function *ir) ir_visitor_status ir_validate::visit_leave(ir_function *ir) { - assert(talloc_parent(ir->name) == ir); + assert(ralloc_parent(ir->name) == ir); this->current_function = NULL; return visit_continue; @@ -450,7 +450,7 @@ ir_validate::visit(ir_variable *ir) * declared before it is dereferenced. */ if (ir->name) - assert(talloc_parent(ir->name) == ir); + assert(ralloc_parent(ir->name) == ir); hash_table_insert(ht, ir, ir); return visit_continue; diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 73da28faf4f..18a3e0fb0d9 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -45,6 +45,7 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot, switch (var->mode) { case ir_var_auto: case ir_var_in: + case ir_var_const_in: case ir_var_uniform: case ir_var_system_value: var->read_only = true; diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h index 8b43bad71f8..906135a9e1e 100644 --- a/src/glsl/ir_variable_refcount.h +++ b/src/glsl/ir_variable_refcount.h @@ -54,13 +54,13 @@ class ir_variable_refcount_visitor : public ir_hierarchical_visitor { public: ir_variable_refcount_visitor(void) { - this->mem_ctx = talloc_new(NULL); + this->mem_ctx = ralloc_context(NULL); this->variable_list.make_empty(); } ~ir_variable_refcount_visitor(void) { - talloc_free(this->mem_ctx); + ralloc_free(this->mem_ctx); } virtual ir_visitor_status visit(ir_variable *); diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 05930edb80e..5851c14d624 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -21,14 +21,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include <cstdlib> -#include <cstdio> -#include <cstdarg> - -extern "C" { -#include <talloc.h> -} - #include "main/core.h" #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" @@ -185,6 +177,18 @@ public: var = ir->var->clone(linked, NULL); linked->symbols->add_variable(var); linked->ir->push_head(var); + } else if (var->type->is_array()) { + /* It is possible to have a global array declared in multiple + * shaders without a size. The array is implicitly sized by the + * maximal access to it in *any* shader. Because of this, we + * need to track the maximal access to the array as linking pulls + * more functions in that access the array. + */ + var->max_array_access = + MAX2(var->max_array_access, ir->var->max_array_access); + + if (var->type->length == 0 && ir->var->type->length != 0) + var->type = ir->var->type; } ir->var = var; diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c906d744212..7db5c5e8d53 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -63,14 +63,6 @@ * * \author Ian Romanick <[email protected]> */ -#include <cstdlib> -#include <cstdio> -#include <cstdarg> -#include <climits> - -extern "C" { -#include <talloc.h> -} #include "main/core.h" #include "glsl_symbol_table.h" @@ -176,9 +168,9 @@ linker_error_printf(gl_shader_program *prog, const char *fmt, ...) { va_list ap; - prog->InfoLog = talloc_strdup_append(prog->InfoLog, "error: "); + ralloc_strcat(&prog->InfoLog, "error: "); va_start(ap, fmt); - prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, ap); + ralloc_vasprintf_append(&prog->InfoLog, fmt, ap); va_end(ap); } @@ -303,6 +295,7 @@ mode_string(const ir_variable *var) case ir_var_out: return "shader output"; case ir_var_inout: return "shader inout"; + case ir_var_const_in: case ir_var_temporary: default: assert(!"Should not get here."); @@ -360,11 +353,8 @@ cross_validate_globals(struct gl_shader_program *prog, && (var->type->fields.array == existing->type->fields.array) && ((var->type->length == 0) || (existing->type->length == 0))) { - if (existing->type->length == 0) { + if (var->type->length != 0) { existing->type = var->type; - existing->max_array_access = - MAX2(existing->max_array_access, - var->max_array_access); } } else { linker_error_printf(prog, "%s `%s' declared as type " @@ -389,6 +379,32 @@ cross_validate_globals(struct gl_shader_program *prog, existing->explicit_location = true; } + /* Validate layout qualifiers for gl_FragDepth. + * + * From the AMD_conservative_depth spec: + * "If gl_FragDepth is redeclared in any fragment shader in + * a program, it must be redeclared in all fragment shaders in that + * program that have static assignments to gl_FragDepth. All + * redeclarations of gl_FragDepth in all fragment shaders in + * a single program must have the same set of qualifiers." + */ + if (strcmp(var->name, "gl_FragDepth") == 0) { + bool layout_declared = var->depth_layout != ir_depth_layout_none; + bool layout_differs = var->depth_layout != existing->depth_layout; + if (layout_declared && layout_differs) { + linker_error_printf(prog, + "All redeclarations of gl_FragDepth in all fragment shaders " + "in a single program must have the same set of qualifiers."); + } + if (var->used && layout_differs) { + linker_error_printf(prog, + "If gl_FragDepth is redeclared with a layout qualifier in" + "any fragment shader, it must be redeclared with the same" + "layout qualifier in all fragment shaders that have" + "assignments to gl_FragDepth"); + } + } + /* FINISHME: Handle non-constant initializers. */ if (var->constant_value != NULL) { @@ -413,7 +429,7 @@ cross_validate_globals(struct gl_shader_program *prog, * FINISHME: will fail. */ existing->constant_value = - var->constant_value->clone(talloc_parent(existing), NULL); + var->constant_value->clone(ralloc_parent(existing), NULL); } if (existing->invariant != var->invariant) { @@ -894,30 +910,29 @@ link_intrastage_shaders(void *mem_ctx, free(linking_shaders); - /* Make a pass over all global variables to ensure that arrays with + /* Make a pass over all variable declarations to ensure that arrays with * unspecified sizes have a size specified. The size is inferred from the * max_array_access field. */ if (linked != NULL) { - foreach_list(node, linked->ir) { - ir_variable *const var = ((ir_instruction *) node)->as_variable(); - - if (var == NULL) - continue; - - if ((var->mode != ir_var_auto) && (var->mode != ir_var_temporary)) - continue; - - if (!var->type->is_array() || (var->type->length != 0)) - continue; + class array_sizing_visitor : public ir_hierarchical_visitor { + public: + virtual ir_visitor_status visit(ir_variable *var) + { + if (var->type->is_array() && (var->type->length == 0)) { + const glsl_type *type = + glsl_type::get_array_instance(var->type->fields.array, + var->max_array_access + 1); + + assert(type != NULL); + var->type = type; + } - const glsl_type *type = - glsl_type::get_array_instance(var->type->fields.array, - var->max_array_access); + return visit_continue; + } + } v; - assert(type != NULL); - var->type = type; - } + v.run(linked->ir); } return linked; @@ -997,7 +1012,7 @@ add_uniform(void *mem_ctx, exec_list *uniforms, struct hash_table *ht, if (type->is_record()) { for (unsigned int i = 0; i < type->length; i++) { const glsl_type *field_type = type->fields.structure[i].type; - char *field_name = talloc_asprintf(mem_ctx, "%s.%s", name, + char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name, type->fields.structure[i].name); add_uniform(mem_ctx, uniforms, ht, field_name, field_type, @@ -1013,7 +1028,7 @@ add_uniform(void *mem_ctx, exec_list *uniforms, struct hash_table *ht, /* Array of structures. */ if (array_elem_type->is_record()) { for (unsigned int i = 0; i < type->length; i++) { - char *elem_name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + char *elem_name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i); add_uniform(mem_ctx, uniforms, ht, elem_name, array_elem_type, shader_type, next_shader_pos, total_uniforms); } @@ -1075,7 +1090,7 @@ assign_uniform_locations(struct gl_shader_program *prog) unsigned total_uniforms = 0; hash_table *ht = hash_table_ctor(32, hash_table_string_hash, hash_table_string_compare); - void *mem_ctx = talloc_new(NULL); + void *mem_ctx = ralloc_context(NULL); for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { if (prog->_LinkedShaders[i] == NULL) @@ -1104,7 +1119,7 @@ assign_uniform_locations(struct gl_shader_program *prog) } } - talloc_free(mem_ctx); + ralloc_free(mem_ctx); gl_uniform_list *ul = (gl_uniform_list *) calloc(1, sizeof(gl_uniform_list)); @@ -1472,16 +1487,16 @@ assign_varying_locations(struct gl_shader_program *prog, void link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) { - void *mem_ctx = talloc_init("temporary linker context"); + void *mem_ctx = ralloc_context(NULL); // temporary linker context prog->LinkStatus = false; prog->Validated = false; prog->_Used = false; if (prog->InfoLog != NULL) - talloc_free(prog->InfoLog); + ralloc_free(prog->InfoLog); - prog->InfoLog = talloc_strdup(NULL, ""); + prog->InfoLog = ralloc_strdup(NULL, ""); /* Separate the shaders into groups based on their type. */ @@ -1663,6 +1678,20 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) demote_shader_inputs_and_outputs(sh, ir_var_in); } + /* OpenGL ES requires that a vertex shader and a fragment shader both be + * present in a linked program. By checking for use of shading language + * version 1.00, we also catch the GL_ARB_ES2_compatibility case. + */ + if (ctx->API == API_OPENGLES2 || prog->Version == 100) { + if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) { + linker_error_printf(prog, "program lacks a vertex shader\n"); + prog->LinkStatus = false; + } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { + linker_error_printf(prog, "program lacks a fragment shader\n"); + prog->LinkStatus = false; + } + } + /* FINISHME: Assign fragment shader output locations. */ done: @@ -1676,5 +1705,5 @@ done: reparent_ir(prog->_LinkedShaders[i]->ir, prog->_LinkedShaders[i]->ir); } - talloc_free(mem_ctx); + ralloc_free(mem_ctx); } diff --git a/src/glsl/list.h b/src/glsl/list.h index 3197b03cf28..1d46365faec 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -66,37 +66,33 @@ #ifndef __cplusplus #include <stddef.h> -#include <talloc.h> -#else -extern "C" { -#include <talloc.h> -} #endif - #include <assert.h> +#include "ralloc.h" + struct exec_node { struct exec_node *next; struct exec_node *prev; #ifdef __cplusplus - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { void *node; - node = talloc_size(ctx, size); + node = ralloc_size(ctx, size); assert(node != NULL); return node; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. */ + * ralloc_free in that case. */ static void operator delete(void *node) { - talloc_free(node); + ralloc_free(node); } exec_node() : next(NULL), prev(NULL) @@ -289,23 +285,23 @@ struct exec_list { struct exec_node *tail_pred; #ifdef __cplusplus - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { void *node; - node = talloc_size(ctx, size); + node = ralloc_size(ctx, size); assert(node != NULL); return node; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. */ + * ralloc_free in that case. */ static void operator delete(void *node) { - talloc_free(node); + ralloc_free(node); } exec_list() diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp index 3cf86ebaa38..9bba6a97c48 100644 --- a/src/glsl/loop_analysis.cpp +++ b/src/glsl/loop_analysis.cpp @@ -37,7 +37,7 @@ loop_state::loop_state() { this->ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); - this->mem_ctx = talloc_init("loop state"); + this->mem_ctx = ralloc_context(NULL); this->loop_found = false; } @@ -45,7 +45,7 @@ loop_state::loop_state() loop_state::~loop_state() { hash_table_dtor(this->ht); - talloc_free(this->mem_ctx); + ralloc_free(this->mem_ctx); } @@ -78,8 +78,8 @@ loop_variable_state::get(const ir_variable *ir) loop_variable * loop_variable_state::insert(ir_variable *var) { - void *mem_ctx = talloc_parent(this); - loop_variable *lv = talloc_zero(mem_ctx, loop_variable); + void *mem_ctx = ralloc_parent(this); + loop_variable *lv = rzalloc(mem_ctx, loop_variable); lv->var = var; @@ -93,8 +93,8 @@ loop_variable_state::insert(ir_variable *var) loop_terminator * loop_variable_state::insert(ir_if *if_stmt) { - void *mem_ctx = talloc_parent(this); - loop_terminator *t = talloc_zero(mem_ctx, loop_terminator); + void *mem_ctx = ralloc_parent(this); + loop_terminator *t = rzalloc(mem_ctx, loop_terminator); t->ir = if_stmt; this->terminators.push_tail(t); @@ -450,7 +450,7 @@ get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash) } if ((inc != NULL) && (rhs->operation == ir_binop_sub)) { - void *mem_ctx = talloc_parent(ir); + void *mem_ctx = ralloc_parent(ir); inc = new(mem_ctx) ir_expression(ir_unop_neg, inc->type, diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp index b528810f40d..9acbadc50ea 100644 --- a/src/glsl/loop_controls.cpp +++ b/src/glsl/loop_controls.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include <climits> +#include <limits.h> #include "main/compiler.h" #include "glsl_types.h" #include "loop_analysis.h" @@ -88,7 +88,7 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment, if (from == NULL || to == NULL || increment == NULL) return -1; - void *mem_ctx = talloc_init("%s", __func__); + void *mem_ctx = ralloc_context(NULL); ir_expression *const sub = new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from); @@ -147,7 +147,7 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment, } } - talloc_free(mem_ctx); + ralloc_free(mem_ctx); return (valid_loop) ? iter_value : -1; } diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp index 46000524ba1..5b84e101477 100644 --- a/src/glsl/loop_unroll.cpp +++ b/src/glsl/loop_unroll.cpp @@ -150,7 +150,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) */ break_ir->remove(); - void *const mem_ctx = talloc_parent(ir); + void *const mem_ctx = ralloc_parent(ir); ir_instruction *ir_to_replace = ir; for (int i = 0; i < iterations; i++) { @@ -182,7 +182,7 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) } } - void *const mem_ctx = talloc_parent(ir); + void *const mem_ctx = ralloc_parent(ir); for (int i = 0; i < iterations; i++) { exec_list copy_list; diff --git a/src/glsl/lower_discard.cpp b/src/glsl/lower_discard.cpp index b95313df8c8..cafd2dd3b44 100644 --- a/src/glsl/lower_discard.cpp +++ b/src/glsl/lower_discard.cpp @@ -170,7 +170,7 @@ lower_discard_visitor::visit_leave(ir_if *ir) if (then_discard == NULL && else_discard == NULL) return visit_continue; - void *mem_ctx = talloc_parent(ir); + void *mem_ctx = ralloc_parent(ir); ir_variable *temp = new(mem_ctx) ir_variable(glsl_type::bool_type, "discard_cond_temp", diff --git a/src/glsl/lower_if_to_cond_assign.cpp b/src/glsl/lower_if_to_cond_assign.cpp index 40ffc45c86c..e3a1065d996 100644 --- a/src/glsl/lower_if_to_cond_assign.cpp +++ b/src/glsl/lower_if_to_cond_assign.cpp @@ -171,7 +171,7 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) if (found_control_flow) return visit_continue; - void *mem_ctx = talloc_parent(ir); + void *mem_ctx = ralloc_parent(ir); /* Store the condition to a variable so the assignment conditions are * simpler. diff --git a/src/glsl/lower_mat_op_to_vec.cpp b/src/glsl/lower_mat_op_to_vec.cpp index 7065fdec35f..8cbbfa713c9 100644 --- a/src/glsl/lower_mat_op_to_vec.cpp +++ b/src/glsl/lower_mat_op_to_vec.cpp @@ -368,7 +368,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign) assert(orig_expr->get_num_operands() <= 2); - mem_ctx = talloc_parent(orig_assign); + mem_ctx = ralloc_parent(orig_assign); ir_dereference_variable *lhs_deref = orig_assign->lhs->as_dereference_variable(); diff --git a/src/glsl/lower_noise.cpp b/src/glsl/lower_noise.cpp index cb32d283486..85f59b675e0 100644 --- a/src/glsl/lower_noise.cpp +++ b/src/glsl/lower_noise.cpp @@ -51,7 +51,7 @@ public: * that implements noise. No hardware has a noise instruction. */ if (expr->operation == ir_unop_noise) { - *rvalue = ir_constant::zero(talloc_parent(expr), expr->type); + *rvalue = ir_constant::zero(ralloc_parent(expr), expr->type); this->progress = true; } } diff --git a/src/glsl/lower_texture_projection.cpp b/src/glsl/lower_texture_projection.cpp index 1fd26a7a2b5..6e3aaecceee 100644 --- a/src/glsl/lower_texture_projection.cpp +++ b/src/glsl/lower_texture_projection.cpp @@ -55,7 +55,7 @@ lower_texture_projection_visitor::visit_leave(ir_texture *ir) if (!ir->projector) return visit_continue; - void *mem_ctx = talloc_parent(ir); + void *mem_ctx = ralloc_parent(ir); ir_variable *var = new(mem_ctx) ir_variable(ir->projector->type, "projector", ir_var_auto); diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp index 7b4e4ad07cb..8eb1612f0a0 100644 --- a/src/glsl/lower_variable_index_to_cond_assign.cpp +++ b/src/glsl/lower_variable_index_to_cond_assign.cpp @@ -54,7 +54,7 @@ struct assignment_generator /* Just clone the rest of the deref chain when trying to get at the * underlying variable. */ - void *mem_ctx = talloc_parent(base_ir); + void *mem_ctx = ralloc_parent(base_ir); ir_dereference *element = new(mem_ctx) ir_dereference_array(this->array->clone(mem_ctx, NULL), new(mem_ctx) ir_constant(i)); @@ -91,7 +91,7 @@ struct switch_generator linear_sequence_max_length(linear_sequence_max_length), condition_components(condition_components) { - this->mem_ctx = talloc_parent(index); + this->mem_ctx = ralloc_parent(index); } void linear_sequence(unsigned begin, unsigned end, exec_list *list) @@ -255,6 +255,7 @@ public: case ir_var_uniform: return this->lower_uniforms; case ir_var_in: + case ir_var_const_in: return (var->location == -1) ? this->lower_temps : this->lower_inputs; case ir_var_out: return (var->location == -1) ? this->lower_temps : this->lower_outputs; @@ -275,7 +276,7 @@ public: ? orig_deref->array->type->length : orig_deref->array->type->matrix_columns; - void *const mem_ctx = talloc_parent(base_ir); + void *const mem_ctx = ralloc_parent(base_ir); /* Temporary storage for either the result of the dereference of * the array, or the RHS that's being assigned into the @@ -342,7 +343,7 @@ public: if (needs_lowering(orig_deref)) { ir_variable* var = convert_dereference_array(orig_deref, 0); assert(var); - *pir = new(talloc_parent(base_ir)) ir_dereference_variable(var); + *pir = new(ralloc_parent(base_ir)) ir_dereference_variable(var); this->progress = true; } } diff --git a/src/glsl/lower_vec_index_to_cond_assign.cpp b/src/glsl/lower_vec_index_to_cond_assign.cpp index f8011a16e5b..3c4d93201d2 100644 --- a/src/glsl/lower_vec_index_to_cond_assign.cpp +++ b/src/glsl/lower_vec_index_to_cond_assign.cpp @@ -82,7 +82,7 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue orig_deref->array->type->is_array()) return ir; - void *mem_ctx = talloc_parent(ir); + void *mem_ctx = ralloc_parent(ir); assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); @@ -167,7 +167,7 @@ ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) orig_deref->array->type->is_array()) return visit_continue; - void *mem_ctx = talloc_parent(ir); + void *mem_ctx = ralloc_parent(ir); assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); diff --git a/src/glsl/lower_vec_index_to_swizzle.cpp b/src/glsl/lower_vec_index_to_swizzle.cpp index 9ae43c0db17..c7630c28a83 100644 --- a/src/glsl/lower_vec_index_to_swizzle.cpp +++ b/src/glsl/lower_vec_index_to_swizzle.cpp @@ -74,7 +74,7 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) if (!ir_constant) return ir; - void *ctx = talloc_parent(ir); + void *ctx = ralloc_parent(ir); this->progress = true; return new(ctx) ir_swizzle(deref->array, ir_constant->value.i[0], 0, 0, 0, 1); diff --git a/src/glsl/lower_vector.cpp b/src/glsl/lower_vector.cpp index 93c37638bbd..57963a121ad 100644 --- a/src/glsl/lower_vector.cpp +++ b/src/glsl/lower_vector.cpp @@ -125,7 +125,7 @@ lower_vector_visitor::handle_rvalue(ir_rvalue **rvalue) if (this->dont_lower_swz && is_extended_swizzle(expr)) return; - /* FINISHME: Is this the right thing to use for the talloc context? + /* FINISHME: Is this the right thing to use for the ralloc context? */ void *const mem_ctx = expr; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 9b041aafe42..096da93dcef 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -20,8 +20,6 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#include <cstdlib> -#include <cstdio> #include <getopt.h> #include "ast.h" @@ -56,7 +54,7 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) (void) ctx; assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); - shader = talloc_zero(NULL, struct gl_shader); + shader = rzalloc(NULL, struct gl_shader); if (shader) { shader->Type = type; shader->Name = name; @@ -72,12 +70,18 @@ initialize_context(struct gl_context *ctx, gl_api api) ctx->API = api; + ctx->Extensions.ARB_ES2_compatibility = GL_TRUE; ctx->Extensions.ARB_draw_buffers = GL_TRUE; ctx->Extensions.ARB_draw_instanced = GL_TRUE; ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE; ctx->Extensions.EXT_texture_array = GL_TRUE; ctx->Extensions.NV_texture_rectangle = GL_TRUE; + /* GLSL 1.30 isn't fully supported, but we need to advertise 1.30 so that + * the built-in functions for 1.30 can be built. + */ + ctx->Const.GLSLVersion = 130; + /* 1.10 minimums. */ ctx->Const.MaxLights = 8; ctx->Const.MaxClipPlanes = 8; @@ -101,7 +105,7 @@ initialize_context(struct gl_context *ctx, gl_api api) ctx->Driver.NewShader = _mesa_new_shader; } -/* Returned string will have 'ctx' as its talloc owner. */ +/* Returned string will have 'ctx' as its ralloc owner. */ static char * load_text_file(void *ctx, const char *file_name) { @@ -118,7 +122,7 @@ load_text_file(void *ctx, const char *file_name) size = ftell(fp); fseek(fp, 0L, SEEK_SET); - text = (char *) talloc_size(ctx, size + 1); + text = (char *) ralloc_size(ctx, size + 1); if (text != NULL) { do { size_t bytes = fread(text + total_read, @@ -236,14 +240,14 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader) shader->num_builtins_to_link = state->num_builtins_to_link; if (shader->InfoLog) - talloc_free(shader->InfoLog); + ralloc_free(shader->InfoLog); shader->InfoLog = state->info_log; /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader); - talloc_free(state); + ralloc_free(state); return; } @@ -268,16 +272,16 @@ main(int argc, char **argv) struct gl_shader_program *whole_program; - whole_program = talloc_zero (NULL, struct gl_shader_program); + whole_program = rzalloc (NULL, struct gl_shader_program); assert(whole_program != NULL); for (/* empty */; argc > optind; optind++) { - whole_program->Shaders = (struct gl_shader **) - talloc_realloc(whole_program, whole_program->Shaders, - struct gl_shader *, whole_program->NumShaders + 1); + whole_program->Shaders = + reralloc(whole_program, whole_program->Shaders, + struct gl_shader *, whole_program->NumShaders + 1); assert(whole_program->Shaders != NULL); - struct gl_shader *shader = talloc_zero(whole_program, gl_shader); + struct gl_shader *shader = rzalloc(whole_program, gl_shader); whole_program->Shaders[whole_program->NumShaders] = shader; whole_program->NumShaders++; @@ -320,9 +324,9 @@ main(int argc, char **argv) } for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) - talloc_free(whole_program->_LinkedShaders[i]); + ralloc_free(whole_program->_LinkedShaders[i]); - talloc_free(whole_program); + ralloc_free(whole_program); _mesa_glsl_release_types(); _mesa_glsl_release_functions(); diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 20f6159f0e6..cade9611dbb 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -191,7 +191,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } if (this->mem_ctx == NULL) - this->mem_ctx = talloc_parent(ir); + this->mem_ctx = ralloc_parent(ir); switch (ir->operation) { case ir_unop_logic_not: { diff --git a/src/glsl/opt_constant_folding.cpp b/src/glsl/opt_constant_folding.cpp index d69ca75fe03..599b21525de 100644 --- a/src/glsl/opt_constant_folding.cpp +++ b/src/glsl/opt_constant_folding.cpp @@ -122,7 +122,7 @@ ir_constant_folding_visitor::visit_enter(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *sig_param = (ir_variable *)sig_iter.get(); - if (sig_param->mode == ir_var_in) { + if (sig_param->mode == ir_var_in || sig_param->mode == ir_var_const_in) { ir_rvalue *new_param = param_rval; handle_rvalue(&new_param); diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index 6719fc81863..4425f421193 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -78,13 +78,13 @@ public: ir_constant_propagation_visitor() { progress = false; - mem_ctx = talloc_new(0); + mem_ctx = ralloc_context(0); this->acp = new(mem_ctx) exec_list; this->kills = new(mem_ctx) exec_list; } ~ir_constant_propagation_visitor() { - talloc_free(mem_ctx); + ralloc_free(mem_ctx); } virtual ir_visitor_status visit_enter(class ir_loop *); @@ -195,7 +195,7 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) } } - *rvalue = new(talloc_parent(deref)) ir_constant(type, &data); + *rvalue = new(ralloc_parent(deref)) ir_constant(type, &data); this->progress = true; } @@ -398,11 +398,8 @@ ir_constant_propagation_visitor::add_constant(ir_assignment *ir) { acp_entry *entry; - if (ir->condition) { - ir_constant *condition = ir->condition->as_constant(); - if (!condition || !condition->value.b[0]) - return; - } + if (ir->condition) + return; if (!ir->write_mask) return; diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp index 8068d0c1435..3fa7c3badc8 100644 --- a/src/glsl/opt_constant_variable.cpp +++ b/src/glsl/opt_constant_variable.cpp @@ -104,11 +104,8 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir) /* OK, now find if we actually have all the right conditions for * this to be a constant value assigned to the var. */ - if (ir->condition) { - constval = ir->condition->constant_expression_value(); - if (!constval || !constval->value.b[0]) - return visit_continue; - } + if (ir->condition) + return visit_continue; ir_variable *var = ir->whole_variable_written(); if (!var) diff --git a/src/glsl/opt_copy_propagation.cpp b/src/glsl/opt_copy_propagation.cpp index 8d07fefbfd0..efa3afda35a 100644 --- a/src/glsl/opt_copy_propagation.cpp +++ b/src/glsl/opt_copy_propagation.cpp @@ -71,13 +71,13 @@ public: ir_copy_propagation_visitor() { progress = false; - mem_ctx = talloc_new(0); + mem_ctx = ralloc_context(0); this->acp = new(mem_ctx) exec_list; this->kills = new(mem_ctx) exec_list; } ~ir_copy_propagation_visitor() { - talloc_free(mem_ctx); + ralloc_free(mem_ctx); } virtual ir_visitor_status visit(class ir_dereference_variable *); @@ -191,7 +191,7 @@ ir_copy_propagation_visitor::visit_enter(ir_call *ir) sig_param_iter.next(); } - /* Since we're unlinked, we don't (necssarily) know the side effects of + /* Since we're unlinked, we don't (necessarily) know the side effects of * this call. So kill all copies. */ acp->make_empty(); @@ -309,11 +309,8 @@ ir_copy_propagation_visitor::add_copy(ir_assignment *ir) { acp_entry *entry; - if (ir->condition) { - ir_constant *condition = ir->condition->as_constant(); - if (!condition || !condition->value.b[0]) - return; - } + if (ir->condition) + return; ir_variable *lhs_var = ir->whole_variable_written(); ir_variable *rhs_var = ir->rhs->whole_variable_referenced(); @@ -325,7 +322,7 @@ ir_copy_propagation_visitor::add_copy(ir_assignment *ir) * calling us. Just flag it to not execute, and someone else * will clean up the mess. */ - ir->condition = new(talloc_parent(ir)) ir_constant(false); + ir->condition = new(ralloc_parent(ir)) ir_constant(false); this->progress = true; } else { entry = new(this->mem_ctx) acp_entry(lhs_var, rhs_var); diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp new file mode 100644 index 00000000000..8541d9a8ee1 --- /dev/null +++ b/src/glsl/opt_copy_propagation_elements.cpp @@ -0,0 +1,458 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file opt_copy_propagation_elements.cpp + * + * Replaces usage of recently-copied components of variables with the + * previous copy of the variable. + * + * This pass can be compared with opt_copy_propagation, which operands + * on arbitrary whole-variable copies. However, in order to handle + * the copy propagation of swizzled variables or writemasked writes, + * we want to track things on a channel-wise basis. I found that + * trying to mix the swizzled/writemasked support here with the + * whole-variable stuff in opt_copy_propagation.cpp just made a mess, + * so this is separate despite the ACP handling being somewhat + * similar. + * + * This should reduce the number of MOV instructions in the generated + * programs unless copy propagation is also done on the LIR, and may + * help anyway by triggering other optimizations that live in the HIR. + */ + +#include "ir.h" +#include "ir_rvalue_visitor.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +static bool debug = false; + +class acp_entry : public exec_node +{ +public: + acp_entry(ir_variable *lhs, ir_variable *rhs, int write_mask, int swizzle[4]) + { + this->lhs = lhs; + this->rhs = rhs; + this->write_mask = write_mask; + memcpy(this->swizzle, swizzle, sizeof(this->swizzle)); + } + + acp_entry(acp_entry *a) + { + this->lhs = a->lhs; + this->rhs = a->rhs; + this->write_mask = a->write_mask; + memcpy(this->swizzle, a->swizzle, sizeof(this->swizzle)); + } + + ir_variable *lhs; + ir_variable *rhs; + unsigned int write_mask; + int swizzle[4]; +}; + + +class kill_entry : public exec_node +{ +public: + kill_entry(ir_variable *var, int write_mask) + { + this->var = var; + this->write_mask = write_mask; + } + + ir_variable *var; + unsigned int write_mask; +}; + +class ir_copy_propagation_elements_visitor : public ir_rvalue_visitor { +public: + ir_copy_propagation_elements_visitor() + { + this->progress = false; + this->mem_ctx = ralloc_context(NULL); + this->shader_mem_ctx = NULL; + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + } + ~ir_copy_propagation_elements_visitor() + { + ralloc_free(mem_ctx); + } + + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_if *); + + void handle_rvalue(ir_rvalue **rvalue); + + void add_copy(ir_assignment *ir); + void kill(kill_entry *k); + void handle_if_block(exec_list *instructions); + + /** List of acp_entry: The available copies to propagate */ + exec_list *acp; + /** + * List of kill_entry: The variables whose values were killed in this + * block. + */ + exec_list *kills; + + bool progress; + + bool killed_all; + + /* Context for our local data structures. */ + void *mem_ctx; + /* Context for allocating new shader nodes. */ + void *shader_mem_ctx; +}; + +ir_visitor_status +ir_copy_propagation_elements_visitor::visit_enter(ir_function_signature *ir) +{ + /* Treat entry into a function signature as a completely separate + * block. Any instructions at global scope will be shuffled into + * main() at link time, so they're irrelevant to us. + */ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body); + + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = orig_killed_all; + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_copy_propagation_elements_visitor::visit_leave(ir_assignment *ir) +{ + ir_dereference_variable *lhs = ir->lhs->as_dereference_variable(); + + if (lhs && (lhs->type->is_scalar() || lhs->type->is_vector())) { + kill_entry *k = new(mem_ctx) kill_entry(lhs->var, ir->write_mask); + kill(k); + } + + add_copy(ir); + + return visit_continue; +} + +/** + * Replaces dereferences of ACP RHS variables with ACP LHS variables. + * + * This is where the actual copy propagation occurs. Note that the + * rewriting of ir_dereference means that the ir_dereference instance + * must not be shared by multiple IR operations! + */ +void +ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir) +{ + int swizzle_chan[4]; + ir_dereference_variable *deref_var; + ir_variable *source[4] = {NULL, NULL, NULL, NULL}; + int source_chan[4]; + int chans; + + if (!*ir) + return; + + ir_swizzle *swizzle = (*ir)->as_swizzle(); + if (swizzle) { + deref_var = swizzle->val->as_dereference_variable(); + if (!deref_var) + return; + + swizzle_chan[0] = swizzle->mask.x; + swizzle_chan[1] = swizzle->mask.y; + swizzle_chan[2] = swizzle->mask.z; + swizzle_chan[3] = swizzle->mask.w; + chans = swizzle->type->vector_elements; + } else { + deref_var = (*ir)->as_dereference_variable(); + if (!deref_var) + return; + + swizzle_chan[0] = 0; + swizzle_chan[1] = 1; + swizzle_chan[2] = 2; + swizzle_chan[3] = 3; + chans = deref_var->type->vector_elements; + } + + if (this->in_assignee) + return; + + ir_variable *var = deref_var->var; + + /* Try to find ACP entries covering swizzle_chan[], hoping they're + * the same source variable. + */ + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (var == entry->lhs) { + for (int c = 0; c < chans; c++) { + if (entry->write_mask & (1 << swizzle_chan[c])) { + source[c] = entry->rhs; + source_chan[c] = entry->swizzle[swizzle_chan[c]]; + } + } + } + } + + /* Make sure all channels are copying from the same source variable. */ + if (!source[0]) + return; + for (int c = 1; c < chans; c++) { + if (source[c] != source[0]) + return; + } + + if (!shader_mem_ctx) + shader_mem_ctx = ralloc_parent(deref_var); + + if (debug) { + printf("Copy propagation from:\n"); + (*ir)->print(); + } + + deref_var = new(shader_mem_ctx) ir_dereference_variable(source[0]); + *ir = new(shader_mem_ctx) ir_swizzle(deref_var, + source_chan[0], + source_chan[1], + source_chan[2], + source_chan[3], + chans); + + if (debug) { + printf("to:\n"); + (*ir)->print(); + printf("\n"); + } +} + + +ir_visitor_status +ir_copy_propagation_elements_visitor::visit_enter(ir_call *ir) +{ + /* Do copy propagation on call parameters, but skip any out params */ + exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { + ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); + ir_instruction *ir = (ir_instruction *)iter.get(); + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + ir->accept(this); + } + sig_param_iter.next(); + } + + /* Since we're unlinked, we don't (necessarily) know the side effects of + * this call. So kill all copies. + */ + acp->make_empty(); + this->killed_all = true; + + return visit_continue_with_parent; +} + +void +ir_copy_propagation_elements_visitor::handle_if_block(exec_list *instructions) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + /* Populate the initial acp with a copy of the original */ + foreach_iter(exec_list_iterator, iter, *orig_acp) { + acp_entry *a = (acp_entry *)iter.get(); + this->acp->push_tail(new(this->mem_ctx) acp_entry(a)); + } + + visit_list_elements(this, instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + /* Move the new kills into the parent block's list, removing them + * from the parent's ACP list in the process. + */ + foreach_list_safe(node, new_kills) { + kill_entry *k = (kill_entry *)node; + kill(k); + } +} + +ir_visitor_status +ir_copy_propagation_elements_visitor::visit_enter(ir_if *ir) +{ + ir->condition->accept(this); + + handle_if_block(&ir->then_instructions); + handle_if_block(&ir->else_instructions); + + /* handle_if_block() already descended into the children. */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_copy_propagation_elements_visitor::visit_enter(ir_loop *ir) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + /* FINISHME: For now, the initial acp for loops is totally empty. + * We could go through once, then go through again with the acp + * cloned minus the killed entries after the first run through. + */ + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body_instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_list_safe(node, new_kills) { + kill_entry *k = (kill_entry *)node; + kill(k); + } + + /* already descended into the children. */ + return visit_continue_with_parent; +} + +/* Remove any entries currently in the ACP for this kill. */ +void +ir_copy_propagation_elements_visitor::kill(kill_entry *k) +{ + foreach_list_safe(node, acp) { + acp_entry *entry = (acp_entry *)node; + + if (entry->lhs == k->var) { + entry->write_mask = entry->write_mask & ~k->write_mask; + if (entry->write_mask == 0) + entry->remove(); + } + if (entry->rhs == k->var) { + entry->remove(); + } + } + + /* If we were on a list, remove ourselves before inserting */ + if (k->next) + k->remove(); + + this->kills->push_tail(k); +} + +/** + * Adds directly-copied channels between vector variables to the available + * copy propagation list. + */ +void +ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir) +{ + acp_entry *entry; + int orig_swizzle[4] = {0, 1, 2, 3}; + int swizzle[4]; + + if (ir->condition) + return; + + ir_dereference_variable *lhs = ir->lhs->as_dereference_variable(); + if (!lhs || !(lhs->type->is_scalar() || lhs->type->is_vector())) + return; + + ir_dereference_variable *rhs = ir->rhs->as_dereference_variable(); + if (!rhs) { + ir_swizzle *swiz = ir->rhs->as_swizzle(); + if (!swiz) + return; + + rhs = swiz->val->as_dereference_variable(); + if (!rhs) + return; + + orig_swizzle[0] = swiz->mask.x; + orig_swizzle[1] = swiz->mask.y; + orig_swizzle[2] = swiz->mask.z; + orig_swizzle[3] = swiz->mask.w; + } + + /* Move the swizzle channels out to the positions they match in the + * destination. We don't want to have to rewrite the swizzle[] + * array every time we clear a bit of the write_mask. + */ + int j = 0; + for (int i = 0; i < 4; i++) { + if (ir->write_mask & (1 << i)) + swizzle[i] = orig_swizzle[j++]; + } + + entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, ir->write_mask, + swizzle); + this->acp->push_tail(entry); +} + +bool +do_copy_propagation_elements(exec_list *instructions) +{ + ir_copy_propagation_elements_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp index 5689e7d20db..39962bd602e 100644 --- a/src/glsl/opt_dead_code_local.cpp +++ b/src/glsl/opt_dead_code_local.cpp @@ -129,15 +129,8 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) var = ir->lhs->variable_referenced(); assert(var); - bool always_assign = true; - if (ir->condition) { - ir_constant *condition = ir->condition->as_constant(); - if (!condition || !condition->value.b[0]) - always_assign = false; - } - /* Now, check if we did a whole-variable assignment. */ - if (always_assign && (ir->whole_variable_written() != NULL)) { + if (!ir->condition && (ir->whole_variable_written() != NULL)) { /* We did a whole-variable assignment. So, any instruction in * the assignment list with the same LHS is dead. */ @@ -190,7 +183,7 @@ dead_code_local_basic_block(ir_instruction *first, bool *out_progress = (bool *)data; bool progress = false; - void *ctx = talloc_new(NULL); + void *ctx = ralloc_context(NULL); /* Safe looping, since process_assignment */ for (ir = first, ir_next = (ir_instruction *)first->next;; ir = ir_next, ir_next = (ir_instruction *)ir->next) { @@ -212,7 +205,7 @@ dead_code_local_basic_block(ir_instruction *first, break; } *out_progress = progress; - talloc_free(ctx); + ralloc_free(ctx); } /** diff --git a/src/glsl/opt_dead_functions.cpp b/src/glsl/opt_dead_functions.cpp index cf91cb6d368..ceb79080a75 100644 --- a/src/glsl/opt_dead_functions.cpp +++ b/src/glsl/opt_dead_functions.cpp @@ -49,12 +49,12 @@ public: ir_dead_functions_visitor() { - this->mem_ctx = talloc_new(NULL); + this->mem_ctx = ralloc_context(NULL); } ~ir_dead_functions_visitor() { - talloc_free(this->mem_ctx); + ralloc_free(this->mem_ctx); } virtual ir_visitor_status visit_enter(ir_function_signature *); diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp index 169fd826882..2e7831dcbdb 100644 --- a/src/glsl/opt_function_inlining.cpp +++ b/src/glsl/opt_function_inlining.cpp @@ -89,7 +89,7 @@ do_function_inlining(exec_list *instructions) static void replace_return_with_assignment(ir_instruction *ir, void *data) { - void *ctx = talloc_parent(ir); + void *ctx = ralloc_parent(ir); ir_variable *retval = (ir_variable *)data; ir_return *ret = ir->as_return(); @@ -110,7 +110,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data) ir_rvalue * ir_call::generate_inline(ir_instruction *next_ir) { - void *ctx = talloc_parent(this); + void *ctx = ralloc_parent(this); ir_variable **parameters; int num_parameters; int i; @@ -165,6 +165,7 @@ ir_call::generate_inline(ir_instruction *next_ir) /* Move the actual param into our param variable if it's an 'in' type. */ if (parameters[i] && (sig_param->mode == ir_var_in || + sig_param->mode == ir_var_const_in || sig_param->mode == ir_var_inout)) { ir_assignment *assign; @@ -357,7 +358,7 @@ ir_sampler_replacement_visitor::replace_deref(ir_dereference **deref) { ir_dereference_variable *deref_var = (*deref)->as_dereference_variable(); if (deref_var && deref_var->var == this->sampler) { - *deref = this->deref->clone(talloc_parent(*deref), NULL); + *deref = this->deref->clone(ralloc_parent(*deref), NULL); } } diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp index d6191002c2f..014407c0be2 100644 --- a/src/glsl/opt_structure_splitting.cpp +++ b/src/glsl/opt_structure_splitting.cpp @@ -65,7 +65,7 @@ public: ir_variable **components; - /** talloc_parent(this->var) -- the shader's talloc context. */ + /** ralloc_parent(this->var) -- the shader's ralloc context. */ void *mem_ctx; }; @@ -74,13 +74,13 @@ class ir_structure_reference_visitor : public ir_hierarchical_visitor { public: ir_structure_reference_visitor(void) { - this->mem_ctx = talloc_new(NULL); + this->mem_ctx = ralloc_context(NULL); this->variable_list.make_empty(); } ~ir_structure_reference_visitor(void) { - talloc_free(mem_ctx); + ralloc_free(mem_ctx); } virtual ir_visitor_status visit(ir_variable *); @@ -322,7 +322,7 @@ do_structure_splitting(exec_list *instructions) if (refs.variable_list.is_empty()) return false; - void *mem_ctx = talloc_new(NULL); + void *mem_ctx = ralloc_context(NULL); /* Replace the decls of the structures to be split with their split * components. @@ -331,14 +331,14 @@ do_structure_splitting(exec_list *instructions) variable_entry2 *entry = (variable_entry2 *)iter.get(); const struct glsl_type *type = entry->var->type; - entry->mem_ctx = talloc_parent(entry->var); + entry->mem_ctx = ralloc_parent(entry->var); - entry->components = talloc_array(mem_ctx, + entry->components = ralloc_array(mem_ctx, ir_variable *, type->length); for (unsigned int i = 0; i < entry->var->type->length; i++) { - const char *name = talloc_asprintf(mem_ctx, "%s_%s", + const char *name = ralloc_asprintf(mem_ctx, "%s_%s", entry->var->name, type->fields.structure[i].name); @@ -355,7 +355,7 @@ do_structure_splitting(exec_list *instructions) ir_structure_splitting_visitor split(&refs.variable_list); visit_list_elements(&split, instructions); - talloc_free(mem_ctx); + ralloc_free(mem_ctx); return true; } diff --git a/src/glsl/opt_tree_grafting.cpp b/src/glsl/opt_tree_grafting.cpp index 9917c045b1d..1ef940f9c72 100644 --- a/src/glsl/opt_tree_grafting.cpp +++ b/src/glsl/opt_tree_grafting.cpp @@ -195,7 +195,7 @@ ir_tree_grafting_visitor::visit_enter(ir_call *ir) ir_rvalue *ir = (ir_rvalue *)iter.get(); ir_rvalue *new_ir = ir; - if (sig_param->mode != ir_var_in) + if (sig_param->mode != ir_var_in && sig_param->mode != ir_var_const_in) continue; if (do_graft(&new_ir)) { @@ -245,6 +245,7 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir) { if (do_graft(&ir->coordinate) || do_graft(&ir->projector) || + do_graft(&ir->offset) || do_graft(&ir->shadow_comparitor)) return visit_stop; diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c new file mode 100644 index 00000000000..6a5eac6b9a3 --- /dev/null +++ b/src/glsl/ralloc.c @@ -0,0 +1,458 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <assert.h> +#include <stdlib.h> +#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> + +#include "ralloc.h" + +#ifdef __GNUC__ +#define likely(x) __builtin_expect(!!(x),1) +#define unlikely(x) __builtin_expect(!!(x),0) +#else +#define likely(x) !!(x) +#define unlikely(x) !!(x) +#endif + +#ifndef va_copy +#ifdef __va_copy +#define va_copy(dest, src) __va_copy((dest), (src)) +#else +#define va_copy(dest, src) (dest) = (src) +#endif +#endif + +#define CANARY 0x5A1106 + +struct ralloc_header +{ + /* A canary value used to determine whether a pointer is ralloc'd. */ + unsigned canary; + + struct ralloc_header *parent; + + /* The first child (head of a linked list) */ + struct ralloc_header *child; + + /* Linked list of siblings */ + struct ralloc_header *prev; + struct ralloc_header *next; + + void (*destructor)(void *); +}; + +typedef struct ralloc_header ralloc_header; + +static void unlink_block(ralloc_header *info); +static void unsafe_free(ralloc_header *info); + +static ralloc_header * +get_header(const void *ptr) +{ + ralloc_header *info = (ralloc_header *) (((char *) ptr) - + sizeof(ralloc_header)); + assert(info->canary == CANARY); + return info; +} + +#define PTR_FROM_HEADER(info) (((char *) info) + sizeof(ralloc_header)) + +static void +add_child(ralloc_header *parent, ralloc_header *info) +{ + if (parent != NULL) { + info->parent = parent; + info->next = parent->child; + parent->child = info; + + if (info->next != NULL) + info->next->prev = info; + } +} + +void * +ralloc_context(const void *ctx) +{ + return ralloc_size(ctx, 0); +} + +void * +ralloc_size(const void *ctx, size_t size) +{ + void *block = calloc(1, size + sizeof(ralloc_header)); + + ralloc_header *info = (ralloc_header *) block; + ralloc_header *parent = ctx != NULL ? get_header(ctx) : NULL; + + add_child(parent, info); + + info->canary = CANARY; + + return PTR_FROM_HEADER(info); +} + +void * +rzalloc_size(const void *ctx, size_t size) +{ + void *ptr = ralloc_size(ctx, size); + if (likely(ptr != NULL)) + memset(ptr, 0, size); + return ptr; +} + +/* helper function - assumes ptr != NULL */ +static void * +resize(void *ptr, size_t size) +{ + ralloc_header *child, *old, *info; + + old = get_header(ptr); + info = realloc(old, size + sizeof(ralloc_header)); + + if (info == NULL) + return NULL; + + /* Update parent and sibling's links to the reallocated node. */ + if (info != old && info->parent != NULL) { + if (info->parent->child == old) + info->parent->child = info; + + if (info->prev != NULL) + info->prev->next = info; + + if (info->next != NULL) + info->next->prev = info; + } + + /* Update child->parent links for all children */ + for (child = info->child; child != NULL; child = child->next) + child->parent = info; + + return PTR_FROM_HEADER(info); +} + +void * +reralloc_size(const void *ctx, void *ptr, size_t size) +{ + if (unlikely(ptr == NULL)) + return ralloc_size(ctx, size); + + assert(ralloc_parent(ptr) == ctx); + return resize(ptr, size); +} + +void * +ralloc_array_size(const void *ctx, size_t size, unsigned count) +{ + if (count > SIZE_MAX/size) + return NULL; + + return ralloc_size(ctx, size * count); +} + +void * +rzalloc_array_size(const void *ctx, size_t size, unsigned count) +{ + if (count > SIZE_MAX/size) + return NULL; + + return rzalloc_size(ctx, size * count); +} + +void * +reralloc_array_size(const void *ctx, void *ptr, size_t size, unsigned count) +{ + if (count > SIZE_MAX/size) + return NULL; + + return reralloc_size(ctx, ptr, size * count); +} + +void +ralloc_free(void *ptr) +{ + ralloc_header *info; + + if (ptr == NULL) + return; + + info = get_header(ptr); + unlink_block(info); + unsafe_free(info); +} + +static void +unlink_block(ralloc_header *info) +{ + /* Unlink from parent & siblings */ + if (info->parent != NULL) { + if (info->parent->child == info) + info->parent->child = info->next; + + if (info->prev != NULL) + info->prev->next = info->next; + + if (info->next != NULL) + info->next->prev = info->prev; + } + info->parent = NULL; + info->prev = NULL; + info->next = NULL; +} + +static void +unsafe_free(ralloc_header *info) +{ + /* Recursively free any children...don't waste time unlinking them. */ + ralloc_header *temp; + while (info->child != NULL) { + temp = info->child; + info->child = temp->next; + unsafe_free(temp); + } + + /* Free the block itself. Call the destructor first, if any. */ + if (info->destructor != NULL) + info->destructor(PTR_FROM_HEADER(info)); + + free(info); +} + +void +ralloc_steal(const void *new_ctx, void *ptr) +{ + ralloc_header *info, *parent; + + if (unlikely(ptr == NULL)) + return; + + info = get_header(ptr); + parent = get_header(new_ctx); + + unlink_block(info); + + add_child(parent, info); +} + +void * +ralloc_parent(const void *ptr) +{ + ralloc_header *info; + + if (unlikely(ptr == NULL)) + return NULL; + + info = get_header(ptr); + return PTR_FROM_HEADER(info->parent); +} + +static void *autofree_context = NULL; + +static void +autofree(void) +{ + ralloc_free(autofree_context); +} + +void * +ralloc_autofree_context(void) +{ + if (unlikely(autofree_context == NULL)) { + autofree_context = ralloc_context(NULL); + atexit(autofree); + } + return autofree_context; +} + +void +ralloc_set_destructor(const void *ptr, void(*destructor)(void *)) +{ + ralloc_header *info = get_header(ptr); + info->destructor = destructor; +} + +char * +ralloc_strdup(const void *ctx, const char *str) +{ + size_t n; + char *ptr; + + if (unlikely(str == NULL)) + return NULL; + + n = strlen(str); + ptr = ralloc_array(ctx, char, n + 1); + memcpy(ptr, str, n); + ptr[n] = '\0'; + return ptr; +} + +char * +ralloc_strndup(const void *ctx, const char *str, size_t max) +{ + size_t n; + char *ptr; + + if (unlikely(str == NULL)) + return NULL; + + n = strlen(str); + if (n > max) + n = max; + + ptr = ralloc_array(ctx, char, n + 1); + memcpy(ptr, str, n); + ptr[n] = '\0'; + return ptr; +} + +/* helper routine for strcat/strncat - n is the exact amount to copy */ +static bool +cat(char **dest, const char *str, size_t n) +{ + char *both; + size_t existing_length; + assert(dest != NULL && *dest != NULL); + + existing_length = strlen(*dest); + both = resize(*dest, existing_length + n + 1); + if (unlikely(both == NULL)) + return false; + + memcpy(both + existing_length, str, n); + both[existing_length + n] = '\0'; + + *dest = both; + return true; +} + + +bool +ralloc_strcat(char **dest, const char *str) +{ + return cat(dest, str, strlen(str)); +} + +bool +ralloc_strncat(char **dest, const char *str, size_t n) +{ + /* Clamp n to the string length */ + size_t str_length = strlen(str); + if (str_length < n) + n = str_length; + + return cat(dest, str, n); +} + +char * +ralloc_asprintf(const void *ctx, const char *fmt, ...) +{ + char *ptr; + va_list args; + va_start(args, fmt); + ptr = ralloc_vasprintf(ctx, fmt, args); + va_end(args); + return ptr; +} + +/* Return the length of the string that would be generated by a printf-style + * format and argument list, not including the \0 byte. + */ +static size_t +printf_length(const char *fmt, va_list untouched_args) +{ + int size; + char junk; + + /* Make a copy of the va_list so the original caller can still use it */ + va_list args; + va_copy(args, untouched_args); + +#ifdef _MSC_VER + /* We need to use _vcsprintf to calculate the size as vsnprintf returns -1 + * if the number of characters to write is greater than count. + */ + size = _vscprintf(fmt, args); + (void)junk; +#else + size = vsnprintf(&junk, 1, fmt, args); +#endif + assert(size >= 0); + + va_end(args); + + return size; +} + +char * +ralloc_vasprintf(const void *ctx, const char *fmt, va_list args) +{ + size_t size = printf_length(fmt, args) + 1; + + char *ptr = ralloc_size(ctx, size); + if (ptr != NULL) + vsnprintf(ptr, size, fmt, args); + + return ptr; +} + +bool +ralloc_asprintf_append(char **str, const char *fmt, ...) +{ + bool success; + va_list args; + va_start(args, fmt); + success = ralloc_vasprintf_append(str, fmt, args); + va_end(args); + return success; +} + +bool +ralloc_vasprintf_append(char **str, const char *fmt, va_list args) +{ + size_t existing_length, new_length; + char *ptr; + + assert(str != NULL); + + if (unlikely(*str == NULL)) { + // Assuming a NULL context is probably bad, but it's expected behavior. + *str = ralloc_vasprintf(NULL, fmt, args); + return true; + } + + existing_length = strlen(*str); + new_length = printf_length(fmt, args); + + ptr = resize(*str, existing_length + new_length + 1); + if (unlikely(ptr == NULL)) + return false; + + vsnprintf(ptr + existing_length, new_length + 1, fmt, args); + *str = ptr; + return true; +} diff --git a/src/glsl/ralloc.h b/src/glsl/ralloc.h new file mode 100644 index 00000000000..d5338152f10 --- /dev/null +++ b/src/glsl/ralloc.h @@ -0,0 +1,345 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ralloc.h + * + * ralloc: a recursive memory allocator + * + * The ralloc memory allocator creates a hierarchy of allocated + * objects. Every allocation is in reference to some parent, and + * every allocated object can in turn be used as the parent of a + * subsequent allocation. This allows for extremely convenient + * discarding of an entire tree/sub-tree of allocations by calling + * ralloc_free on any particular object to free it and all of its + * children. + * + * The conceptual working of ralloc was directly inspired by Andrew + * Tridgell's talloc, but ralloc is an independent implementation + * released under the MIT license and tuned for Mesa. + * + * The talloc implementation is available under the GNU Lesser + * General Public License (GNU LGPL), version 3 or later. It is + * more sophisticated than ralloc in that it includes reference + * counting and debugging features. See: http://talloc.samba.org/ + */ + +#ifndef RALLOC_H +#define RALLOC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stddef.h> +#include <stdarg.h> +#include <stdbool.h> + +/** + * \def ralloc(ctx, type) + * Allocate a new object chained off of the given context. + * + * This is equivalent to: + * \code + * ((type *) ralloc_size(ctx, sizeof(type)) + * \endcode + */ +#define ralloc(ctx, type) ((type *) ralloc_size(ctx, sizeof(type))) + +/** + * \def rzalloc(ctx, type) + * Allocate a new object out of the given context and initialize it to zero. + * + * This is equivalent to: + * \code + * ((type *) rzalloc_size(ctx, sizeof(type)) + * \endcode + */ +#define rzalloc(ctx, type) ((type *) rzalloc_size(ctx, sizeof(type))) + +/** + * Allocate a new ralloc context. + * + * While any ralloc'd pointer can be used as a context, sometimes it is useful + * to simply allocate a context with no associated memory. + * + * It is equivalent to: + * \code + * ((type *) ralloc_size(ctx, 0) + * \endcode + */ +void *ralloc_context(const void *ctx); + +/** + * Allocate memory chained off of the given context. + * + * This is the core allocation routine which is used by all others. It + * simply allocates storage for \p size bytes and returns the pointer, + * similar to \c malloc. + */ +void *ralloc_size(const void *ctx, size_t size); + +/** + * Allocate zero-initialized memory chained off of the given context. + * + * This is similar to \c calloc with a size of 1. + */ +void *rzalloc_size(const void *ctx, size_t size); + +/** + * Resize a piece of ralloc-managed memory, preserving data. + * + * Similar to \c realloc. Unlike C89, passing 0 for \p size does not free the + * memory. Instead, it resizes it to a 0-byte ralloc context, just like + * calling ralloc_size(ctx, 0). This is different from talloc. + * + * \param ctx The context to use for new allocation. If \p ptr != NULL, + * it must be the same as ralloc_parent(\p ptr). + * \param ptr Pointer to the memory to be resized. May be NULL. + * \param size The amount of memory to allocate, in bytes. + */ +void *reralloc_size(const void *ctx, void *ptr, size_t size); + +/// \defgroup array Array Allocators @{ + +/** + * \def ralloc_array(ctx, type, count) + * Allocate an array of objects chained off the given context. + * + * Similar to \c calloc, but does not initialize the memory to zero. + * + * More than a convenience function, this also checks for integer overflow when + * multiplying \c sizeof(type) and \p count. This is necessary for security. + * + * This is equivalent to: + * \code + * ((type *) ralloc_array_size(ctx, sizeof(type), count) + * \endcode + */ +#define ralloc_array(ctx, type, count) \ + ((type *) ralloc_array_size(ctx, sizeof(type), count)) + +/** + * \def rzalloc_array(ctx, type, count) + * Allocate a zero-initialized array chained off the given context. + * + * Similar to \c calloc. + * + * More than a convenience function, this also checks for integer overflow when + * multiplying \c sizeof(type) and \p count. This is necessary for security. + * + * This is equivalent to: + * \code + * ((type *) rzalloc_array_size(ctx, sizeof(type), count) + * \endcode + */ +#define rzalloc_array(ctx, type, count) \ + ((type *) rzalloc_array_size(ctx, sizeof(type), count)) + +/** + * \def reralloc(ctx, ptr, type, count) + * Resize a ralloc-managed array, preserving data. + * + * Similar to \c realloc. Unlike C89, passing 0 for \p size does not free the + * memory. Instead, it resizes it to a 0-byte ralloc context, just like + * calling ralloc_size(ctx, 0). This is different from talloc. + * + * More than a convenience function, this also checks for integer overflow when + * multiplying \c sizeof(type) and \p count. This is necessary for security. + * + * \param ctx The context to use for new allocation. If \p ptr != NULL, + * it must be the same as ralloc_parent(\p ptr). + * \param ptr Pointer to the array to be resized. May be NULL. + * \param type The element type. + * \param count The number of elements to allocate. + */ +#define reralloc(ctx, ptr, type, count) \ + ((type *) reralloc_array_size(ctx, ptr, sizeof(type), count)) + +/** + * Allocate memory for an array chained off the given context. + * + * Similar to \c calloc, but does not initialize the memory to zero. + * + * More than a convenience function, this also checks for integer overflow when + * multiplying \p size and \p count. This is necessary for security. + */ +void *ralloc_array_size(const void *ctx, size_t size, unsigned count); + +/** + * Allocate a zero-initialized array chained off the given context. + * + * Similar to \c calloc. + * + * More than a convenience function, this also checks for integer overflow when + * multiplying \p size and \p count. This is necessary for security. + */ +void *rzalloc_array_size(const void *ctx, size_t size, unsigned count); + +/** + * Resize a ralloc-managed array, preserving data. + * + * Similar to \c realloc. Unlike C89, passing 0 for \p size does not free the + * memory. Instead, it resizes it to a 0-byte ralloc context, just like + * calling ralloc_size(ctx, 0). This is different from talloc. + * + * More than a convenience function, this also checks for integer overflow when + * multiplying \c sizeof(type) and \p count. This is necessary for security. + * + * \param ctx The context to use for new allocation. If \p ptr != NULL, + * it must be the same as ralloc_parent(\p ptr). + * \param ptr Pointer to the array to be resized. May be NULL. + * \param size The size of an individual element. + * \param count The number of elements to allocate. + * + * \return True unless allocation failed. + */ +void *reralloc_array_size(const void *ctx, void *ptr, size_t size, + unsigned count); +/// @} + +/** + * Free a piece of ralloc-managed memory. + * + * This will also free the memory of any children allocated this context. + */ +void ralloc_free(void *ptr); + +/** + * "Steal" memory from one context, changing it to another. + * + * This changes \p ptr's context to \p new_ctx. This is quite useful if + * memory is allocated out of a temporary context. + */ +void ralloc_steal(const void *new_ctx, void *ptr); + +/** + * Return the given pointer's ralloc context. + */ +void *ralloc_parent(const void *ptr); + +/** + * Return a context whose memory will be automatically freed at program exit. + * + * The first call to this function creates a context and registers a handler + * to free it using \c atexit. This may cause trouble if used in a library + * loaded with \c dlopen. + */ +void *ralloc_autofree_context(void); + +/** + * Set a callback to occur just before an object is freed. + */ +void ralloc_set_destructor(const void *ptr, void(*destructor)(void *)); + +/// \defgroup array String Functions @{ +/** + * Duplicate a string, allocating the memory from the given context. + */ +char *ralloc_strdup(const void *ctx, const char *str); + +/** + * Duplicate a string, allocating the memory from the given context. + * + * Like \c strndup, at most \p n characters are copied. If \p str is longer + * than \p n characters, \p n are copied, and a termining \c '\0' byte is added. + */ +char *ralloc_strndup(const void *ctx, const char *str, size_t n); + +/** + * Concatenate two strings, allocating the necessary space. + * + * This appends \p str to \p *dest, similar to \c strcat, using ralloc_resize + * to expand \p *dest to the appropriate size. \p dest will be updated to the + * new pointer unless allocation fails. + * + * The result will always be null-terminated. + * + * \return True unless allocation failed. + */ +bool ralloc_strcat(char **dest, const char *str); + +/** + * Concatenate two strings, allocating the necessary space. + * + * This appends at most \p n bytes of \p str to \p *dest, using ralloc_resize + * to expand \p *dest to the appropriate size. \p dest will be updated to the + * new pointer unless allocation fails. + * + * The result will always be null-terminated; \p str does not need to be null + * terminated if it is longer than \p n. + * + * \return True unless allocation failed. + */ +bool ralloc_strncat(char **dest, const char *str, size_t n); + +/** + * Print to a string. + * + * This is analogous to \c sprintf, but allocates enough space (using \p ctx + * as the context) for the resulting string. + * + * \return The newly allocated string. + */ +char *ralloc_asprintf (const void *ctx, const char *fmt, ...); + +/** + * Print to a string, given a va_list. + * + * This is analogous to \c vsprintf, but allocates enough space (using \p ctx + * as the context) for the resulting string. + * + * \return The newly allocated string. + */ +char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args); + +/** + * Append formatted text to the supplied string. + * + * \sa ralloc_asprintf + * \sa ralloc_strcat + * + * \p str will be updated to the new pointer unless allocation fails. + * + * \return True unless allocation failed. + */ +bool ralloc_asprintf_append (char **str, const char *fmt, ...); + +/** + * Append formatted text to the supplied string, given a va_list. + * + * \sa ralloc_vasprintf + * \sa ralloc_strcat + * + * \p str will be updated to the new pointer unless allocation fails. + * + * \return True unless allocation failed. + */ +bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args); +/// @} + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + +#endif diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp index 6edbf62e488..a922a50d3b9 100644 --- a/src/glsl/s_expression.cpp +++ b/src/glsl/s_expression.cpp @@ -22,15 +22,12 @@ * DEALINGS IN THE SOFTWARE. */ -#include <cstdio> -#include <cstdlib> -#include <cstring> #include <assert.h> #include "s_expression.h" s_symbol::s_symbol(const char *tmp, size_t n) { - this->str = talloc_strndup (this, tmp, n); + this->str = ralloc_strndup (this, tmp, n); assert(this->str != NULL); } diff --git a/src/glsl/s_expression.h b/src/glsl/s_expression.h index 795f3fccea7..c9dc676b319 100644 --- a/src/glsl/s_expression.h +++ b/src/glsl/s_expression.h @@ -57,7 +57,7 @@ public: * Read an S-Expression from the given string. * Advances the supplied pointer to just after the expression read. * - * Any allocation will be performed with 'ctx' as the talloc owner. + * Any allocation will be performed with 'ctx' as the ralloc owner. */ static s_expression *read_expression(void *ctx, const char *&src); |