mesa: ARB_texture_view get parameters
authorCourtney Goeltzenleuchter <courtney@LunarG.com>
Mon, 4 Nov 2013 20:29:48 +0000 (13:29 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 13 Dec 2013 19:31:54 +0000 (12:31 -0700)
Add support for ARB_texture_view get parameters:
GL_TEXTURE_VIEW_MIN_LEVEL
GL_TEXTURE_VIEW_NUM_LEVELS
GL_TEXTURE_VIEW_MIN_LAYER
GL_TEXTURE_VIEW_NUM_LAYERS

Incorporate feedback regarding when to allow query of
GL_TEXTURE_IMMUTABLE_LEVELS.

Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/texparam.c

index 1cd4e7e0015c7fa7a69e184209036a7eb84d73bf..60499aa94ec1828f3bb0fc76696a9819d694a856 100644 (file)
@@ -1558,9 +1558,35 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
          break;
 
       case GL_TEXTURE_IMMUTABLE_LEVELS:
-         if (!_mesa_is_gles3(ctx))
+         if (_mesa_is_gles3(ctx) ||
+             (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+            *params = (GLfloat) obj->ImmutableLevels;
+         else
+            goto invalid_pname;
+         break;
+
+      case GL_TEXTURE_VIEW_MIN_LEVEL:
+         if (!ctx->Extensions.ARB_texture_view)
+            goto invalid_pname;
+         *params = (GLfloat) obj->MinLevel;
+         break;
+
+      case GL_TEXTURE_VIEW_NUM_LEVELS:
+         if (!ctx->Extensions.ARB_texture_view)
+            goto invalid_pname;
+         *params = (GLfloat) obj->NumLevels;
+         break;
+
+      case GL_TEXTURE_VIEW_MIN_LAYER:
+         if (!ctx->Extensions.ARB_texture_view)
+            goto invalid_pname;
+         *params = (GLfloat) obj->MinLayer;
+         break;
+
+      case GL_TEXTURE_VIEW_NUM_LAYERS:
+         if (!ctx->Extensions.ARB_texture_view)
             goto invalid_pname;
-         *params = (GLfloat) obj->ImmutableLevels;
+         *params = (GLfloat) obj->NumLayers;
          break;
 
       case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
@@ -1742,9 +1768,35 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
          break;
 
       case GL_TEXTURE_IMMUTABLE_LEVELS:
-         if (!_mesa_is_gles3(ctx))
+         if (_mesa_is_gles3(ctx) ||
+             (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+            *params = obj->ImmutableLevels;
+         else
+            goto invalid_pname;
+         break;
+
+      case GL_TEXTURE_VIEW_MIN_LEVEL:
+         if (!ctx->Extensions.ARB_texture_view)
+            goto invalid_pname;
+         *params = (GLint) obj->MinLevel;
+         break;
+
+      case GL_TEXTURE_VIEW_NUM_LEVELS:
+         if (!ctx->Extensions.ARB_texture_view)
+            goto invalid_pname;
+         *params = (GLint) obj->NumLevels;
+         break;
+
+      case GL_TEXTURE_VIEW_MIN_LAYER:
+         if (!ctx->Extensions.ARB_texture_view)
+            goto invalid_pname;
+         *params = (GLint) obj->MinLayer;
+         break;
+
+      case GL_TEXTURE_VIEW_NUM_LAYERS:
+         if (!ctx->Extensions.ARB_texture_view)
             goto invalid_pname;
-         *params = obj->ImmutableLevels;
+         *params = (GLint) obj->NumLayers;
          break;
 
       case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES: