<div dir="ltr">On 17 July 2013 18:24, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nothing actually uses this yet.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/glsl/ast.h | 14 ++++++++++++++<br>
src/glsl/ast_type.cpp | 6 +++++-<br>
src/glsl/glsl_parser.yy | 12 ++++++++++++<br>
3 files changed, 31 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/glsl/ast.h b/src/glsl/ast.h<br>
index 6aede00..d98f1a3 100644<br>
--- a/src/glsl/ast.h<br>
+++ b/src/glsl/ast.h<br>
@@ -413,6 +413,12 @@ struct ast_type_qualifier {<br>
*/<br>
unsigned explicit_index:1;<br>
<br>
+ /**<br>
+ * Flag set if GL_ARB_shading_language_420pack "binding" layout<br>
+ * qualifier is used.<br>
+ */<br>
+ unsigned explicit_binding:1;<br>
+<br>
/** \name Layout qualifiers for GL_AMD_conservative_depth */<br>
/** \{ */<br>
unsigned depth_any:1;<br>
@@ -456,6 +462,14 @@ struct ast_type_qualifier {<br>
int index;<br>
<br>
/**<br>
+ * Binding specified via GL_ARB_shading_language_420pack's "binding" keyword.<br>
+ *<br>
+ * \note<br>
+ * This field is only valid if \c explicit_binding is set.<br>
+ */<br>
+ int binding;<br>
+<br>
+ /**<br>
* Return true if and only if an interpolation qualifier is present.<br>
*/<br>
bool has_interpolation() const;<br>
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp<br>
index 4cbb835..275b2a1 100644<br>
--- a/src/glsl/ast_type.cpp<br>
+++ b/src/glsl/ast_type.cpp<br>
@@ -71,7 +71,8 @@ ast_type_qualifier::has_layout() const<br>
|| this->flags.q.row_major<br>
|| this->flags.q.packed<br>
|| this->flags.q.explicit_location<br>
- || this->flags.q.explicit_index;<br>
+ || this->flags.q.explicit_index<br>
+ || this->flags.q.explicit_binding;<br>
}<br>
<br>
bool<br>
@@ -145,6 +146,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,<br>
if (q.flags.q.explicit_index)<br>
this->index = q.index;<br>
<br>
+ if (q.flags.q.explicit_binding)<br>
+ this->binding = q.binding;<br>
+<br>
return true;<br>
}<br>
<br>
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy<br>
index 3867cf8..013b327 100644<br>
--- a/src/glsl/glsl_parser.yy<br>
+++ b/src/glsl/glsl_parser.yy<br>
@@ -1254,6 +1254,18 @@ layout_qualifier_id:<br>
}<br>
}<br>
<br>
+ if (state->ARB_shading_language_420pack_enable &&<br>
+ strcmp("binding", $1) == 0) {<br>
+ $$.flags.q.explicit_binding = 1;<br>
+<br>
+ if ($3 >= 0) {<br></blockquote><div><br></div><div>Isn't this redundant with the check performed by validate_binding_qualifier (which is added in patch 4)? I'd rather not do the same check in two places, and I have a minor preference to drop it from here and do it only in validate_binding_qualifier.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ $$.binding = $3;<br>
+ } else {<br>
+ _mesa_glsl_error(& @3, state, "invalid binding %d specified\n", $3);<br>
+ YYERROR;<br>
+ }<br>
+ }<br>
+<br>
/* If the identifier didn't match any known layout identifiers,<br>
* emit an error.<br>
*/<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>