|| this->flags.q.write_only;
}
+static bool
+validate_prim_type(YYLTYPE *loc,
+ _mesa_glsl_parse_state *state,
+ const ast_type_qualifier &qualifier,
+ const ast_type_qualifier &new_qualifier)
+{
+ /* Input layout qualifiers can be specified multiple
+ * times in separate declarations, as long as they match.
+ */
+ if (qualifier.flags.q.prim_type && new_qualifier.flags.q.prim_type
+ && qualifier.prim_type != new_qualifier.prim_type) {
+ _mesa_glsl_error(loc, state,
+ "conflicting input primitive %s specified",
+ state->stage == MESA_SHADER_GEOMETRY ?
+ "type" : "mode");
+ return false;
+ }
+
+ return true;
+}
+
+static bool
+validate_vertex_spacing(YYLTYPE *loc,
+ _mesa_glsl_parse_state *state,
+ const ast_type_qualifier &qualifier,
+ const ast_type_qualifier &new_qualifier)
+{
+ if (qualifier.flags.q.vertex_spacing && new_qualifier.flags.q.vertex_spacing
+ && qualifier.vertex_spacing != new_qualifier.vertex_spacing) {
+ _mesa_glsl_error(loc, state,
+ "conflicting vertex spacing specified");
+ return false;
+ }
+
+ return true;
+}
+
+static bool
+validate_ordering(YYLTYPE *loc,
+ _mesa_glsl_parse_state *state,
+ const ast_type_qualifier &qualifier,
+ const ast_type_qualifier &new_qualifier)
+{
+ if (qualifier.flags.q.ordering && new_qualifier.flags.q.ordering
+ && qualifier.ordering != new_qualifier.ordering) {
+ _mesa_glsl_error(loc, state,
+ "conflicting ordering specified");
+ return false;
+ }
+
+ return true;
+}
+
+static bool
+validate_point_mode(YYLTYPE *loc,
+ _mesa_glsl_parse_state *state,
+ const ast_type_qualifier &qualifier,
+ const ast_type_qualifier &new_qualifier)
+{
+ /* Point mode can only be true if the flag is set. */
+ assert (!qualifier.flags.q.point_mode || !new_qualifier.flags.q.point_mode
+ || (qualifier.point_mode && new_qualifier.point_mode));
+
+ return true;
+}
+
/**
* This function merges both duplicate identifies within a single layout and
* multiple layout qualifiers on a single variable declaration. The
const ast_type_qualifier &q,
bool is_single_layout_merge)
{
+ bool r = true;
ast_type_qualifier ubo_mat_mask;
ubo_mat_mask.flags.i = 0;
ubo_mat_mask.flags.q.row_major = 1;
}
if (q.flags.q.prim_type) {
- if (this->flags.q.prim_type && this->prim_type != q.prim_type) {
- _mesa_glsl_error(loc, state,
- "conflicting input primitive %s specified",
- state->stage == MESA_SHADER_GEOMETRY ?
- "type" : "mode");
- return false;
- }
+ r &= validate_prim_type(loc, state, *this, q);
this->flags.q.prim_type = 1;
this->prim_type = q.prim_type;
}
}
if (q.flags.q.vertex_spacing) {
- if (this->flags.q.vertex_spacing && this->vertex_spacing != q.vertex_spacing) {
- _mesa_glsl_error(loc, state, "conflicting vertex spacing used");
- return false;
- }
+ r &= validate_vertex_spacing(loc, state, *this, q);
this->flags.q.vertex_spacing = 1;
this->vertex_spacing = q.vertex_spacing;
}
if (q.flags.q.ordering) {
- if (this->flags.q.ordering && this->ordering != q.ordering) {
- _mesa_glsl_error(loc, state, "conflicting ordering used");
- return false;
- }
+ r &= validate_ordering(loc, state, *this, q);
this->flags.q.ordering = 1;
this->ordering = q.ordering;
}
if (q.flags.q.point_mode) {
- /* Point mode can only be true if the flag is set. */
- assert (!this->flags.q.point_mode || (this->point_mode && q.point_mode));
+ r &= validate_point_mode(loc, state, *this, q);
this->flags.q.point_mode = 1;
this->point_mode = q.point_mode;
}
this->image_base_type = q.image_base_type;
}
- return true;
+ return r;
}
bool
* error against the default global input qualifier as soon as we can, with
* the closest error location in the shader.
*/
-
- /* Input layout qualifiers can be specified multiple
- * times in separate declarations, as long as they match.
- */
- if (state->in_qualifier->flags.q.prim_type && this->flags.q.prim_type
- && state->in_qualifier->prim_type != this->prim_type) {
- r = false;
- _mesa_glsl_error(loc, state,
- "conflicting input primitive %s specified",
- state->stage == MESA_SHADER_GEOMETRY ?
- "type" : "mode");
- }
-
- if (state->in_qualifier->flags.q.vertex_spacing
- && this->flags.q.vertex_spacing
- && state->in_qualifier->vertex_spacing != this->vertex_spacing) {
- r = false;
- _mesa_glsl_error(loc, state,
- "conflicting vertex spacing specified");
- }
-
- if (state->in_qualifier->flags.q.ordering && this->flags.q.ordering
- && state->in_qualifier->ordering != this->ordering) {
- r = false;
- _mesa_glsl_error(loc, state,
- "conflicting ordering specified");
- }
-
- /* Point mode can only be true if the flag is set. */
- assert (!state->in_qualifier->flags.q.point_mode
- || !this->flags.q.point_mode
- || (state->in_qualifier->point_mode && this->point_mode));
+ r &= validate_prim_type(loc, state, *state->in_qualifier, *this);
+ r &= validate_vertex_spacing(loc, state, *state->in_qualifier, *this);
+ r &= validate_ordering(loc, state, *state->in_qualifier, *this);
+ r &= validate_point_mode(loc, state, *state->in_qualifier, *this);
return r;
}