From 28f53ace336706912fda6cc6877f72bffdcae330 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 19 May 2007 00:59:06 +0200 Subject: [PATCH] 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. --- .../drivers/dri/i915tex/intel_tex_validate.c | 17 ++++++++++------- 1 file 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); } -- 2.30.2