radeon: fix cases when only first image where put directly into miptree.
authorMaciej Cencora <m.cencora@gmail.com>
Mon, 7 Dec 2009 21:24:41 +0000 (22:24 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Mon, 7 Dec 2009 21:33:11 +0000 (22:33 +0100)
Make sure that minimal width, height and depth of texture image is 1.

src/mesa/drivers/dri/radeon/radeon_texture.c

index 00e0658dc5454924aea166fc1a4f245ad7f27f81..28690325d1259bffbab4f8d51ca9be6a31cf44a5 100644 (file)
@@ -524,9 +524,9 @@ static int image_matches_texture_obj(struct gl_texture_object *texObj,
                return 0;
 
        const unsigned levelDiff = level - texObj->BaseLevel;
-       const unsigned refWidth = baseImage->Width >> levelDiff;
-       const unsigned refHeight = baseImage->Height >> levelDiff;
-       const unsigned refDepth = baseImage->Depth >> levelDiff;
+       const unsigned refWidth = MAX2(baseImage->Width >> levelDiff, 1);
+       const unsigned refHeight = MAX2(baseImage->Height >> levelDiff, 1);
+       const unsigned refDepth = MAX2(baseImage->Depth >> levelDiff, 1);
 
        return (texImage->Width == refWidth &&
                        texImage->Height == refHeight &&