break;
}
+ /* Set MaxLevel large enough to hold the new level when we allocate it */
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, dstLevel);
+
/* Create empty dest image */
if (target == GL_TEXTURE_1D) {
_mesa_TexImage1D(target, dstLevel, srcImage->InternalFormat,
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;
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;