diff options
author | marha <marha@users.sourceforge.net> | 2012-12-03 09:09:06 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-12-03 09:09:06 +0100 |
commit | b8da71ffb17d3d16706db04115e9ba1dd8bc49b9 (patch) | |
tree | 52bf0a78e9db0a4eff7b3dbb7c3a036c01504f6a /mesalib/src/glsl | |
parent | d2d73da59e64acdc4718e4e6790a69d967bee875 (diff) | |
download | vcxsrv-b8da71ffb17d3d16706db04115e9ba1dd8bc49b9.tar.gz vcxsrv-b8da71ffb17d3d16706db04115e9ba1dd8bc49b9.tar.bz2 vcxsrv-b8da71ffb17d3d16706db04115e9ba1dd8bc49b9.zip |
fontconfig mesa xserver pixman xkeyboard-config git update 3 dec 2012
fontconfig: 2442d611579bccb84f0c29e3f9ceb0a7436df812
mesa: 54ff536823bf5a431efe1f2becdb21174c146948
xserver: b51a1bd2766e7dc975ca8f1cacc3f8bd0e1a68a3
pixman: 978bab253d1d061b00b5e80aa45ab6986aac466f
xkeyboard-config: 05dcc6db64cd7425aea6d22efd6a3ecf34dbddd2
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r-- | mesalib/src/glsl/glcpp/README | 4 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp-parse.y | 99 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp.c | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/ir_function_detect_recursion.cpp | 1 | ||||
-rw-r--r-- | mesalib/src/glsl/ir_validate.cpp | 4 | ||||
-rw-r--r-- | mesalib/src/glsl/main.cpp | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/opt_constant_propagation.cpp | 1 | ||||
-rw-r--r-- | mesalib/src/glsl/test_optpass.cpp | 2 |
8 files changed, 88 insertions, 27 deletions
diff --git a/mesalib/src/glsl/glcpp/README b/mesalib/src/glsl/glcpp/README index 0b5ef508c..0637935e2 100644 --- a/mesalib/src/glsl/glcpp/README +++ b/mesalib/src/glsl/glcpp/README @@ -20,13 +20,11 @@ to encounter and deal with the following preprocessor macros: #pragma #extension -All other macros will be handles according to the GLSL specification +All other macros will be handled according to the GLSL specification and will not appear in the output. Known limitations ----------------- -The __LINE__ and __FILE__ macros are not yet supported. - A file that ends with a function-like macro name as the last non-whitespace token will result in a parse error, (where it should be passed through as is).
\ No newline at end of file diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index b0537c3b0..e7daf7fea 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -1054,26 +1054,67 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) return combined; } - /* Two string-valued tokens can usually just be mashed - * together. + /* Two string-valued (or integer) tokens can usually just be + * mashed together. (We also handle a string followed by an + * integer here as well.) * - * XXX: This isn't actually legitimate. Several things here - * should result in a diagnostic since the result cannot be a - * valid, single pre-processing token. For example, pasting - * "123" and "abc" is not legal, but we don't catch that - * here. */ - if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) && - (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING)) + * There are some exceptions here. Notably, if the first token + * is an integer (or a string representing an integer), then + * the second token must also be an integer or must be a + * string representing an integer that begins with a digit. + */ + if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING || token->type == INTEGER) && + (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING || other->type == INTEGER)) { char *str; + int combined_type; + + /* Check that pasting onto an integer doesn't create a + * non-integer, (that is, only digits can be + * pasted. */ + if (token->type == INTEGER_STRING || token->type == INTEGER) + { + switch (other->type) { + case INTEGER_STRING: + if (other->value.str[0] < '0' || + other->value.str[0] > '9') + goto FAIL; + break; + case INTEGER: + if (other->value.ival < 0) + goto FAIL; + break; + default: + goto FAIL; + } + } - str = ralloc_asprintf (token, "%s%s", token->value.str, - other->value.str); - combined = _token_create_str (token, token->type, str); + if (token->type == INTEGER) + str = ralloc_asprintf (token, "%" PRIiMAX, + token->value.ival); + else + str = ralloc_strdup (token, token->value.str); + + + if (other->type == INTEGER) + ralloc_asprintf_append (&str, "%" PRIiMAX, + other->value.ival); + else + ralloc_strcat (&str, other->value.str); + + /* New token is same type as original token, unless we + * started with an integer, in which case we will be + * creating an integer-string. */ + combined_type = token->type; + if (combined_type == INTEGER) + combined_type = INTEGER_STRING; + + combined = _token_create_str (token, combined_type, str); combined->location = token->location; return combined; } + FAIL: glcpp_error (&token->location, parser, ""); ralloc_asprintf_rewrite_tail (&parser->info_log, &parser->info_log_length, "Pasting \""); _token_print (&parser->info_log, &parser->info_log_length, token); @@ -1300,18 +1341,30 @@ _arguments_parse (argument_list_t *arguments, } static token_list_t * -_token_list_create_with_one_space (void *ctx) +_token_list_create_with_one_ival (void *ctx, int type, int ival) { token_list_t *list; - token_t *space; + token_t *node; list = _token_list_create (ctx); - space = _token_create_ival (list, SPACE, SPACE); - _token_list_append (list, space); + node = _token_create_ival (list, type, ival); + _token_list_append (list, node); return list; } +static token_list_t * +_token_list_create_with_one_space (void *ctx) +{ + return _token_list_create_with_one_ival (ctx, SPACE, SPACE); +} + +static token_list_t * +_token_list_create_with_one_integer (void *ctx, int ival) +{ + return _token_list_create_with_one_ival (ctx, INTEGER, ival); +} + /* Perform macro expansion on 'list', placing the resulting tokens * into a new list which is initialized with a first token of type * 'head_token_type'. Then begin lexing from the resulting list, @@ -1528,8 +1581,18 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, return NULL; } - /* Look up this identifier in the hash table. */ + *last = node; identifier = token->value.str; + + /* Special handling for __LINE__ and __FILE__, (not through + * the hash table). */ + if (strcmp(identifier, "__LINE__") == 0) + return _token_list_create_with_one_integer (parser, node->token->location.first_line); + + if (strcmp(identifier, "__FILE__") == 0) + return _token_list_create_with_one_integer (parser, node->token->location.source); + + /* Look up this identifier in the hash table. */ macro = hash_table_find (parser->defines, identifier); /* Not a macro, so no expansion needed. */ @@ -1550,14 +1613,12 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, final = _token_create_str (parser, OTHER, str); expansion = _token_list_create (parser); _token_list_append (expansion, final); - *last = node; return expansion; } if (! macro->is_function) { token_list_t *replacement; - *last = node; /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) diff --git a/mesalib/src/glsl/glcpp/glcpp.c b/mesalib/src/glsl/glcpp/glcpp.c index 35db47087..7c2ded850 100644 --- a/mesalib/src/glsl/glcpp/glcpp.c +++ b/mesalib/src/glsl/glcpp/glcpp.c @@ -111,7 +111,7 @@ main (int argc, char *argv[]) if (shader == NULL) return 1; - ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL); + ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, API_OPENGL_COMPAT); printf("%s", shader); fprintf(stderr, "%s", info_log); diff --git a/mesalib/src/glsl/ir_function_detect_recursion.cpp b/mesalib/src/glsl/ir_function_detect_recursion.cpp index 0a5e647cd..4b39f9724 100644 --- a/mesalib/src/glsl/ir_function_detect_recursion.cpp +++ b/mesalib/src/glsl/ir_function_detect_recursion.cpp @@ -173,6 +173,7 @@ public: has_recursion_visitor() : current(NULL) { + progress = false; this->mem_ctx = ralloc_context(NULL); this->function_hash = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index af0b5768a..ad57a3149 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -120,7 +120,7 @@ ir_visitor_status ir_validate::visit_leave(ir_loop *ir) { if (ir->counter != NULL) { - if ((ir->from == NULL) || (ir->from == NULL) || (ir->increment == NULL)) { + if ((ir->from == NULL) || (ir->to == NULL) || (ir->increment == NULL)) { printf("ir_loop has invalid loop controls:\n" " counter: %p\n" " from: %p\n" @@ -136,7 +136,7 @@ ir_validate::visit_leave(ir_loop *ir) abort(); } } else { - if ((ir->from != NULL) || (ir->from != NULL) || (ir->increment != NULL)) { + if ((ir->from != NULL) || (ir->to != NULL) || (ir->increment != NULL)) { printf("ir_loop has invalid loop controls:\n" " counter: %p\n" " from: %p\n" diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp index 04143ad43..33cd79c85 100644 --- a/mesalib/src/glsl/main.cpp +++ b/mesalib/src/glsl/main.cpp @@ -223,7 +223,7 @@ main(int argc, char **argv) if (argc <= optind) usage_fail(argv[0]); - initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL); + initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL_COMPAT); struct gl_shader_program *whole_program; diff --git a/mesalib/src/glsl/opt_constant_propagation.cpp b/mesalib/src/glsl/opt_constant_propagation.cpp index c5ae36b69..a03811999 100644 --- a/mesalib/src/glsl/opt_constant_propagation.cpp +++ b/mesalib/src/glsl/opt_constant_propagation.cpp @@ -92,6 +92,7 @@ public: ir_constant_propagation_visitor() { progress = false; + killed_all = false; mem_ctx = ralloc_context(0); this->acp = new(mem_ctx) exec_list; this->kills = new(mem_ctx) exec_list; diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp index 5ed11702c..ce5df24d9 100644 --- a/mesalib/src/glsl/test_optpass.cpp +++ b/mesalib/src/glsl/test_optpass.cpp @@ -197,7 +197,7 @@ int test_optpass(int argc, char **argv) struct gl_context local_ctx; struct gl_context *ctx = &local_ctx; - initialize_context_to_defaults(ctx, API_OPENGL); + initialize_context_to_defaults(ctx, API_OPENGL_COMPAT); ctx->Driver.NewShader = _mesa_new_shader; |