[Mesa-dev] [PATCH 2/2] st/mesa: check texture target in allocate_full_mipmap()

Jose Fonseca jfonseca at vmware.com
Wed Jan 6 13:39:03 PST 2016


On 06/01/16 17:10, Brian Paul wrote:
> Some kinds of textures never have mipmaps.  3D textures seldom have
> mipmaps.
> ---
>   src/mesa/state_tracker/st_cb_texture.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index 867d4da..f8b3679 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -404,6 +404,16 @@ static boolean
>   allocate_full_mipmap(const struct st_texture_object *stObj,
>                        const struct st_texture_image *stImage)
>   {
> +   switch (stObj->base.Target) {
> +   case GL_TEXTURE_RECTANGLE_NV:
> +   case GL_TEXTURE_BUFFER:
> +   case GL_TEXTURE_EXTERNAL_OES:
> +   case GL_TEXTURE_2D_MULTISAMPLE:
> +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> +      /* these texture types cannot be mipmapped */
> +      return FALSE;
> +   }
> +

Makes sense.

>      if (stImage->base.Level > 0 || stObj->base.GenerateMipmap)
>         return TRUE;
>
> @@ -420,6 +430,10 @@ allocate_full_mipmap(const struct st_texture_object *stObj,
>         /* not a mipmap minification filter */
>         return FALSE;
>
> +   if (stObj->base.Target == GL_TEXTURE_3D)
> +      /* 3D textures are seldom mipmapped */
> +      return FALSE;
> +
>      return TRUE;
>   }
>
>

I don't have much first hand experience on how 3D apps use 3D volumes., 
but I'd imagine that in most cases they would want to use mipmaps to 
avoid aliasing effects, unless memory is tight.

Anyway, my understanding this function just makes a guess, and it's ok 
to mis-guess.  So, series is

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

Jose




More information about the mesa-dev mailing list