From 7cef2b22b84aecf9cddf65a3a054fd39e2e9b369 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 12 Jul 2013 22:34:19 -0700 Subject: [PATCH] glsl: Add a new ast_type_qualifier::has_layout() method. This makes it easy to check if any layout qualifiers are set. Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- src/glsl/ast.h | 5 +++++ src/glsl/ast_type.cpp | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index c0350e7358e..441b389a74a 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -457,6 +457,11 @@ struct ast_type_qualifier { */ bool has_interpolation() const; + /** + * Return whether a layout qualifier is present. + */ + bool has_layout() const; + /** * \brief Return string representation of interpolation qualifier. * diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index be84550da78..4e870a70742 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -56,6 +56,24 @@ bool ast_type_qualifier::has_interpolation() const || this->flags.q.noperspective; } +bool +ast_type_qualifier::has_layout() const +{ + return this->flags.q.origin_upper_left + || this->flags.q.pixel_center_integer + || this->flags.q.depth_any + || this->flags.q.depth_greater + || this->flags.q.depth_less + || this->flags.q.depth_unchanged + || this->flags.q.std140 + || this->flags.q.shared + || this->flags.q.column_major + || this->flags.q.row_major + || this->flags.q.packed + || this->flags.q.explicit_location + || this->flags.q.explicit_index; +} + const char* ast_type_qualifier::interpolation_string() const { -- 2.30.2