mesa: Adjust _MaxLevel computation to account for views
authorChris Forbes <chrisf@ijw.co.nz>
Fri, 24 Jan 2014 21:36:04 +0000 (10:36 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Thu, 10 Apr 2014 06:27:40 +0000 (18:27 +1200)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
src/mesa/main/texobj.c

index 8bdbb08c8ea36ded2f5988f00ca0287fcd21abc0..918dd59edaa8ff6593f4762e668b46d0b3f86e11 100644 (file)
@@ -559,6 +559,13 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
                        /* 'q' in the GL spec */
                        maxLevels - 1);
 
+   if (t->Immutable) {
+      /* Adjust max level for views: the data store may have more levels than
+       * the view exposes.
+       */
+      t->_MaxLevel = MIN2(t->_MaxLevel, t->NumLevels - 1);
+   }
+
    /* Compute _MaxLambda = q - p in the spec used during mipmapping */
    t->_MaxLambda = (GLfloat) (t->_MaxLevel - baseLevel);