[Mesa-dev] [PATCH 07/23] glsl: Add production for "subroutine qualifier"
Dave Airlie
airlied at gmail.com
Thu Apr 23 18:42:43 PDT 2015
From: Chris Forbes <chrisf at ijw.co.nz>
This covers two of the three uses of 'subroutine':
- Subroutine type declarations
- Subroutine uniform declarations
Support for the `subroutine (type, ...)` form will be added in
a later commit.
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
src/glsl/ast.h | 3 +++
src/glsl/glsl_parser.yy | 15 +++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index ef74e51..d2c5fec 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -514,6 +514,9 @@ struct ast_type_qualifier {
unsigned stream:1; /**< Has stream value assigned */
unsigned explicit_stream:1; /**< stream value assigned explicitly by shader code */
/** \} */
+
+ /** \name Qualifiers for GL_ARB_shader_subroutine */
+ unsigned subroutine:1; /**< Is this marked 'subroutine' */
}
/** \brief Set of flags, accessed by name. */
q;
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index aceb3b9..743cf26 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -214,6 +214,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
%type <type_qualifier> layout_qualifier
%type <type_qualifier> layout_qualifier_id_list layout_qualifier_id
%type <type_qualifier> interface_block_layout_qualifier
+%type <type_qualifier> subroutine_qualifier
%type <type_qualifier> interface_qualifier
%type <type_specifier> type_specifier
%type <type_specifier> type_specifier_nonarray
@@ -1547,6 +1548,14 @@ interface_block_layout_qualifier:
}
;
+subroutine_qualifier:
+ SUBROUTINE
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.subroutine = 1;
+ }
+ ;
+
interpolation_qualifier:
SMOOTH
{
@@ -1581,6 +1590,7 @@ type_qualifier:
| storage_qualifier
| interpolation_qualifier
| layout_qualifier
+ | subroutine_qualifier
| precision_qualifier
{
memset(&$$, 0, sizeof($$));
@@ -1671,6 +1681,11 @@ type_qualifier:
$$ = $1;
$$.merge_qualifier(&@1, state, $2);
}
+ | subroutine_qualifier type_qualifier
+ {
+ $$ = $1;
+ $$.merge_qualifier(&@1, state, $2);
+ }
| auxiliary_storage_qualifier type_qualifier
{
if ($2.has_auxiliary_storage()) {
--
2.1.0
More information about the mesa-dev
mailing list