summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-12-17 14:16:24 -0700
committerBrian Paul <[email protected]>2016-01-06 15:53:47 -0700
commit18038b9fd6792be794ae1be80e006542be602b2a (patch)
tree614b78f60e05f29152a94ed615c6e8c4e8ddac2a
parentc032ae85ee1581870a34f5faad76e5b7ddaf4090 (diff)
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 <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 867d4daad68..f8b367989e7 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;
+ }
+
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;
}