summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2007-05-19 00:59:06 +0200
committerRoland Scheidegger <[email protected]>2007-05-19 01:39:54 +0200
commitc093666bc57dd9afead69256eaf05fbe4f6beecb (patch)
tree6cbcadb23e0948c42ce6a27645f25769c44e83aa /src/mesa
parent04972f6761489cb85d735384b33d5e52fce127be (diff)
fix miptree comparison with compressed textures
TexelBytes is always 0 with compressed textures, thus would never match mt->cpp. This caused constant blitting around of textures, and it fixes at least the horrible performance of Q3 if compressed textures are enabled.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_validate.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_validate.c b/src/mesa/drivers/dri/i915tex/intel_tex_validate.c
index 79d587a1744..0ae4fee1ba0 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_validate.c
@@ -105,6 +105,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
{
struct gl_texture_object *tObj = intel->ctx.Texture.Unit[unit]._Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
+ int comp_byte = 0;
+ int cpp;
GLuint face, i;
GLuint nr_faces = 0;
@@ -148,6 +150,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
intel_miptree_reference(&intelObj->mt, firstImage->mt);
}
+ if (firstImage->base.IsCompressed) {
+ comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
+ cpp = comp_byte;
+ }
+ else cpp = firstImage->base.TexFormat->TexelBytes;
+
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
*
@@ -165,7 +173,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
intelObj->mt->width0 != firstImage->base.Width ||
intelObj->mt->height0 != firstImage->base.Height ||
intelObj->mt->depth0 != firstImage->base.Depth ||
- intelObj->mt->cpp != firstImage->base.TexFormat->TexelBytes ||
+ intelObj->mt->cpp != cpp ||
intelObj->mt->compressed != firstImage->base.IsCompressed)) {
intel_miptree_release(intel, &intelObj->mt);
}
@@ -174,10 +182,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* May need to create a new tree:
*/
if (!intelObj->mt) {
- int comp_byte = 0;
-
- if (firstImage->base.IsCompressed)
- comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat);
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
firstImage->base.InternalFormat,
@@ -186,8 +190,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
firstImage->base.Width,
firstImage->base.Height,
firstImage->base.Depth,
- firstImage->base.TexFormat->
- TexelBytes,
+ cpp,
comp_byte);
}