summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2013-02-06 22:33:55 +0100
committerIan Romanick <ian.d.romanick@intel.com>2013-02-17 14:10:28 -0800
commit2e4473d9e324550b6563ac20d6081028bf58cf82 (patch)
tree9a6742c047b97f5c281a8fb24422f8ce4cc77af8
parent11eb644cc98803b0d04184c62cad6ea1653a42fe (diff)
mesa: don't use memcpy fast path for GetTexImage if base format is different
The Mesa format can be RGBA8888_REV, the format/type can be GL_RGBA/GL_UNSIGNED_BYTE, but the actual texture internal format can be LUMINANCE_ALPHA, INTENSITY, etc. Therefore we should look at the base internal format as well. NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit c8379204ab0af97558871fffccdd74c60a41776a)
-rw-r--r--src/mesa/main/texgetimage.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 031e04d472c..d1c00e80039 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -502,16 +502,18 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
{
const GLenum target = texImage->TexObject->Target;
GLboolean memCopy = GL_FALSE;
+ GLenum texBaseFormat = _mesa_get_format_base_format(texImage->TexFormat);
/*
* Check if we can use memcpy to copy from the hardware texture
* format to the user's format/type.
* Note that GL's pixel transfer ops don't apply to glGetTexImage()
*/
- if (target == GL_TEXTURE_1D ||
- target == GL_TEXTURE_2D ||
- target == GL_TEXTURE_RECTANGLE ||
- _mesa_is_cube_face(target)) {
+ if ((target == GL_TEXTURE_1D ||
+ target == GL_TEXTURE_2D ||
+ target == GL_TEXTURE_RECTANGLE ||
+ _mesa_is_cube_face(target)) &&
+ texBaseFormat == texImage->_BaseFormat) {
memCopy = _mesa_format_matches_format_and_type(texImage->TexFormat,
format, type,
ctx->Pack.SwapBytes);