summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-02-28 08:57:27 -0700
committerBrian Paul <[email protected]>2015-03-02 08:55:30 -0700
commitc7136ff64691efec1bf58b34019e5283a751f67b (patch)
tree2e1ac0d2b4ac6536f4df758c5f57bdc8289df5d4 /src/mesa/program
parent16f7b7727569758a4df9c2bae3ca3a0de683960d (diff)
mesa/program: replace Elements() with ARRAY_SIZE()
Acked-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--src/mesa/program/prog_execute.c2
-rw-r--r--src/mesa/program/prog_print.c16
-rw-r--r--src/mesa/program/prog_statevars.c4
4 files changed, 12 insertions, 12 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index b2776da45d9..39790ec8e8c 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1018,7 +1018,7 @@ void
ir_to_mesa_visitor::visit(ir_expression *ir)
{
unsigned int operand;
- src_reg op[Elements(ir->operands)];
+ src_reg op[ARRAY_SIZE(ir->operands)];
src_reg result_src;
dst_reg result_dst;
diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
index ac813324cb4..dc4919ae828 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -124,7 +124,7 @@ get_src_register_pointer(const struct prog_src_register *source,
return (GLfloat *) prog->Parameters->ParameterValues[reg];
case PROGRAM_SYSTEM_VALUE:
- assert(reg < (GLint) Elements(machine->SystemValues));
+ assert(reg < (GLint) ARRAY_SIZE(machine->SystemValues));
return machine->SystemValues[reg];
default:
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 3f499749a2e..d588d07ffe4 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -182,20 +182,20 @@ arb_input_attrib_string(GLuint index, GLenum progType)
};
/* sanity checks */
- STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX);
- STATIC_ASSERT(Elements(fragAttribs) == VARYING_SLOT_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(vertAttribs) == VERT_ATTRIB_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(fragAttribs) == VARYING_SLOT_MAX);
assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0);
assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0);
assert(strcmp(fragAttribs[VARYING_SLOT_TEX0], "fragment.texcoord[0]") == 0);
assert(strcmp(fragAttribs[VARYING_SLOT_VAR0+15], "fragment.varying[15]") == 0);
if (progType == GL_VERTEX_PROGRAM_ARB) {
- assert(index < Elements(vertAttribs));
+ assert(index < ARRAY_SIZE(vertAttribs));
return vertAttribs[index];
}
else {
assert(progType == GL_FRAGMENT_PROGRAM_ARB);
- assert(index < Elements(fragAttribs));
+ assert(index < ARRAY_SIZE(fragAttribs));
return fragAttribs[index];
}
}
@@ -321,19 +321,19 @@ arb_output_attrib_string(GLuint index, GLenum progType)
};
/* sanity checks */
- STATIC_ASSERT(Elements(vertResults) == VARYING_SLOT_MAX);
- STATIC_ASSERT(Elements(fragResults) == FRAG_RESULT_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(vertResults) == VARYING_SLOT_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(fragResults) == FRAG_RESULT_MAX);
assert(strcmp(vertResults[VARYING_SLOT_POS], "result.position") == 0);
assert(strcmp(vertResults[VARYING_SLOT_VAR0], "result.varying[0]") == 0);
assert(strcmp(fragResults[FRAG_RESULT_DATA0], "result.color[0]") == 0);
if (progType == GL_VERTEX_PROGRAM_ARB) {
- assert(index < Elements(vertResults));
+ assert(index < ARRAY_SIZE(vertResults));
return vertResults[index];
}
else {
assert(progType == GL_FRAGMENT_PROGRAM_ARB);
- assert(index < Elements(fragResults));
+ assert(index < ARRAY_SIZE(fragResults));
return fragResults[index];
}
}
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 7e5537191c6..4cde7441fff 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -310,11 +310,11 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
matrix = &ctx->_ModelProjectMatrix;
}
else if (mat == STATE_TEXTURE_MATRIX) {
- assert(index < Elements(ctx->TextureMatrixStack));
+ assert(index < ARRAY_SIZE(ctx->TextureMatrixStack));
matrix = ctx->TextureMatrixStack[index].Top;
}
else if (mat == STATE_PROGRAM_MATRIX) {
- assert(index < Elements(ctx->ProgramMatrixStack));
+ assert(index < ARRAY_SIZE(ctx->ProgramMatrixStack));
matrix = ctx->ProgramMatrixStack[index].Top;
}
else {