summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/glcpp-parse.y
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-06-30 16:03:19 -0700
committerIan Romanick <[email protected]>2010-07-01 20:40:08 -0700
commit2d1223611700b33aab084f1927bfc1ff1b284115 (patch)
tree94479924e81ad94cdf84570c187418c581b7ae83 /src/glsl/glcpp/glcpp-parse.y
parent6f0823da09384cc1b557385b9e19a9cc7e901ad7 (diff)
glsl2: Define preprocessor tokens for extensions
Currently only GL_ARB_draw_buffers and GL_ARB_texture_rectangle are defined because those extensions are always enabled. This make tex_rect-03.frag pass.
Diffstat (limited to 'src/glsl/glcpp/glcpp-parse.y')
-rw-r--r--src/glsl/glcpp/glcpp-parse.y18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 6beac18c65d..d4cb006bbcd 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -897,6 +897,8 @@ glcpp_parser_t *
glcpp_parser_create (void)
{
glcpp_parser_t *parser;
+ token_t *tok;
+ token_list_t *list;
parser = xtalloc (NULL, glcpp_parser_t);
@@ -919,6 +921,19 @@ glcpp_parser_create (void)
parser->info_log = talloc_strdup(parser, "");
parser->error = 0;
+ /* Add pre-defined macros. */
+ tok = _token_create_ival (parser, INTEGER, 1);
+
+ list = _token_list_create(parser);
+ _token_list_append(list, tok);
+ _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list);
+
+ list = _token_list_create(parser);
+ _token_list_append(list, tok);
+ _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list);
+
+ talloc_unlink(parser, tok);
+
return parser;
}
@@ -1413,7 +1428,8 @@ _define_object_macro (glcpp_parser_t *parser,
{
macro_t *macro;
- _check_for_reserved_macro_name(parser, loc, identifier);
+ if (loc != NULL)
+ _check_for_reserved_macro_name(parser, loc, identifier);
macro = xtalloc (parser, macro_t);