summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2014-02-12 16:56:01 +0100
committerFrancisco Jerez <[email protected]>2014-02-12 18:44:05 +0100
commit299e869d25c88a3c2da4bd4a6d85ce24684136f0 (patch)
treeb6b2fc7c90e8b2ebe3a463f92b36eccb91c90f90 /src/glsl
parentc116541b2c3a45715de15e3180627263143ad426 (diff)
glsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.
v2: Add comment next to the read_only and write_only qualifier flags. Change temporary copies of the type qualifier mask to use uint64_t too. Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ast.h32
-rw-r--r--src/glsl/ast_type.cpp5
-rw-r--r--src/glsl/glsl_parser.yy4
3 files changed, 38 insertions, 3 deletions
diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index 61fd923bcf9..cd913ab34eb 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -466,12 +466,23 @@ struct ast_type_qualifier {
* local_size_x, and so on.
*/
unsigned local_size:3;
+
+ /** \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; /**< "readonly" qualifier. */
+ unsigned write_only:1; /**< "writeonly" qualifier. */
+ /** \} */
}
/** \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). */
@@ -523,6 +534,25 @@ struct ast_type_qualifier {
int local_size[3];
/**
+ * 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 bbc43080801..200566c6d3f 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -190,6 +190,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;
}
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index dc35c1a51b3..ddbcfb396da 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -2228,7 +2228,7 @@ basic_interface_block:
"an instance name are not allowed");
}
- unsigned interface_type_mask;
+ uint64_t interface_type_mask;
struct ast_type_qualifier temp_type_qualifier;
/* Get a bitmask containing only the in/out/uniform flags, allowing us
@@ -2244,7 +2244,7 @@ basic_interface_block:
* production rule guarantees that only one bit will be set (and
* it will be in/out/uniform).
*/
- unsigned block_interface_qualifier = $1.flags.i;
+ uint64_t block_interface_qualifier = $1.flags.i;
block->layout.flags.i |= block_interface_qualifier;