summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-07-23 14:58:52 -0700
committerJason Ekstrand <[email protected]>2014-08-04 11:07:10 -0700
commitefa0aa8ffc63e8fdd23335e67ca76eb358cfd1ac (patch)
tree67408f6c4b64fbd145771e27dfa7fb06dd61d7db /src/glsl
parent72e55bb6888ff4d6b69b10d9c58573e4c3d492ec (diff)
util: Gather some common macros
This gathers macros that have been included across components into util so that the include chain can be more vertical. In particular, this makes util stand on its own without any dependence whatsoever on the rest of mesa. Signed-off-by: "Jason Ekstrand" <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/builtin_types.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
index 0a0fa8cd35e..404a8038a43 100644
--- a/src/glsl/builtin_types.cpp
+++ b/src/glsl/builtin_types.cpp
@@ -36,6 +36,7 @@
#include "glsl_types.h"
#include "glsl_parser_extras.h"
+#include "util/macros.h"
/**
* Declarations of type flyweights (glsl_type::_foo_type) and
@@ -48,7 +49,7 @@
#define STRUCT_TYPE(NAME) \
const glsl_type glsl_type::_struct_##NAME##_type = \
- glsl_type(NAME##_fields, Elements(NAME##_fields), #NAME); \
+ glsl_type(NAME##_fields, ARRAY_SIZE(NAME##_fields), #NAME); \
const glsl_type *const glsl_type::struct_##NAME##_type = \
&glsl_type::_struct_##NAME##_type;
@@ -265,7 +266,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
{
struct glsl_symbol_table *symbols = state->symbols;
- for (unsigned i = 0; i < Elements(builtin_type_versions); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(builtin_type_versions); i++) {
const struct builtin_type_versions *const t = &builtin_type_versions[i];
if (state->is_version(t->min_gl, t->min_es)) {
add_type(symbols, t->type);
@@ -276,7 +277,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
* they're still present. We've removed them in 1.40+ (OpenGL 3.1+).
*/
if (!state->es_shader && state->language_version < 140) {
- for (unsigned i = 0; i < Elements(deprecated_types); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(deprecated_types); i++) {
add_type(symbols, deprecated_types[i]);
}
}