[Mesa-dev] [PATCH 2/3] Remove image_matches_texture_obj() MaxLevel check

Maciej Cencora m.cencora at gmail.com
Sat May 22 05:09:47 PDT 2010


Dnia wtorek 18 maja 2010 o 21:09:58 Will Dyson napisał(a):
> When generating or uploading a new (higher) mipmap level for an image,
> we can need to allocate a miptree for a level greater than
> texObj->MaxLevel.
> ---
>  src/mesa/drivers/dri/radeon/radeon_texture.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c
> b/src/mesa/drivers/dri/radeon/radeon_texture.c index 2b655fb..6ceff88
> 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_texture.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
> @@ -588,8 +588,9 @@ static int image_matches_texture_obj(struct
> gl_texture_object *texObj, if (!baseImage)
>  		return 0;
> 
> -	if (level < texObj->BaseLevel || level > texObj->MaxLevel)
> +	if (level < texObj->BaseLevel)
>  		return 0;
> +

Please add a comment stating why the MaxLevel isn't checked anymore here.

Regards,
Maciej

> 
>  	const unsigned levelDiff = level - texObj->BaseLevel;
>  	const unsigned refWidth = MAX2(baseImage->Width >> levelDiff, 1);
> @@ -610,8 +611,8 @@ static void teximage_assign_miptree(radeonContextPtr
> rmesa, radeonTexObj *t = radeon_tex_obj(texObj);
>  	radeon_texture_image* image = get_radeon_texture_image(texImage);
> 
> -	/* Since miptree holds only images for levels <BaseLevel..MaxLevel>
> -	 * don't allocate the miptree if the teximage won't fit.
> +	/* Check to make sure texture dimensions are appropriate
> +	 * and that there is a base level
>  	 */
>  	if (!image_matches_texture_obj(texObj, texImage, level))
>  		return;


More information about the mesa-dev mailing list