diff options
author | Chris Forbes <[email protected]> | 2013-11-29 21:21:56 +1300 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2013-12-07 17:14:39 +1300 |
commit | 51aa15aca2bf5764b8cd62bbf2329eda40f7a859 (patch) | |
tree | 93f13b8280c101da3a69ec0d9e8f251b4bd9582c /src | |
parent | a1ca5802401c384c1eadbf72cf910c65e377600c (diff) |
glsl: Add frontend support for `sample` auxiliary storage qualifier
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ast.h | 1 | ||||
-rw-r--r-- | src/glsl/ast_type.cpp | 3 | ||||
-rw-r--r-- | src/glsl/glsl_lexer.ll | 2 | ||||
-rw-r--r-- | src/glsl/glsl_parser.yy | 9 | ||||
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 2 |
5 files changed, 13 insertions, 4 deletions
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) |