summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_type.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2013-10-20 12:38:07 -0700
committerIan Romanick <ian.d.romanick@intel.com>2013-11-07 15:56:57 -0800
commite63bb298531918c3a17e77a9ad96670e724c9c37 (patch)
tree9181aa991c227472ebb5d4a225e2c6dd7c811369 /src/glsl/ast_type.cpp
parent30f61c471de5a9637e5d830e2b5b9dc4145f94d2 (diff)
downloadexternal_mesa3d-e63bb298531918c3a17e77a9ad96670e724c9c37.zip
external_mesa3d-e63bb298531918c3a17e77a9ad96670e724c9c37.tar.gz
external_mesa3d-e63bb298531918c3a17e77a9ad96670e724c9c37.tar.bz2
glsl: Implement parser support for atomic counters.
v2: Mark atomic counters as read-only variables. Move offset overlap code to the linker. Use the contains_atomic() convenience method. v3: Use pointer to integer instead of non-const reference. Add comment so we remember to add a spec quotation from the next GLSL release once the issue of atomic counter aggregation within structures is clarified. v4 (idr): Don't use std::map because it's overkill. Add an assertion that ctx->Const.MaxAtomicBufferBindings <= MAX_COMBINED_ATOMIC_BUFFERS. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/glsl/ast_type.cpp')
-rw-r--r--src/glsl/ast_type.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 8aabd95..2b088bf 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -72,7 +72,8 @@ ast_type_qualifier::has_layout() const
|| this->flags.q.packed
|| this->flags.q.explicit_location
|| this->flags.q.explicit_index
- || this->flags.q.explicit_binding;
+ || this->flags.q.explicit_binding
+ || this->flags.q.explicit_offset;
}
bool
@@ -121,13 +122,18 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
ubo_layout_mask.flags.q.packed = 1;
ubo_layout_mask.flags.q.shared = 1;
+ ast_type_qualifier ubo_binding_mask;
+ ubo_binding_mask.flags.q.explicit_binding = 1;
+ ubo_binding_mask.flags.q.explicit_offset = 1;
+
/* Uniform block layout qualifiers get to overwrite each
* other (rightmost having priority), while all other
* qualifiers currently don't allow duplicates.
*/
if ((this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i |
- ubo_layout_mask.flags.i)) != 0) {
+ ubo_layout_mask.flags.i |
+ ubo_binding_mask.flags.i)) != 0) {
_mesa_glsl_error(loc, state,
"duplicate layout qualifiers used");
return false;
@@ -168,6 +174,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
if (q.flags.q.explicit_binding)
this->binding = q.binding;
+ if (q.flags.q.explicit_offset)
+ this->offset = q.offset;
+
if (q.precision != ast_precision_none)
this->precision = q.precision;