};
ir_function *f = new(mem_ctx) ir_function(name);
- for (unsigned i = 0; i < Elements(types); ++i) {
+ for (unsigned i = 0; i < ARRAY_SIZE(types); ++i) {
if (types[i]->sampler_type != GLSL_TYPE_FLOAT ||
(flags & IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE))
f->add_signature(_image(types[i], intrinsic_name,
#undef MATRIX
-#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)}
+#define STATEVAR(name) {#name, name ## _elements, ARRAY_SIZE(name ## _elements)}
static const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[] = {
STATEVAR(gl_NumSamples),
{ "triangles_adjacency", GL_TRIANGLES_ADJACENCY },
{ "triangle_strip", GL_TRIANGLE_STRIP },
};
- for (unsigned i = 0; i < Elements(map); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
if (match_layout_qualifier($1, map[i].s, state) == 0) {
$$.flags.q.prim_type = 1;
$$.prim_type = map[i].e;
{ "r8_snorm", GL_R8_SNORM, GLSL_TYPE_FLOAT }
};
- for (unsigned i = 0; i < Elements(map); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(map); i++) {
if (match_layout_qualifier($1, map[i].name, state) == 0) {
$$.flags.q.explicit_image_format = 1;
$$.image_format = map[i].format;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
/* Compute shader constants */
- for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupCount); i++)
+ for (unsigned i = 0; i < ARRAY_SIZE(this->Const.MaxComputeWorkGroupCount); i++)
this->Const.MaxComputeWorkGroupCount[i] = ctx->Const.MaxComputeWorkGroupCount[i];
- for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupSize); i++)
+ for (unsigned i = 0; i < ARRAY_SIZE(this->Const.MaxComputeWorkGroupSize); i++)
this->Const.MaxComputeWorkGroupSize[i] = ctx->Const.MaxComputeWorkGroupSize[i];
this->Const.MaxImageUnits = ctx->Const.MaxImageUnits;
*/
static const _mesa_glsl_extension *find_extension(const char *name)
{
- for (unsigned i = 0; i < Elements(_mesa_glsl_supported_extensions); ++i) {
+ for (unsigned i = 0; i < ARRAY_SIZE(_mesa_glsl_supported_extensions); ++i) {
if (strcmp(name, _mesa_glsl_supported_extensions[i].name) == 0) {
return &_mesa_glsl_supported_extensions[i];
}
return false;
} else {
for (unsigned i = 0;
- i < Elements(_mesa_glsl_supported_extensions); ++i) {
+ i < ARRAY_SIZE(_mesa_glsl_supported_extensions); ++i) {
const _mesa_glsl_extension *extension
= &_mesa_glsl_supported_extensions[i];
if (extension->compatible_with_state(state)) {
const char *ir_expression::operator_string(ir_expression_operation op)
{
- assert((unsigned int) op < Elements(operator_strs));
- assert(Elements(operator_strs) == (ir_quadop_vector + 1));
+ assert((unsigned int) op < ARRAY_SIZE(operator_strs));
+ assert(ARRAY_SIZE(operator_strs) == (ir_quadop_vector + 1));
return operator_strs[op];
}
void
ir_variable::enable_extension_warning(const char *extension)
{
- for (unsigned i = 0; i < Elements(warn_extension_table); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(warn_extension_table); i++) {
if (strcmp(warn_extension_table[i], extension) == 0) {
this->data.warn_extension_index = i;
return;
ir_expression *
ir_expression::clone(void *mem_ctx, struct hash_table *ht) const
{
- ir_rvalue *op[Elements(this->operands)] = { NULL, };
+ ir_rvalue *op[ARRAY_SIZE(this->operands)] = { NULL, };
unsigned int i;
for (i = 0; i < get_num_operands(); i++) {
if (this->type->is_error())
return NULL;
- ir_constant *op[Elements(this->operands)] = { NULL, };
+ ir_constant *op[ARRAY_SIZE(this->operands)] = { NULL, };
ir_constant_data data;
memset(&data, 0, sizeof(data));
const int bias[] = { -1, 0, 1 };
bool valid_loop = false;
- for (unsigned i = 0; i < Elements(bias); i++) {
+ for (unsigned i = 0; i < ARRAY_SIZE(bias); i++) {
/* Increment may be of type int, uint or float. */
switch (increment->type->base_type) {
case GLSL_TYPE_INT:
#define SX_AS_INT(x) SX_AS_(int, x)
/* Pattern matching macros */
-#define MATCH(list, pat) s_match(list, Elements(pat), pat, false)
-#define PARTIAL_MATCH(list, pat) s_match(list, Elements(pat), pat, true)
+#define MATCH(list, pat) s_match(list, ARRAY_SIZE(pat), pat, false)
+#define PARTIAL_MATCH(list, pat) s_match(list, ARRAY_SIZE(pat), pat, true)
/* For our purposes, S-Expressions are:
* - <int>
ir_constant *val;
generate_data(mem_ctx, GLSL_TYPE_INT, 1, rows, val);
- const unsigned red_zone_size = Elements(storage) - val->type->components();
+ const unsigned red_zone_size = ARRAY_SIZE(storage) - val->type->components();
fill_storage_array_with_sentinels(storage,
val->type->components(),
red_zone_size);
ir_constant *val;
generate_data(mem_ctx, GLSL_TYPE_UINT, 1, rows, val);
- const unsigned red_zone_size = Elements(storage) - val->type->components();
+ const unsigned red_zone_size = ARRAY_SIZE(storage) - val->type->components();
fill_storage_array_with_sentinels(storage,
val->type->components(),
red_zone_size);
ir_constant *val;
generate_data(mem_ctx, GLSL_TYPE_FLOAT, columns, rows, val);
- const unsigned red_zone_size = Elements(storage) - val->type->components();
+ const unsigned red_zone_size = ARRAY_SIZE(storage) - val->type->components();
fill_storage_array_with_sentinels(storage,
val->type->components(),
red_zone_size);
ir_constant *val;
generate_data(mem_ctx, GLSL_TYPE_BOOL, 1, rows, val);
- const unsigned red_zone_size = Elements(storage) - val->type->components();
+ const unsigned red_zone_size = ARRAY_SIZE(storage) - val->type->components();
fill_storage_array_with_sentinels(storage,
val->type->components(),
red_zone_size);
ir_constant *val;
generate_data(mem_ctx, GLSL_TYPE_INT, 1, 1, val);
- const unsigned red_zone_size = Elements(storage) - val->type->components();
+ const unsigned red_zone_size = ARRAY_SIZE(storage) - val->type->components();
fill_storage_array_with_sentinels(storage,
val->type->components(),
red_zone_size);
ir_constant_data data;
memset(&data, 0, sizeof(data));
for (unsigned i = 0; i < type->components(); i++) {
- const unsigned idx = (i + data_index_base) % Elements(values);
+ const unsigned idx = (i + data_index_base) % ARRAY_SIZE(values);
switch (type->base_type) {
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT: