[Mesa-dev] [PATCH 07/13] glsl: Add comments for the point mode layout-id-qualifier validation
Timothy Arceri
timothy.arceri at collabora.com
Thu Nov 17 05:47:41 UTC 2016
On Mon, 2016-11-14 at 19:15 +0200, Andres Gomez wrote:
> The point mode value in an ast_type_qualifier can only be true if the
> flag is already set since this layout-id-qualifier can only be or not
> be present in a shader.
>
> Hence, it is useless to check for its value if the flag is already
> set. However, for coherence and compatibility with future changes we
> do check its value.
It's dead code. Please remove the error check and replace it with an
assert.
>
> Added comments explaining this.
>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
> src/compiler/glsl/ast_type.cpp | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/compiler/glsl/ast_type.cpp
> b/src/compiler/glsl/ast_type.cpp
> index 064c63b..7c59747 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -315,6 +315,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
> this->ordering = q.ordering;
> }
>
> + /* Point mode can only be true if set but we check anyway in case
> there are
> + * more options in the future.
> + */
> if (q.flags.q.point_mode) {
> if (this->flags.q.point_mode && this->point_mode !=
> q.point_mode) {
> _mesa_glsl_error(loc, state, "conflicting point mode
> used");
> @@ -581,6 +584,9 @@ ast_type_qualifier::validate_in_qualifier(YYLTYPE
> *loc,
> "conflicting ordering specified");
> }
>
> + /* Point mode can only be true if set but we check anyway in case
> there are
> + * more options in the future.
> + */
> if (state->in_qualifier->flags.q.point_mode && this-
> >flags.q.point_mode
> && state->in_qualifier->point_mode != this->point_mode) {
> r = false;
More information about the mesa-dev
mailing list