* from core Mesa.
*/
void
-_mesa_meta_GetTexImage(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_GetTexImage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
/* We can only use the decompress-with-blit method here if the texels are
if (_mesa_is_format_compressed(texImage->TexFormat) &&
_mesa_get_format_datatype(texImage->TexFormat)
== GL_UNSIGNED_NORMALIZED) {
+ struct gl_texture_object *texObj = texImage->TexObject;
const GLuint slice = 0; /* only 2D compressed textures for now */
/* Need to unlock the texture here to prevent deadlock... */
_mesa_unlock_texture(ctx, texObj);
_mesa_lock_texture(ctx, texObj);
}
else {
- _mesa_get_teximage(ctx, target, level, format, type, pixels,
- texObj, texImage);
+ _mesa_get_teximage(ctx, format, type, pixels, texImage);
}
}
GLsizei width, GLsizei height);
extern void
-_mesa_meta_GetTexImage(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_meta_GetTexImage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
/**
* Called by glGetTexImage().
*/
- void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level,
+ void (*GetTexImage)( struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
/**
store = ctx->Pack; /* save */
ctx->Pack = ctx->DefaultPacking;
- ctx->Driver.GetTexImage(ctx, texObj->Target, level,
- GL_RGBA, GL_UNSIGNED_BYTE,
- buffer, texObj, img);
+ ctx->Driver.GetTexImage(ctx, GL_RGBA, GL_UNSIGNED_BYTE, buffer, img);
/* make filename */
_mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face);
ctx->Pack = ctx->DefaultPacking;
/* Get the uncompressed image */
- ctx->Driver.GetTexImage(ctx, target, texObj->BaseLevel,
+ assert(srcImage->Level == texObj->BaseLevel);
+ ctx->Driver.GetTexImage(ctx,
temp_base_format, temp_datatype,
- temp_src, texObj, srcImage);
+ temp_src, srcImage);
/* restore packing mode */
ctx->Pack = save;
}
static GLboolean
get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
+ const GLenum target = texImage->TexObject->Target;
GLboolean memCopy = GL_FALSE;
/*
* so we don't have to worry about those.
* XXX more format combinations could be supported here.
*/
- if ((texObj->Target == GL_TEXTURE_1D ||
- texObj->Target == GL_TEXTURE_2D ||
- texObj->Target == GL_TEXTURE_RECTANGLE ||
- (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
- texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
+ if ((target == GL_TEXTURE_1D ||
+ target == GL_TEXTURE_2D ||
+ target == GL_TEXTURE_RECTANGLE ||
+ (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) {
if ((texImage->TexFormat == MESA_FORMAT_ARGB8888 ||
texImage->TexFormat == MESA_FORMAT_SARGB8) &&
format == GL_BGRA &&
* unmap with ctx->Driver.UnmapTextureImage().
*/
void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_get_teximage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
GLuint dimensions;
- switch (target) {
+ switch (texImage->TexObject->Target) {
case GL_TEXTURE_1D:
dimensions = 1;
break;
pixels = ADD_POINTERS(buf, pixels);
}
- if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) {
+ if (get_tex_memcpy(ctx, format, type, pixels, texImage)) {
/* all done */
}
else if (format == GL_DEPTH_COMPONENT) {
_mesa_lock_texture(ctx, texObj);
{
- ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels,
- texObj, texImage);
+ ctx->Driver.GetTexImage(ctx, format, type, pixels, texImage);
}
_mesa_unlock_texture(ctx, texObj);
}
struct gl_texture_object;
extern void
-_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
+_mesa_get_teximage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
* a textured quad. Store the results in the user's buffer.
*/
static void
-decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level,
+decompress_with_blit(struct gl_context * ctx,
GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct st_texture_image *stImage = st_texture_image(texImage);
- struct st_texture_object *stObj = st_texture_object(texObj);
+ struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
struct pipe_sampler_view *src_view =
st_get_texture_sampler_view(stObj, pipe);
const GLuint width = texImage->Width;
}
/* Choose the source mipmap level */
- src_view->u.tex.first_level = src_view->u.tex.last_level = level;
+ src_view->u.tex.first_level = src_view->u.tex.last_level = texImage->Level;
/* blit/render/decompress */
util_blit_pixels_tex(st->blit,
* Called via ctx->Driver.GetTexImage()
*/
static void
-st_GetTexImage(struct gl_context * ctx, GLenum target, GLint level,
+st_GetTexImage(struct gl_context * ctx,
GLenum format, GLenum type, GLvoid * pixels,
- struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
struct st_texture_image *stImage = st_texture_image(texImage);
* faster than using the fallback code in texcompress.c.
* Note that we only expect RGBA formats (no Z/depth formats).
*/
- decompress_with_blit(ctx, target, level, format, type, pixels,
- texObj, texImage);
+ decompress_with_blit(ctx, format, type, pixels, texImage);
}
else {
- _mesa_get_teximage(ctx, target, level, format, type, pixels,
- texObj, texImage);
+ _mesa_get_teximage(ctx, format, type, pixels, texImage);
}
}