[Mesa-dev] [PATCH 1/6] glsl: Add frontend support for `sample` auxiliary storage qualifier
Chris Forbes
chrisf at ijw.co.nz
Fri Nov 29 00:54:35 PST 2013
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
src/glsl/ast.h | 1 +
src/glsl/ast_type.cpp | 3 ++-
src/glsl/glsl_lexer.ll | 2 +-
src/glsl/glsl_parser.yy | 9 +++++++--
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 5c214b6..76911f0 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 2b088bf..d758bfa 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 822d70d..50875bf 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 ada3690..1016554 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 d76d94b..cdb8652 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -877,6 +877,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)
--
1.8.4.2
More information about the mesa-dev
mailing list