Mesa (master): mesa: add new _mesa_Get[Compressed]TextureSubImage() functions
Brian Paul
brianp at kemper.freedesktop.org
Wed Jul 22 00:40:17 UTC 2015
Module: Mesa
Branch: master
Commit: 2494f91fb82eb545fd59ed4c9850ff378fc0c591
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2494f91fb82eb545fd59ed4c9850ff378fc0c591
Author: Brian Paul <brianp at vmware.com>
Date: Tue Jul 21 18:35:38 2015 -0600
mesa: add new _mesa_Get[Compressed]TextureSubImage() functions
Simple implementations in terms of get_[compressed_]texture_image().
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/mesa/main/texgetimage.c | 62 ++++++++++++++++++++++++++++++++++++++++++-
src/mesa/main/texgetimage.h | 15 +++++++++++
2 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 2831cd2..8539afc 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -893,7 +893,8 @@ legal_getteximage_target(struct gl_context *ctx, GLenum target, bool dsa)
/**
* Wrapper for _mesa_select_tex_image() which can handle target being
* GL_TEXTURE_CUBE_MAP_ARB in which case we use zoffset to select a cube face.
- * This can happen for glGetTextureImage (DSA function).
+ * This can happen for glGetTextureImage and glGetTextureSubImage (DSA
+ * functions).
*/
static struct gl_texture_image *
select_tex_image(const struct gl_texture_object *texObj, GLenum target,
@@ -1436,6 +1437,35 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type,
}
+void GLAPIENTRY
+_mesa_GetTextureSubImage(GLuint texture, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, GLsizei bufSize,
+ void *pixels)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ static const char *caller = "glGetTextureSubImage";
+ struct gl_texture_object *texObj =
+ _mesa_lookup_texture_err(ctx, texture, caller);
+
+ if (!texObj) {
+ return;
+ }
+
+ if (getteximage_error_check(ctx, texObj, texObj->Target, level,
+ xoffset, yoffset, zoffset, width, height, depth,
+ format, type, bufSize, pixels, caller)) {
+ return;
+ }
+
+ get_texture_image(ctx, texObj, texObj->Target, level,
+ xoffset, yoffset, zoffset, width, height, depth,
+ format, type, pixels, caller);
+}
+
+
+
/**
* Compute the number of bytes which will be written when retrieving
* a sub-region of a compressed texture.
@@ -1714,3 +1744,33 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint 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);
+}
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
index 040495a..63c75eb 100644
--- a/src/mesa/main/texgetimage.h
+++ b/src/mesa/main/texgetimage.h
@@ -71,6 +71,14 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format,
GLenum type, GLsizei bufSize, GLvoid *pixels);
extern void GLAPIENTRY
+_mesa_GetTextureSubImage(GLuint texture, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, GLsizei bufSize,
+ void *pixels);
+
+
+extern void GLAPIENTRY
_mesa_GetCompressedTexImage(GLenum target, GLint lod, GLvoid *img);
extern void GLAPIENTRY
@@ -81,4 +89,11 @@ extern void GLAPIENTRY
_mesa_GetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize,
GLvoid *pixels);
+extern void APIENTRY
+_mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLsizei bufSize, void *pixels);
+
#endif /* TEXGETIMAGE_H */
More information about the mesa-commit
mailing list