summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-08-28 11:49:30 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-08-28 11:49:30 +0000
commit64bc9caa1c1fd6ca6f032ae08ec85d332f0b713a (patch)
tree25f17ae32ada84480099e42dc1696ae088f1248f
parent89a2ea6fd316150d4a50113a12e189eaa98cc6df (diff)
various texture tweaks
-rw-r--r--src/mesa/drivers/dri/i915/intel_mipmap_tree.c27
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex_format.c3
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex_image.c3
3 files changed, 19 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
index 08ae06a287..97e76c4c80 100644
--- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
@@ -164,10 +164,10 @@ GLboolean intel_miptree_match_image( struct intel_mipmap_tree *mt,
image->IsCompressed != mt->compressed)
return GL_FALSE;
- _mesa_printf("%s: %d/%d %d/%d %d/%d\n", __FUNCTION__,
- image->Width, mt->level[level].width,
- image->Height, mt->level[level].height,
- image->Depth, mt->level[level].depth);
+ DBG("%s: %d/%d %d/%d %d/%d\n", __FUNCTION__,
+ image->Width, mt->level[level].width,
+ image->Height, mt->level[level].height,
+ image->Depth, mt->level[level].depth);
/* Test image dimensions against the base level image adjusted for
* minification. This will also catch images not present in the
@@ -197,8 +197,8 @@ void intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
mt->level[level].level_offset = (x + y * mt->pitch) * mt->cpp;
mt->level[level].nr_images = nr_images;
- _mesa_printf("%s level %d img size: %d,%d level_offset 0x%x\n", __FUNCTION__, level, w, h,
- mt->level[level].level_offset);
+ DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, level, w, h, d,
+ x, y, mt->level[level].level_offset);
/* Not sure when this would happen, but anyway:
*/
@@ -220,13 +220,16 @@ void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
GLuint img,
GLuint x, GLuint y)
{
- _mesa_printf("%s level %d img %d pos %d,%d\n", __FUNCTION__, level, img, x, y);
-
- if (img == 0)
+ if (img == 0 && level == 0)
assert(x == 0 && y == 0);
+
+ assert(img < mt->level[level].nr_images);
+
+ mt->level[level].image_offset[img] = (x + y * mt->pitch);
- if (img > 0)
- mt->level[level].image_offset[img] = (x + y * mt->pitch) * mt->cpp;
+ DBG("%s level %d img %d pos %d,%d image_offset %x\n",
+ __FUNCTION__, level, img, x, y,
+ mt->level[level].image_offset[img]);
}
@@ -255,7 +258,7 @@ GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt,
{
if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
return (mt->level[level].level_offset +
- mt->level[level].image_offset[face]);
+ mt->level[level].image_offset[face] * mt->cpp);
else
return mt->level[level].level_offset;
}
diff --git a/src/mesa/drivers/dri/i915/intel_tex_format.c b/src/mesa/drivers/dri/i915/intel_tex_format.c
index 5139f0a765..fdc3df467c 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_format.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_format.c
@@ -23,7 +23,8 @@ intelChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGBA:
case GL_COMPRESSED_RGBA:
if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
+ if ( type == GL_UNSIGNED_BYTE ||
+ type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
return &_mesa_texformat_argb8888;
}
else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
diff --git a/src/mesa/drivers/dri/i915/intel_tex_image.c b/src/mesa/drivers/dri/i915/intel_tex_image.c
index ea52ec360a..b1a501ad84 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_image.c
@@ -159,7 +159,8 @@ static GLboolean check_pbo_blit( GLint internalFormat,
case 4:
case GL_RGBA:
return (format == GL_BGRA &&
- type == GL_UNSIGNED_INT_8_8_8_8_REV &&
+ (type == GL_UNSIGNED_BYTE ||
+ type == GL_UNSIGNED_INT_8_8_8_8_REV) &&
mesa_format == &_mesa_texformat_argb8888);
case 3:
case GL_RGB: