st/mesa: check texture target in allocate_full_mipmap()
Some kinds of textures never have mipmaps. 3D textures seldom have mipmaps. Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user