summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-04-25 15:59:07 -0600
committerBrian Paul <brianp@vmware.com>2016-04-27 10:23:19 -0600
commit23c55e5c233927fee2a866d9aa842c975024933f (patch)
tree61914da46160b2c1f14f2170ac8c3181ebef135b
parent419e3865713efc17bf48213154c5a96eaaa89443 (diff)
downloadexternal_mesa3d-23c55e5c233927fee2a866d9aa842c975024933f.zip
external_mesa3d-23c55e5c233927fee2a866d9aa842c975024933f.tar.gz
external_mesa3d-23c55e5c233927fee2a866d9aa842c975024933f.tar.bz2
tgsi: s/Elements/ARRAY_SIZE/
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c12
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c8
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_strings.c16
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c8
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c10
6 files changed, 28 insertions, 28 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 806ba72..d483429 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2071,11 +2071,11 @@ exec_tex(struct tgsi_exec_machine *mach,
assert(dim <= 4);
if (shadow_ref >= 0)
- assert(shadow_ref >= dim && shadow_ref < Elements(args));
+ assert(shadow_ref >= dim && shadow_ref < ARRAY_SIZE(args));
/* fetch modifier to the last argument */
if (modifier != TEX_MODIFIER_NONE) {
- const int last = Elements(args) - 1;
+ const int last = ARRAY_SIZE(args) - 1;
/* fetch modifier from src0.w or src1.x */
if (sampler == 1) {
@@ -2107,7 +2107,7 @@ exec_tex(struct tgsi_exec_machine *mach,
control = TGSI_SAMPLER_GATHER;
}
else {
- for (i = dim; i < Elements(args); i++)
+ for (i = dim; i < ARRAY_SIZE(args); i++)
args[i] = &ZeroVec;
}
@@ -2162,18 +2162,18 @@ exec_lodq(struct tgsi_exec_machine *mach,
int dim;
int i;
union tgsi_exec_channel coords[4];
- const union tgsi_exec_channel *args[Elements(coords)];
+ const union tgsi_exec_channel *args[ARRAY_SIZE(coords)];
union tgsi_exec_channel r[2];
unit = fetch_sampler_unit(mach, inst, 1);
dim = tgsi_util_get_texture_coord_dim(inst->Texture.Texture);
- assert(dim <= Elements(coords));
+ assert(dim <= ARRAY_SIZE(coords));
/* fetch coordinates */
for (i = 0; i < dim; i++) {
FETCH(&coords[i], 0, TGSI_CHAN_X + i);
args[i] = &coords[i];
}
- for (i = dim; i < Elements(coords); i++) {
+ for (i = dim; i < ARRAY_SIZE(coords); i++) {
args[i] = &ZeroVec;
}
mach->Sampler->query_lod(mach->Sampler, unit, unit,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 292d70f..847d420 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -272,7 +272,7 @@ tgsi_get_opcode_info( uint opcode )
if (firsttime) {
unsigned i;
firsttime = 0;
- for (i = 0; i < Elements(opcode_info); i++)
+ for (i = 0; i < ARRAY_SIZE(opcode_info); i++)
assert(opcode_info[i].opcode == i);
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index ab81262..e07148d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -200,7 +200,7 @@ scan_instruction(struct tgsi_shader_info *info,
const unsigned index = src->Register.Index;
assert(fullinst->Instruction.Texture);
- assert(index < Elements(info->is_msaa_sampler));
+ assert(index < ARRAY_SIZE(info->is_msaa_sampler));
assert(index < PIPE_MAX_SAMPLERS);
if (is_texture_inst(fullinst->Instruction.Opcode)) {
@@ -503,7 +503,7 @@ scan_property(struct tgsi_shader_info *info,
unsigned name = fullprop->Property.PropertyName;
unsigned value = fullprop->u[0].Data;
- assert(name < Elements(info->properties));
+ assert(name < ARRAY_SIZE(info->properties));
info->properties[name] = value;
switch (name) {
@@ -535,10 +535,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
memset(info, 0, sizeof(*info));
for (i = 0; i < TGSI_FILE_COUNT; i++)
info->file_max[i] = -1;
- for (i = 0; i < Elements(info->const_file_max); i++)
+ for (i = 0; i < ARRAY_SIZE(info->const_file_max); i++)
info->const_file_max[i] = -1;
info->properties[TGSI_PROPERTY_GS_INVOCATIONS] = 1;
- for (i = 0; i < Elements(info->sampler_targets); i++)
+ for (i = 0; i < ARRAY_SIZE(info->sampler_targets); i++)
info->sampler_targets[i] = TGSI_TEXTURE_UNKNOWN;
/**
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 894d475..306ab4f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -225,12 +225,12 @@ const char *tgsi_memory_names[3] =
static inline void
tgsi_strings_check(void)
{
- STATIC_ASSERT(Elements(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
- STATIC_ASSERT(Elements(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
- STATIC_ASSERT(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
- STATIC_ASSERT(Elements(tgsi_primitive_names) == PIPE_PRIM_MAX);
- STATIC_ASSERT(Elements(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
- STATIC_ASSERT(Elements(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_semantic_names) == TGSI_SEMANTIC_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_texture_names) == TGSI_TEXTURE_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_property_names) == TGSI_PROPERTY_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_primitive_names) == PIPE_PRIM_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_interpolate_names) == TGSI_INTERPOLATE_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_return_type_names) == TGSI_RETURN_TYPE_COUNT);
(void) tgsi_processor_type_names;
(void) tgsi_return_type_names;
(void) tgsi_immediate_type_names;
@@ -242,8 +242,8 @@ tgsi_strings_check(void)
const char *
tgsi_file_name(unsigned file)
{
- STATIC_ASSERT(Elements(tgsi_file_names) == TGSI_FILE_COUNT);
- if (file < Elements(tgsi_file_names))
+ STATIC_ASSERT(ARRAY_SIZE(tgsi_file_names) == TGSI_FILE_COUNT);
+ if (file < ARRAY_SIZE(tgsi_file_names))
return tgsi_file_names[file];
else
return "invalid file";
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 114e6e5..3f5ef05 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1539,11 +1539,11 @@ static boolean parse_immediate( struct translate_ctx *ctx )
report_error( ctx, "Syntax error" );
return FALSE;
}
- for (type = 0; type < Elements(tgsi_immediate_type_names); ++type) {
+ for (type = 0; type < ARRAY_SIZE(tgsi_immediate_type_names); ++type) {
if (str_match_nocase_whole(&ctx->cur, tgsi_immediate_type_names[type]))
break;
}
- if (type == Elements(tgsi_immediate_type_names)) {
+ if (type == ARRAY_SIZE(tgsi_immediate_type_names)) {
report_error( ctx, "Expected immediate type" );
return FALSE;
}
@@ -1589,7 +1589,7 @@ parse_fs_coord_origin( const char **pcur, uint *fs_coord_origin )
{
uint i;
- for (i = 0; i < Elements(tgsi_fs_coord_origin_names); i++) {
+ for (i = 0; i < ARRAY_SIZE(tgsi_fs_coord_origin_names); i++) {
const char *cur = *pcur;
if (str_match_nocase_whole( &cur, tgsi_fs_coord_origin_names[i])) {
@@ -1606,7 +1606,7 @@ parse_fs_coord_pixel_center( const char **pcur, uint *fs_coord_pixel_center )
{
uint i;
- for (i = 0; i < Elements(tgsi_fs_coord_pixel_center_names); i++) {
+ for (i = 0; i < ARRAY_SIZE(tgsi_fs_coord_pixel_center_names); i++) {
const char *cur = *pcur;
if (str_match_nocase_whole( &cur, tgsi_fs_coord_pixel_center_names[i])) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 7ed9bd6..021b81f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -202,7 +202,7 @@ static void tokens_error( struct ureg_tokens *tokens )
FREE(tokens->tokens);
tokens->tokens = error_tokens;
- tokens->size = Elements(error_tokens);
+ tokens->size = ARRAY_SIZE(error_tokens);
tokens->count = 0;
}
@@ -264,7 +264,7 @@ static union tgsi_any_token *retrieve_token( struct ureg_program *ureg,
void
ureg_property(struct ureg_program *ureg, unsigned name, unsigned value)
{
- assert(name < Elements(ureg->properties));
+ assert(name < ARRAY_SIZE(ureg->properties));
ureg->properties[name] = value;
}
@@ -1729,7 +1729,7 @@ static void emit_decls( struct ureg_program *ureg )
{
unsigned i,j;
- for (i = 0; i < Elements(ureg->properties); i++)
+ for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)
if (ureg->properties[i] != ~0)
emit_property(ureg, i, ureg->properties[i]);
@@ -2094,7 +2094,7 @@ ureg_create_with_screen(unsigned processor, struct pipe_screen *screen)
PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE) != 0;
ureg->next_shader_processor = -1;
- for (i = 0; i < Elements(ureg->properties); i++)
+ for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)
ureg->properties[i] = ~0;
ureg->free_temps = util_bitmask_create();
@@ -2142,7 +2142,7 @@ void ureg_destroy( struct ureg_program *ureg )
{
unsigned i;
- for (i = 0; i < Elements(ureg->domain); i++) {
+ for (i = 0; i < ARRAY_SIZE(ureg->domain); i++) {
if (ureg->domain[i].tokens &&
ureg->domain[i].tokens != error_tokens)
FREE(ureg->domain[i].tokens);