On 11/11/2011 11:57 AM, Eric Anholt wrote:
Fixes a failure in piglit gl-3.0-required-sized-formats
---
  src/mesa/main/texparam.c |   18 +++++++++++++++++-
  1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index e9bed23..fad864d 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1116,13 +1116,29 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint 
level,
        case GL_TEXTURE_ALPHA_TYPE_ARB:
        case GL_TEXTURE_LUMINANCE_TYPE_ARB:
        case GL_TEXTURE_INTENSITY_TYPE_ARB:
-      case GL_TEXTURE_DEPTH_TYPE_ARB:
           if (!ctx->Extensions.ARB_texture_float)
              goto invalid_pname;
         if (texture_base_type_allows_channel(img, pname))
            *params = _mesa_get_format_datatype(texFormat);
         else
            *params = GL_NONE;
+        break;
+
+      case GL_TEXTURE_DEPTH_TYPE_ARB:
+         if (!ctx->Extensions.ARB_texture_float)
+            goto invalid_pname;
+        if (texture_base_type_allows_channel(img, pname)) {
+           /* Mesa's gl_format has a datatype of GL_UNSIGNED_INT for Z16/Z24,
+            * but the only types of depth components in table 3.18 of the GL
+            * 3.0 specification are f32 or unsigned normalized.
+            */
+           if (_mesa_get_format_datatype(texFormat) == GL_FLOAT)
+              *params = GL_FLOAT;
+           else
+              *params = GL_UNSIGNED_NORMALIZED;
+        } else {
+           *params = GL_NONE;
+        }
           break;

        default:

Maybe we should change the format query to return GL_UNSIGNED_NORMALIZED for the Z16/Z24/etc formats. It would seem to make more sense. There might only be a handful of calls where we might need to compensate for the new value.

-Brian
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to