diff options
Diffstat (limited to 'mesalib/src/mesa/drivers/common')
-rw-r--r-- | mesalib/src/mesa/drivers/common/driverfuncs.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 31 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.h | 3 |
3 files changed, 26 insertions, 10 deletions
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index 3e2896980..33da9346c 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -200,8 +200,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) _mesa_init_sampler_object_functions(driver); /* T&L stuff */ - driver->NeedValidate = GL_FALSE; - driver->ValidateTnlModule = NULL; driver->CurrentExecPrimitive = 0; driver->CurrentSavePrimitive = 0; driver->NeedFlush = 0; diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index b6e80d70a..4d645e200 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -49,6 +49,7 @@ #include "main/macros.h" #include "main/matrix.h" #include "main/mipmap.h" +#include "main/pixel.h" #include "main/pbo.h" #include "main/polygon.h" #include "main/readpix.h" @@ -3235,8 +3236,27 @@ decompress_texture_image(struct gl_context *ctx, } /* read pixels from renderbuffer */ - ctx->Pack.RowLength = destRowLength; - _mesa_ReadPixels(0, 0, width, height, destFormat, destType, dest); + { + GLenum baseTexFormat = texImage->_BaseFormat; + + /* The pixel transfer state will be set to default values at this point + * (see MESA_META_PIXEL_TRANSFER) so pixel transfer ops are effectively + * turned off (as required by glGetTexImage) but we need to handle some + * special cases. In particular, single-channel texture values are + * returned as red and two-channel texture values are returned as + * red/alpha. + */ + if (baseTexFormat == GL_LUMINANCE || + baseTexFormat == GL_LUMINANCE_ALPHA || + baseTexFormat == GL_INTENSITY) { + /* Green and blue must be zero */ + _mesa_PixelTransferf(GL_GREEN_SCALE, 0.0f); + _mesa_PixelTransferf(GL_BLUE_SCALE, 0.0f); + } + + ctx->Pack.RowLength = destRowLength; + _mesa_ReadPixels(0, 0, width, height, destFormat, destType, dest); + } /* disable texture unit */ _mesa_set_enable(ctx, target, GL_FALSE); @@ -3260,9 +3280,8 @@ decompress_texture_image(struct gl_context *ctx, * 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 @@ -3272,6 +3291,7 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, GLenum target, GLint level, 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); @@ -3281,7 +3301,6 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, GLenum target, GLint level, _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); } } diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index 3c917924a..7ec568388 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -124,9 +124,8 @@ _mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, 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); |