[Mesa-dev] [PATCH 10/13] mesa: add new _mesa_Get[Compressed]TextureSubImage() functions
Brian Paul
brianp at vmware.com
Mon Jul 13 18:21:10 PDT 2015
Simple implementations in terms of get_[compressed_]texture_image().
---
src/mesa/main/texgetimage.c | 38 ++++++++++++++++++++++++++++++++++++++
src/mesa/main/texgetimage.h | 15 +++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index bcdcfe8..07da5f4 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1367,6 +1367,22 @@ _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);
+ struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture);
+
+ get_texture_image(ctx, texObj, 0, level,
+ xoffset, yoffset, zoffset, width, height, depth,
+ format, type, bufSize, pixels, "glGetTextureSubImage");
+}
+
+
/**
* Do error checking for getting compressed texture images.
@@ -1423,6 +1439,10 @@ getcompressedteximage_error_check(struct gl_context *ctx,
}
+/**
+ * Compute the number of bytes which will be written when retrieving
+ * a sub-region of a compressed texture.
+ */
static GLsizei
packed_compressed_size(GLuint dimensions, mesa_format format,
GLsizei width, GLsizei height, GLsizei depth,
@@ -1637,3 +1657,21 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint level,
bufSize, pixels,
"glGetCompressedTextureImage");
}
+
+
+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);
+ struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture);
+
+ get_compressed_texture_image(ctx, texObj, 0, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ bufSize, pixels,
+ "glGetCompressedTextureImage");
+}
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 */
--
1.9.1
More information about the mesa-dev
mailing list