Mesa (master): mesa: check for immutable texture in _mesa_test_texobj_completeness()

Brian Paul brianp at kemper.freedesktop.org
Mon Nov 7 21:29:30 UTC 2011


Module: Mesa
Branch: master
Commit: 68c3d21b6857ec39f0849867355b736191823479
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=68c3d21b6857ec39f0849867355b736191823479

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Nov  3 19:56:51 2011 -0600

mesa: check for immutable texture in _mesa_test_texobj_completeness()

One of the points of GL_ARB_texture_storage is to make it impossible
to have malformed mipmap stacks.  If we know the texture object is
immutable, we can skip a bunch of size checking.

---

 src/mesa/main/texobj.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index e2f0dc8..17c78ce 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -415,10 +415,6 @@ incomplete(struct gl_texture_object *t, const char *fmt, ...)
  * The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE
  * accordingly.
  *
- * XXX TODO: For immutable textures (GL_ARB_texture_storage) we can skip
- * many of the checks below since we know the mipmap images will have
- * consistent sizes.
- *
  * \param ctx GL context.
  * \param t texture object.
  *
@@ -504,6 +500,15 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
    /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
    t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
 
+   if (t->Immutable) {
+      /* This texture object was created with glTexStorage1/2/3D() so we
+       * know that all the mipmap levels are the right size and all cube
+       * map faces are the same size.
+       * We don't need to do any of the additional checks below.
+       */
+      return;
+   }
+
    if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
       /* make sure that all six cube map level 0 images are the same size */
       const GLuint w = t->Image[0][baseLevel]->Width2;




More information about the mesa-commit mailing list