diff options
author | marha <marha@users.sourceforge.net> | 2014-02-07 23:46:30 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-02-07 23:46:30 +0100 |
commit | 6daf40f6b1138efad98dbb579cd35520cbc349bb (patch) | |
tree | 7f45dbb347f5e1a73b18a720633b9d801c968490 /mesalib/src/glsl/glcpp | |
parent | 5c64f94cf4cf8457a5616fe20b9a27174895f1a8 (diff) | |
parent | 982ac918afe6a1c02d5cf735d7b6c56443a048cc (diff) | |
download | vcxsrv-6daf40f6b1138efad98dbb579cd35520cbc349bb.tar.gz vcxsrv-6daf40f6b1138efad98dbb579cd35520cbc349bb.tar.bz2 vcxsrv-6daf40f6b1138efad98dbb579cd35520cbc349bb.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
xkbcomp xkeyboard-config libxcb libxtrans fontconfig libX11 libxcb mesa xserver git update 7 Feb 2014
Conflicts:
mesalib/src/glsl/glcpp/glcpp.c
openssl/Makefile
Diffstat (limited to 'mesalib/src/glsl/glcpp')
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp-lex.l | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp-parse.y | 49 | ||||
-rwxr-xr-x[-rw-r--r--] | mesalib/src/glsl/glcpp/glcpp.c | 3 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/glcpp.h | 5 | ||||
-rw-r--r-- | mesalib/src/glsl/glcpp/pp.c | 4 |
5 files changed, 40 insertions, 23 deletions
diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l index f1fa192c5..ea3b862e4 100644 --- a/mesalib/src/glsl/glcpp/glcpp-lex.l +++ b/mesalib/src/glsl/glcpp/glcpp-lex.l @@ -155,8 +155,6 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* Single-line comments */ "//"[^\n]* { - if (parser->commented_newlines) - BEGIN NEWLINE_CATCHUP; } /* Multi-line comments */ diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index 184e5c237..eeafa4d39 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -30,6 +30,7 @@ #include "glcpp.h" #include "main/core.h" /* for struct gl_extensions */ +#include "main/mtypes.h" /* for gl_api enum */ static void yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); @@ -194,7 +195,7 @@ line: ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n"); } | HASH_LINE { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } pp_tokens NEWLINE { if (parser->skip_stack == NULL || @@ -254,10 +255,10 @@ define: control_line: HASH_DEFINE { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } define | HASH_UNDEF { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } IDENTIFIER NEWLINE { macro_t *macro = hash_table_find (parser->defines, $3); if (macro) { @@ -267,7 +268,7 @@ control_line: ralloc_free ($3); } | HASH_IF { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } conditional_tokens NEWLINE { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we @@ -299,14 +300,14 @@ control_line: _glcpp_parser_skip_stack_push_if (parser, & @1, 0); } | HASH_IFDEF { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $3); ralloc_free ($3); _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); } | HASH_IFNDEF { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $3); ralloc_free ($3); @@ -374,13 +375,19 @@ control_line: _glcpp_parser_skip_stack_pop (parser, & @1); } NEWLINE | HASH_VERSION integer_constant NEWLINE { + if (parser->version_resolved) { + glcpp_error(& @1, parser, "#version must appear on the first line"); + } _glcpp_parser_handle_version_declaration(parser, $2, NULL, true); } | HASH_VERSION integer_constant IDENTIFIER NEWLINE { + if (parser->version_resolved) { + glcpp_error(& @1, parser, "#version must appear on the first line"); + } _glcpp_parser_handle_version_declaration(parser, $2, $3, true); } | HASH NEWLINE { - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); } ; @@ -1186,7 +1193,7 @@ static void add_builtin_define(glcpp_parser_t *parser, } glcpp_parser_t * -glcpp_parser_create (const struct gl_extensions *extensions) +glcpp_parser_create (const struct gl_extensions *extensions, gl_api api) { glcpp_parser_t *parser; @@ -1215,6 +1222,7 @@ glcpp_parser_create (const struct gl_extensions *extensions) parser->error = 0; parser->extensions = extensions; + parser->api = api; parser->version_resolved = false; parser->has_new_line_number = 0; @@ -2024,6 +2032,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio { const struct gl_extensions *extensions = parser->extensions; + if (parser->version_resolved) + return; + parser->version_resolved = true; add_builtin_define (parser, "__VERSION__", version); @@ -2043,6 +2054,8 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio } else { add_builtin_define(parser, "GL_ARB_draw_buffers", 1); add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); + add_builtin_define(parser, "GL_AMD_shader_trinary_minmax", 1); + if (extensions != NULL) { if (extensions->EXT_texture_array) @@ -2108,11 +2121,11 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio if (extensions->ARB_shader_atomic_counters) add_builtin_define(parser, "GL_ARB_shader_atomic_counters", 1); - if (extensions->AMD_shader_trinary_minmax) - add_builtin_define(parser, "GL_AMD_shader_trinary_minmax", 1); - if (extensions->ARB_viewport_array) add_builtin_define(parser, "GL_ARB_viewport_array", 1); + + if (extensions->ARB_compute_shader) + add_builtin_define(parser, "GL_ARB_compute_shader", 1); } } @@ -2140,15 +2153,19 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio } } -/* GLSL version is no version is explicitly specified. */ +/* GLSL version if no version is explicitly specified. */ #define IMPLICIT_GLSL_VERSION 110 +/* GLSL ES version if no version is explicitly specified. */ +#define IMPLICIT_GLSL_ES_VERSION 100 + void -glcpp_parser_resolve_version(glcpp_parser_t *parser) +glcpp_parser_resolve_implicit_version(glcpp_parser_t *parser) { - if (parser->version_resolved) - return; + int language_version = parser->api == API_OPENGLES2 ? + IMPLICIT_GLSL_ES_VERSION : + IMPLICIT_GLSL_VERSION; - _glcpp_parser_handle_version_declaration(parser, IMPLICIT_GLSL_VERSION, + _glcpp_parser_handle_version_declaration(parser, language_version, NULL, false); } diff --git a/mesalib/src/glsl/glcpp/glcpp.c b/mesalib/src/glsl/glcpp/glcpp.c index b632f1715..0144be85b 100644..100755 --- a/mesalib/src/glsl/glcpp/glcpp.c +++ b/mesalib/src/glsl/glcpp/glcpp.c @@ -38,7 +38,7 @@ #define close _close #endif -extern int yydebug; +extern int glcpp_parser_debug; void _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, @@ -109,6 +109,7 @@ load_text_file(void *ctx, const char *filename) static void init_fake_gl_context (struct gl_context *gl_ctx) { + gl_ctx->API = API_OPENGL_COMPAT; gl_ctx->Const.DisableGLSLLineContinuations = false; } diff --git a/mesalib/src/glsl/glcpp/glcpp.h b/mesalib/src/glsl/glcpp/glcpp.h index 4aa200a63..79ccb234f 100644 --- a/mesalib/src/glsl/glcpp/glcpp.h +++ b/mesalib/src/glsl/glcpp/glcpp.h @@ -183,6 +183,7 @@ struct glcpp_parser { size_t info_log_length; int error; const struct gl_extensions *extensions; + gl_api api; bool version_resolved; bool has_new_line_number; int new_line_number; @@ -194,7 +195,7 @@ struct glcpp_parser { struct gl_extensions; glcpp_parser_t * -glcpp_parser_create (const struct gl_extensions *extensions); +glcpp_parser_create (const struct gl_extensions *extensions, gl_api api); int glcpp_parser_parse (glcpp_parser_t *parser); @@ -203,7 +204,7 @@ void glcpp_parser_destroy (glcpp_parser_t *parser); void -glcpp_parser_resolve_version(glcpp_parser_t *parser); +glcpp_parser_resolve_implicit_version(glcpp_parser_t *parser); int glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, diff --git a/mesalib/src/glsl/glcpp/pp.c b/mesalib/src/glsl/glcpp/pp.c index 637a58f9c..4a623f81e 100644 --- a/mesalib/src/glsl/glcpp/pp.c +++ b/mesalib/src/glsl/glcpp/pp.c @@ -139,7 +139,7 @@ glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, const struct gl_extensions *extensions, struct gl_context *gl_ctx) { int errors; - glcpp_parser_t *parser = glcpp_parser_create (extensions); + glcpp_parser_t *parser = glcpp_parser_create (extensions, gl_ctx->API); if (! gl_ctx->Const.DisableGLSLLineContinuations) *shader = remove_line_continuations(parser, *shader); @@ -151,7 +151,7 @@ glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log, if (parser->skip_stack) glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); - glcpp_parser_resolve_version(parser); + glcpp_parser_resolve_implicit_version(parser); ralloc_strcat(info_log, parser->info_log); |