[Mesa-dev] [PATCH 7/7] i965: Declare for-loop counters in the loop in brw_tex_layout.c.
Kenneth Graunke
kenneth at whitecape.org
Tue Jul 2 11:49:42 PDT 2013
The driver is compiled in C99 mode, so this is not a problem. It's
slighlty tidier.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_tex_layout.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 00779f8..6fe4398 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -42,7 +42,6 @@
static void
brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
{
- unsigned level;
unsigned x = 0;
unsigned y = 0;
unsigned width = mt->physical_width0;
@@ -78,7 +77,7 @@ brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
mt->total_height = 0;
- for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
+ for (unsigned level = mt->first_level; level <= mt->last_level; level++) {
unsigned img_height;
intel_miptree_set_level_info(mt, level, x, y, width,
@@ -110,9 +109,8 @@ static void
brw_miptree_layout_texture_array(struct intel_context *intel,
struct intel_mipmap_tree *mt)
{
- unsigned level;
unsigned qpitch = 0;
- int h0, h1, q;
+ int h0, h1;
h0 = ALIGN(mt->physical_height0, mt->align_h);
h1 = ALIGN(minify(mt->physical_height0, 1), mt->align_h);
@@ -125,8 +123,8 @@ brw_miptree_layout_texture_array(struct intel_context *intel,
brw_miptree_layout_2d(mt);
- for (level = mt->first_level; level <= mt->last_level; level++) {
- for (q = 0; q < mt->physical_depth0; q++) {
+ for (unsigned level = mt->first_level; level <= mt->last_level; level++) {
+ for (int q = 0; q < mt->physical_depth0; q++) {
intel_miptree_set_image_offset(mt, level, q, 0, q * qpitch);
}
}
@@ -142,7 +140,6 @@ brw_miptree_layout_texture_3d(struct intel_context *intel,
unsigned depth = mt->physical_depth0;
unsigned pack_x_pitch, pack_x_nr;
unsigned pack_y_pitch;
- unsigned level;
mt->total_height = 0;
@@ -157,17 +154,16 @@ brw_miptree_layout_texture_3d(struct intel_context *intel,
pack_x_pitch = width;
pack_x_nr = 1;
- for (level = mt->first_level ; level <= mt->last_level ; level++) {
+ for (unsigned level = mt->first_level; level <= mt->last_level; level++) {
int x = 0;
int y = 0;
- int q, j;
intel_miptree_set_level_info(mt, level,
0, mt->total_height,
width, height, depth);
- for (q = 0; q < depth; /* empty */) {
- for (j = 0; j < pack_x_nr && q < depth; j++, q++) {
+ for (int q = 0; q < depth; /* empty */) {
+ for (int j = 0; j < pack_x_nr && q < depth; j++, q++) {
intel_miptree_set_image_offset(mt, level, q, x, y);
x += pack_x_pitch;
}
--
1.8.3.1
More information about the mesa-dev
mailing list