diff options
author | Will Dyson <[email protected]> | 2010-06-19 22:04:45 +0200 |
---|---|---|
committer | Maciej Cencora <[email protected]> | 2010-06-19 22:09:24 +0200 |
commit | c674a7eb7fb2fd170df7ff5e3cefdddabda1a03f (patch) | |
tree | f3b0cbca8e64cffacce10e927265cd6f36621fc7 /src/mesa/drivers/dri/radeon | |
parent | 9b2ebcaf4b94bfc8756f6b216e0e452013616f2c (diff) |
Revert "Fix image_matches_texture_obj() MaxLevel check"
This reverts commit a9ee95651131e27d5acf3d10909b5b7e5c8d3e92.
It was based on a failure to understand how ther driver allocates
memory, and causes a regression with Celestia.
Set MaxLevel to dstLevel before allocating new mipmap level.
The radeon driver will fail to allocate space for a new level that
is outside of BaseLevel..MaxLevel. Set MaxLevel before allocating.
Signed-off-by: Maciej Cencora <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index bcac125baf4..d2b190e42e0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -593,12 +593,7 @@ static int image_matches_texture_obj(struct gl_texture_object *texObj, if (!baseImage) return 0; - /* Check image level against object BaseLevel, but not MaxLevel. MaxLevel is not - * the highest level that can be assigned to the miptree. - */ - const unsigned maxLevel = texObj->BaseLevel + baseImage->MaxLog2; - if (level < texObj->BaseLevel || level > maxLevel - || level > RADEON_MIPTREE_MAX_TEXTURE_LEVELS) + if (level < texObj->BaseLevel || level > texObj->MaxLevel) return 0; const unsigned levelDiff = level - texObj->BaseLevel; @@ -620,7 +615,9 @@ static void teximage_assign_miptree(radeonContextPtr rmesa, radeonTexObj *t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - /* check image for dimension and level compatibility with texture */ + /* Since miptree holds only images for levels <BaseLevel..MaxLevel> + * don't allocate the miptree if the teximage won't fit. + */ if (!image_matches_texture_obj(texObj, texImage, level)) return; |