[Mesa-dev] [PATCH 1/3] st/mesa: check for immutable texture in st_TestProxyTexImage()

Brian Paul brianp at vmware.com
Wed Jul 13 21:57:55 UTC 2016


If it's immutable, we don't have to guess about the number of mipmap
levels.
---
 src/mesa/state_tracker/st_cb_texture.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 1474d97..b91a2ae 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2716,8 +2716,13 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
                                       &pt.width0, &pt.height0,
                                       &pt.depth0, &pt.array_size);
 
-      if (level == 0 && (texObj->Sampler.MinFilter == GL_LINEAR ||
-                         texObj->Sampler.MinFilter == GL_NEAREST)) {
+      if (texObj->Immutable) {
+         /* For immutable textures we know the final number of mip levels */
+         assert(texObj->NumLevels > 0);
+         pt.last_level = texObj->NumLevels - 1;
+      }
+      else if (level == 0 && (texObj->Sampler.MinFilter == GL_LINEAR ||
+                              texObj->Sampler.MinFilter == GL_NEAREST)) {
          /* assume just one mipmap level */
          pt.last_level = 0;
       }
-- 
1.9.1



More information about the mesa-dev mailing list