This matches u_minify()'s behavior, for consistency.
Reviewed-by: Brian Paul <brianp@vmware.com>
stack_height += MAX2(2, height);
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = minify(width, 1);
+ height = minify(height, 1);
+ depth = minify(depth, 1);
}
/* Fixup depth image_offsets: */
0, i * stack_height);
}
- depth = minify(depth);
+ depth = minify(depth, 1);
}
/* Multiply slice size by texture depth for total size. It's
mt->total_height += img_height;
- width = minify(width);
- height = minify(height);
+ width = minify(width, 1);
+ height = minify(height, 1);
}
}
pack_y_pitch >>= 1;
}
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
+ width = minify(width, 1);
+ height = minify(height, 1);
+ depth = minify(depth, 1);
}
}
int h0, h1, q;
h0 = ALIGN(mt->physical_height0, mt->align_h);
- h1 = ALIGN(minify(mt->physical_height0), mt->align_h);
+ h1 = ALIGN(minify(mt->physical_height0, 1), mt->align_h);
if (mt->array_spacing_lod0)
qpitch = h0;
else
mt->total_height += y;
- width = minify(width);
- height = minify(height);
+ width = minify(width, 1);
+ height = minify(height, 1);
if (mt->target == GL_TEXTURE_3D)
- depth = minify(depth);
+ depth = minify(depth, 1);
if (mt->compressed) {
pack_y_pitch = (height + 3) / 4;
GLuint mip1_width;
if (mt->compressed) {
- mip1_width = ALIGN(minify(mt->physical_width0), mt->align_w)
- + ALIGN(minify(minify(mt->physical_width0)), mt->align_w);
+ mip1_width = ALIGN(minify(mt->physical_width0, 1), mt->align_w) +
+ ALIGN(minify(mt->physical_width0, 2), mt->align_w);
} else {
- mip1_width = ALIGN(minify(mt->physical_width0), mt->align_w)
- + minify(minify(mt->physical_width0));
+ mip1_width = ALIGN(minify(mt->physical_width0, 1), mt->align_w) +
+ minify(mt->physical_width0, 2);
}
if (mip1_width > mt->total_width) {
y += img_height;
}
- width = minify(width);
- height = minify(height);
+ width = minify(width, 1);
+ height = minify(height, 1);
}
}
#include "main/macros.h"
-
-static INLINE GLuint minify( GLuint d )
-{
- return MAX2(1, d>>1);
-}
-
extern void i945_miptree_layout_2d(struct intel_mipmap_tree *mt);
void
};
offset += size;
- width = MAX2(1, width / 2);
- height = MAX2(1, height / 2);
+ width = minify(width, 1);
+ height = minify(height, 1);
}
/* Get new storage. */
lvl->rowstride, lvl->width, height, lvl->faces[face].offset);
}
-static GLuint minify(GLuint size, GLuint levels)
-{
- size = size >> levels;
- if (size < 1)
- size = 1;
- return size;
-}
-
-
static void calculate_miptree_layout(radeonContextPtr rmesa, radeon_mipmap_tree *mt)
{
GLuint curOffset, i, face, level;
#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
+static inline unsigned
+minify(unsigned value, unsigned levels)
+{
+ return MAX2(1, value >> levels);
+}
+
/**
* Align a value up to an alignment value
*