From: Chris Forbes Date: Fri, 29 Nov 2013 08:21:56 +0000 (+1300) Subject: glsl: Add frontend support for `sample` auxiliary storage qualifier X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=51aa15aca2bf5764b8cd62bbf2329eda40f7a859;p=mesa.git glsl: Add frontend support for `sample` auxiliary storage qualifier Signed-off-by: Chris Forbes Reviewed-by: Francisco Jerez --- diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 5c214b6043b..76911f056d3 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -357,6 +357,7 @@ struct ast_type_qualifier { unsigned in:1; unsigned out:1; unsigned centroid:1; + unsigned sample:1; unsigned uniform:1; unsigned smooth:1; unsigned flat:1; diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 2b088bf8b85..d758bfa1f2a 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -90,7 +90,8 @@ ast_type_qualifier::has_storage() const bool ast_type_qualifier::has_auxiliary_storage() const { - return this->flags.q.centroid; + return this->flags.q.centroid + || this->flags.q.sample; } const char* diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 822d70d6b66..50875bf3b23 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -520,7 +520,7 @@ readonly KEYWORD(0, 300, 0, 0, READONLY); writeonly KEYWORD(0, 300, 0, 0, WRITEONLY); resource KEYWORD(0, 300, 0, 0, RESOURCE); patch KEYWORD(0, 300, 0, 0, PATCH); -sample KEYWORD(0, 300, 0, 0, SAMPLE); +sample KEYWORD_WITH_ALT(400, 300, 400, 0, yyextra->ARB_gpu_shader5_enable, SAMPLE); subroutine KEYWORD(0, 300, 0, 0, SUBROUTINE); diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index ada3690f609..10165547924 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1521,7 +1521,7 @@ type_qualifier: { if ($2.has_auxiliary_storage()) { _mesa_glsl_error(&@1, state, - "duplicate auxiliary storage qualifier (centroid)"); + "duplicate auxiliary storage qualifier (centroid or sample)"); } if (!state->ARB_shading_language_420pack_enable && @@ -1571,7 +1571,12 @@ auxiliary_storage_qualifier: memset(& $$, 0, sizeof($$)); $$.flags.q.centroid = 1; } - /* TODO: "sample" and "patch" also go here someday. */ + | SAMPLE + { + memset(& $$, 0, sizeof($$)); + $$.flags.q.sample = 1; + } + /* TODO: "patch" also goes here someday. */ storage_qualifier: CONST_TOK diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 8e350902355..2645c08af90 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -878,6 +878,8 @@ _mesa_ast_type_qualifier_print(const struct ast_type_qualifier *q) if (q->flags.q.centroid) printf("centroid "); + if (q->flags.q.sample) + printf("sample "); if (q->flags.q.uniform) printf("uniform "); if (q->flags.q.smooth)