Mesa (mesa_7_7_branch): radeon: fix cases when only first image where put directly into miptree.

Maciej Cencora osiris at kemper.freedesktop.org
Mon Dec 7 13:33:54 PST 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 9921b3048e611398460ef774355b7515bc901240
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9921b3048e611398460ef774355b7515bc901240

Author: Maciej Cencora <m.cencora at gmail.com>
Date:   Mon Dec  7 22:24:41 2009 +0100

radeon: fix cases when only first image where put directly into miptree.

Make sure that minimal width, height and depth of texture image is 1.

---

 src/mesa/drivers/dri/radeon/radeon_texture.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 00e0658..2869032 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -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 &&



More information about the mesa-commit mailing list