+ GET_CURRENT_CONTEXT(ctx);
+ static const char *caller = "glGetCompressedTexImage";
+ GLsizei width, height, depth;
+ struct gl_texture_object *texObj;
+
+ if (!legal_getteximage_target(ctx, target, false)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
+ return;
+ }
+
+ texObj = _mesa_get_current_tex_object(ctx, target);
+ assert(texObj);
+
+ get_texture_image_dims(texObj, target, level,
+ &width, &height, &depth);
+
+ if (getcompressedteximage_error_check(ctx, texObj, target, level,
+ 0, 0, 0, width, height, depth,
+ INT_MAX, pixels, caller)) {
+ return;
+ }
+
+ get_compressed_texture_image(ctx, texObj, target, level,
+ 0, 0, 0, width, height, depth,
+ pixels, caller);
+}
+
+
+void GLAPIENTRY
+_mesa_GetCompressedTextureImage(GLuint texture, GLint level,
+ GLsizei bufSize, GLvoid *pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ static const char *caller = "glGetCompressedTextureImage";
+ GLsizei width, height, depth;
+ struct gl_texture_object *texObj =
+ _mesa_lookup_texture_err(ctx, texture, caller);
+
+ if (!texObj) {
+ return;
+ }
+
+ get_texture_image_dims(texObj, texObj->Target, level,
+ &width, &height, &depth);
+
+ if (getcompressedteximage_error_check(ctx, texObj, texObj->Target, level,
+ 0, 0, 0, width, height, depth,
+ bufSize, pixels, caller)) {
+ return;
+ }
+
+ get_compressed_texture_image(ctx, texObj, texObj->Target, level,
+ 0, 0, 0, width, height, depth,
+ pixels, caller);
+}
+
+
+void APIENTRY
+_mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLsizei bufSize, void *pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ static const char *caller = "glGetCompressedTextureImage";
+ struct gl_texture_object *texObj;
+
+ texObj = _mesa_lookup_texture_err(ctx, texture, caller);
+ if (!texObj) {
+ return;
+ }
+
+ if (getcompressedteximage_error_check(ctx, texObj, texObj->Target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ bufSize, pixels, caller)) {
+ return;
+ }
+
+ get_compressed_texture_image(ctx, texObj, texObj->Target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ pixels, caller);