radeon: don't check the same miptree many times when looking for matching miptrees
authorMaciej Cencora <m.cencora@gmail.com>
Sun, 29 Nov 2009 11:36:09 +0000 (12:36 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Sun, 29 Nov 2009 16:27:47 +0000 (17:27 +0100)
src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c

index d0b96912048fba3ade25c254930a6e3610fa45d3..39b6d50094e7fa26960107ef355fb891a9f8e6a3 100644 (file)
@@ -506,7 +506,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
                if (!img)
                        break;
 
-               if (!img->mt || !radeon_miptree_matches_texture(img->mt, &texObj->base))
+               if (!img->mt)
                        continue;
 
                for (int i = 0; i < mtCount; ++i) {
@@ -517,8 +517,8 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
                        }
                }
 
-               if (!found) {
-                       mtSizes[mtCount] += img->mt->levels[img->mtlevel].size;
+               if (!found && radeon_miptree_matches_texture(img->mt, &texObj->base)) {
+                       mtSizes[mtCount] = img->mt->levels[img->mtlevel].size;
                        mts[mtCount] = img->mt;
                        mtCount++;
                }