aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel/intel_tex_layout.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2007-10-12 11:02:46 +1000
committerDave Airlie <[email protected]>2007-10-12 11:02:46 +1000
commitbf805d3bf5bf191aa669b6155316a78917cf9b0e (patch)
treed76223fb22381485f7ecc8f6c7d026dcd88d80f3 /src/mesa/drivers/dri/intel/intel_tex_layout.c
parent9e06cf00cfb24528653913fc90eded4d370c1149 (diff)
parent72c888869f4e5074e57c349ec356798959be791e (diff)
Merge branch 'master' into i915-superioctl
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_tex_layout.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_layout.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c
index fdecd3e1868..4da636021ba 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
@@ -32,14 +32,9 @@
#include "intel_mipmap_tree.h"
#include "intel_tex_layout.h"
+#include "intel_context.h"
#include "macros.h"
-
-static int align(int value, int alignment)
-{
- return (value + alignment - 1) & ~(alignment - 1);
-}
-
GLuint intel_compressed_alignment(GLenum internalFormat)
{
GLuint alignment = 4;
@@ -70,7 +65,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
if (mt->compressed) {
align_w = intel_compressed_alignment(mt->internal_format);
- mt->pitch = align(mt->width0, align_w);
+ mt->pitch = ALIGN(mt->width0, align_w);
}
/* May need to adjust pitch to accomodate the placement of
@@ -82,10 +77,10 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
GLuint mip1_width;
if (mt->compressed) {
- mip1_width = align(minify(mt->width0), align_w)
- + align(minify(minify(mt->width0)), align_w);
+ mip1_width = ALIGN(minify(mt->width0), align_w)
+ + ALIGN(minify(minify(mt->width0)), align_w);
} else {
- mip1_width = align(minify(mt->width0), align_w)
+ mip1_width = ALIGN(minify(mt->width0), align_w)
+ minify(minify(mt->width0));
}
@@ -97,7 +92,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
/* Pitch must be a whole number of dwords, even though we
* express it in texels.
*/
- mt->pitch = align(mt->pitch * mt->cpp, 4) / mt->cpp;
+ mt->pitch = ALIGN(mt->pitch * mt->cpp, 4) / mt->cpp;
mt->total_height = 0;
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
@@ -109,7 +104,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
if (mt->compressed)
img_height = MAX2(1, height/4);
else
- img_height = align(height, align_h);
+ img_height = ALIGN(height, align_h);
/* Because the images are packed better, the final offset
@@ -120,7 +115,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
/* Layout_below: step right after second mipmap.
*/
if (level == mt->first_level + 1) {
- x += align(width, align_w);
+ x += ALIGN(width, align_w);
}
else {
y += img_height;