diff options
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/glcpp/glcpp-parse.y | 7 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_lexer.ll | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index 3cc00bd56e8..60323e449da 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -377,6 +377,13 @@ control_line_success: glcpp_parser_copy_defines, &di); + /* Print out '#include' to the glsl parser. We do this + * so that it can do the error checking require to + * make sure the ARB_shading_language_include + * extension is enabled. + */ + _mesa_string_buffer_printf(parser->output, "#include\n"); + /* Parse the include string before adding to the * preprocessor output. */ diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index 8c59e1d748f..7d7ee0c00ff 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -236,6 +236,14 @@ PATH ["][./ _A-Za-z0-9]*["] ^[ \t]*#[ \t]*$ ; ^[ \t]*#[ \t]*version { BEGIN PP; return VERSION_TOK; } ^[ \t]*#[ \t]*extension { BEGIN PP; return EXTENSION; } +{HASH}include { + if (!yyextra->ARB_shading_language_include_enable) { + struct _mesa_glsl_parse_state *state = yyextra; + _mesa_glsl_error(yylloc, state, + "ARB_shading_language_include required " + "to use #include"); + } +} {HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ { /* Eat characters until the first digit is * encountered |