[Mesa-dev] [PATCH 8/9] glcpp: add gl_context to glcpp_parser_t
nobled
nobled at dreamwidth.org
Fri Apr 13 08:52:20 PDT 2012
---
src/glsl/glcpp/glcpp-parse.y | 5 ++++-
src/glsl/glcpp/glcpp.h | 5 ++---
src/glsl/glcpp/pp.c | 3 +--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 47ba54d..dd90a34 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1081,16 +1081,19 @@ static void add_builtin_define(glcpp_parser_t *parser,
}
glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions, int api)
+glcpp_parser_create (int api, struct gl_context *ctx)
{
glcpp_parser_t *parser;
int language_version;
+ const struct gl_extensions *extensions;
parser = ralloc (NULL, glcpp_parser_t);
+ extensions = ctx ? &ctx->Extensions : NULL;
glcpp_lex_init_extra (parser, &parser->scanner);
parser->defines = hash_table_ctor (32, hash_table_string_hash,
hash_table_string_compare);
+ parser->ctx = ctx;
parser->active = NULL;
parser->lexing_if = 0;
parser->space_tokens = 1;
diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h
index 0c52077..699b21b 100644
--- a/src/glsl/glcpp/glcpp.h
+++ b/src/glsl/glcpp/glcpp.h
@@ -164,6 +164,7 @@ struct gl_context;
struct glcpp_parser {
yyscan_t scanner;
+ struct gl_context *ctx;
struct hash_table *defines;
active_list_t *active;
int lexing_if;
@@ -181,10 +182,8 @@ struct glcpp_parser {
int error;
};
-struct gl_extensions;
-
glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions, int api);
+glcpp_parser_create (int api, struct gl_context *glctx);
int
glcpp_parser_parse (glcpp_parser_t *parser);
diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c
index 7218eeb..32054bb 100644
--- a/src/glsl/glcpp/pp.c
+++ b/src/glsl/glcpp/pp.c
@@ -149,8 +149,7 @@ preprocess(void *ralloc_ctx, const char **shader,
char **info_log,
int api, struct gl_context *glctx)
{
int errors;
- struct gl_extensions *extensions = glctx ? &glctx->Extensions : NULL;
- glcpp_parser_t *parser = glcpp_parser_create (extensions, api);
+ glcpp_parser_t *parser = glcpp_parser_create (api, glctx);
*shader = remove_line_continuations(parser, *shader);
glcpp_lex_set_source_string (parser, *shader);
--
1.7.4.1
More information about the mesa-dev
mailing list