mesa: Implement TEXTURE_IMMUTABLE_LEVELS for ES 3.0.
authorMatt Turner <mattst88@gmail.com>
Mon, 4 Mar 2013 19:03:58 +0000 (11:03 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 21 Mar 2013 18:04:41 +0000 (11:04 -0700)
NOTE: This is a candidate for the 9.1 branch.
Fixes piglit's texture-immutable-levels test.
Reported-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/mtypes.h
src/mesa/main/texparam.c
src/mesa/main/texstorage.c

index 8c38aa79477fdd18961fc14ce2bcbd131e4e18ba..a0e7e281d84438bec6b13e0fe4bda19a90bbb435 100644 (file)
@@ -1179,6 +1179,7 @@ struct gl_texture_object
    GLfloat Priority;           /**< in [0,1] */
    GLint BaseLevel;            /**< min mipmap level, OpenGL 1.2 */
    GLint MaxLevel;             /**< max mipmap level, OpenGL 1.2 */
+   GLint ImmutableLevels;       /**< ES 3.0 / ARB_texture_view */
    GLint _MaxLevel;            /**< actual max mipmap level (q in the spec) */
    GLfloat _MaxLambda;         /**< = _MaxLevel - BaseLevel (q - b in spec) */
    GLint CropRect[4];           /**< GL_OES_draw_texture */
index 120845b4a8cf93775b5bcc1ef3894403e3528ded..bd2f751703aa9a263c84c1182cdfc9121cd426d2 100644 (file)
@@ -1460,6 +1460,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
          *params = (GLfloat) obj->Immutable;
          break;
 
+      case GL_TEXTURE_IMMUTABLE_LEVELS:
+         if (!_mesa_is_gles3(ctx))
+            goto invalid_pname;
+         *params = (GLfloat) obj->ImmutableLevels;
+         break;
+
       case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
          if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image_external)
             goto invalid_pname;
@@ -1637,6 +1643,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
          *params = (GLint) obj->Immutable;
          break;
 
+      case GL_TEXTURE_IMMUTABLE_LEVELS:
+         if (!_mesa_is_gles3(ctx))
+            goto invalid_pname;
+         *params = obj->ImmutableLevels;
+         break;
+
       case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
          if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image_external)
             goto invalid_pname;
index 00f19bae51cc7a6d76663ef475b985c736168e55..675fd745b7106233de5c2a45c0858124c581d6b6 100644 (file)
@@ -397,6 +397,7 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat,
       }
 
       texObj->Immutable = GL_TRUE;
+      texObj->ImmutableLevels = levels;
    }
 }