Mesa (master): main: allow NEAREST_MIPMAP_NEAREST for stencil texturing

Roland Scheidegger sroland at kemper.freedesktop.org
Tue Dec 6 03:12:49 UTC 2016


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Mon Dec  5 13:39:16 2016 +0100

main: allow NEAREST_MIPMAP_NEAREST for stencil texturing

As per GL 4.5 rules, which fixed a spec mistake in GL_ARB_stencil_texturing.
The extension spec wasn't updated, but just allow it with older GL versions
as well, hoping there aren't any crazy tests which want to see an error
there... (Compile tested only.)

Reported by Józef Kucia <joseph.kucia at gmail.com>

Acked-by: Józef Kucia <joseph.kucia at gmail.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/texobj.h | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 378d87a..8776763 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -125,7 +125,14 @@ static inline GLboolean
 _mesa_is_texture_complete(const struct gl_texture_object *texObj,
                           const struct gl_sampler_object *sampler)
 {
-   if (texObj->_IsIntegerFormat &&
+   /*
+    * According to ARB_stencil_texturing, NEAREST_MIPMAP_NEAREST would
+    * be forbidden, however it is allowed per GL 4.5 rules, allow it
+    * even without GL 4.5 since it was a spec mistake.
+    */
+   if ((texObj->_IsIntegerFormat ||
+        (texObj->StencilSampling &&
+         texObj->Image[0][texObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL)) &&
        (sampler->MagFilter != GL_NEAREST ||
         (sampler->MinFilter != GL_NEAREST &&
          sampler->MinFilter != GL_NEAREST_MIPMAP_NEAREST))) {
@@ -133,20 +140,6 @@ _mesa_is_texture_complete(const struct gl_texture_object *texObj,
       return GL_FALSE;
    }
 
-   /* From the ARB_stencil_texturing specification:
-    * "Add a new bullet point for the conditions that cause the texture
-    *  to not be complete:
-    *
-    *  * The internal format of the texture is DEPTH_STENCIL, the
-    *    DEPTH_STENCIL_TEXTURE_MODE for the texture is STENCIL_INDEX and either
-    *    the magnification filter or the minification filter is not NEAREST."
-    */
-   if (texObj->StencilSampling &&
-       texObj->Image[0][texObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL &&
-       (sampler->MagFilter != GL_NEAREST || sampler->MinFilter != GL_NEAREST)) {
-      return GL_FALSE;
-   }
-
    if (_mesa_is_mipmap_filter(sampler))
       return texObj->_MipmapComplete;
    else




More information about the mesa-commit mailing list