[Mesa-dev] [PATCH 06/23] glsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.

Francisco Jerez currojerez at riseup.net
Tue Nov 26 00:02:22 PST 2013


---
 src/glsl/ast.h        | 32 +++++++++++++++++++++++++++++++-
 src/glsl/ast_type.cpp |  5 +++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index 5c214b6..b750bb7 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -413,12 +413,23 @@ struct ast_type_qualifier {
 	 unsigned prim_type:1;
 	 unsigned max_vertices:1;
 	 /** \} */
+
+	 /** \name Layout and memory qualifiers for ARB_shader_image_load_store. */
+	 /** \{ */
+	 unsigned early_fragment_tests:1;
+	 unsigned explicit_image_format:1;
+	 unsigned coherent:1;
+	 unsigned _volatile:1;
+	 unsigned _restrict:1;
+	 unsigned read_only:1;
+	 unsigned write_only:1;
+	 /** \} */
       }
       /** \brief Set of flags, accessed by name. */
       q;
 
       /** \brief Set of flags, accessed as a bitmask. */
-      unsigned i;
+      uint64_t i;
    } flags;
 
    /** Precision of the type (highp/medium/lowp). */
@@ -463,6 +474,25 @@ struct ast_type_qualifier {
    int offset;
 
    /**
+    * Image format specified with an ARB_shader_image_load_store
+    * layout qualifier.
+    *
+    * \note
+    * This field is only valid if \c explicit_image_format is set.
+    */
+   GLenum image_format;
+
+   /**
+    * Base type of the data read from or written to this image.  Only
+    * the following enumerants are allowed: GLSL_TYPE_UINT,
+    * GLSL_TYPE_INT, GLSL_TYPE_FLOAT.
+    *
+    * \note
+    * This field is only valid if \c explicit_image_format is set.
+    */
+   glsl_base_type image_base_type;
+
+   /**
     * Return true if and only if an interpolation qualifier is present.
     */
    bool has_interpolation() const;
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 2b088bf..64c6758 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -180,6 +180,11 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
    if (q.precision != ast_precision_none)
       this->precision = q.precision;
 
+   if (q.flags.q.explicit_image_format) {
+      this->image_format = q.image_format;
+      this->image_base_type = q.image_base_type;
+   }
+
    return true;
 }
 
-- 
1.8.3.4



More information about the mesa-dev mailing list