util: Do not use align as variable name

Because align is also a function in u_math.h

Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23421>
This commit is contained in:
Yonggang Luo
2023-06-04 14:59:01 +08:00
committed by Marge Bot
parent 586391720b
commit 4134f9ac09
2 changed files with 16 additions and 16 deletions
+10 -10
View File
@@ -7700,7 +7700,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
/* Offset can only be used with std430 and std140 layouts an initial
* value of 0 is used for error detection.
*/
unsigned align = 0;
unsigned base_alignment = 0;
unsigned size = 0;
if (layout) {
bool row_major;
@@ -7712,10 +7712,10 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
}
if(layout->flags.q.std140) {
align = field_type->std140_base_alignment(row_major);
base_alignment = field_type->std140_base_alignment(row_major);
size = field_type->std140_size(row_major);
} else if (layout->flags.q.std430) {
align = field_type->std430_base_alignment(row_major);
base_alignment = field_type->std430_base_alignment(row_major);
size = field_type->std430_size(row_major);
}
}
@@ -7724,12 +7724,12 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
unsigned qual_offset;
if (process_qualifier_constant(state, &loc, "offset",
qual->offset, &qual_offset)) {
if (align != 0 && size != 0) {
if (base_alignment != 0 && size != 0) {
if (next_offset > qual_offset)
_mesa_glsl_error(&loc, state, "layout qualifier "
"offset overlaps previous member");
if (qual_offset % align) {
if (qual_offset % base_alignment) {
_mesa_glsl_error(&loc, state, "layout qualifier offset "
"must be a multiple of the base "
"alignment of %s", field_type->name);
@@ -7746,7 +7746,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
if (qual->flags.q.explicit_align || expl_align != 0) {
unsigned offset = fields[i].offset != -1 ? fields[i].offset :
next_offset;
if (align == 0 || size == 0) {
if (base_alignment == 0 || size == 0) {
_mesa_glsl_error(&loc, state, "align can only be used with "
"std430 and std140 layouts");
} else if (qual->flags.q.explicit_align) {
@@ -7767,8 +7767,8 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
next_offset = fields[i].offset + size;
}
} else if (!qual->flags.q.explicit_offset) {
if (align != 0 && size != 0)
next_offset = glsl_align(next_offset, align) + size;
if (base_alignment != 0 && size != 0)
next_offset = glsl_align(next_offset, base_alignment) + size;
}
/* From the ARB_enhanced_layouts spec:
@@ -7790,8 +7790,8 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
}
} else {
if (layout && layout->flags.q.explicit_xfb_offset) {
unsigned align = field_type->is_64bit() ? 8 : 4;
fields[i].offset = glsl_align(block_xfb_offset, align);
unsigned base_alignment = field_type->is_64bit() ? 8 : 4;
fields[i].offset = glsl_align(block_xfb_offset, base_alignment);
block_xfb_offset += 4 * field_type->component_slots();
}
}
+6 -6
View File
@@ -2180,16 +2180,16 @@ glsl_type::std140_size(bool row_major) const
}
const struct glsl_type *field_type = this->fields.structure[i].type;
unsigned align = field_type->std140_base_alignment(field_row_major);
unsigned base_alignment = field_type->std140_base_alignment(field_row_major);
/* Ignore unsized arrays when calculating size */
if (field_type->is_unsized_array())
continue;
size = glsl_align(size, align);
size = glsl_align(size, base_alignment);
size += field_type->std140_size(field_row_major);
max_align = MAX2(align, max_align);
max_align = MAX2(base_alignment, max_align);
if (field_type->is_struct() && (i + 1 < this->length))
size = glsl_align(size, 16);
@@ -2548,11 +2548,11 @@ glsl_type::std430_size(bool row_major) const
}
const struct glsl_type *field_type = this->fields.structure[i].type;
unsigned align = field_type->std430_base_alignment(field_row_major);
size = glsl_align(size, align);
unsigned base_alignment = field_type->std430_base_alignment(field_row_major);
size = glsl_align(size, base_alignment);
size += field_type->std430_size(field_row_major);
max_align = MAX2(align, max_align);
max_align = MAX2(base_alignment, max_align);
}
size = glsl_align(size, max_align);
return size;