diff options
author | Brian Paul <[email protected]> | 2012-02-08 20:10:15 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-02-10 08:06:57 -0700 |
commit | 1a4f398a63f6b7b9258a0a63ba22fb0e95937c54 (patch) | |
tree | 9d7b55a8f933305431b00b092f14242a51ca4fc4 /src/mesa/main/texgetimage.c | |
parent | 07459ba50979a99e12720bd9e41a1aa3b8d24e41 (diff) |
mesa: use _mesa_format_matches_format_and_type() in get_tex_memcpy()
Diffstat (limited to 'src/mesa/main/texgetimage.c')
-rw-r--r-- | src/mesa/main/texgetimage.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index a69c4ff70e8..8bbea831c31 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -485,52 +485,17 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLboolean memCopy = GL_FALSE; /* - * Check if the src/dst formats are compatible. - * Also note that GL's pixel transfer ops don't apply to glGetTexImage() - * so we don't have to worry about those. - * XXX more format combinations could be supported here. + * 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 ((texImage->TexFormat == MESA_FORMAT_ARGB8888 || - texImage->TexFormat == MESA_FORMAT_SARGB8) && - format == GL_BGRA && - (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) && - !ctx->Pack.SwapBytes && - _mesa_little_endian()) { - memCopy = GL_TRUE; - } - else if ((texImage->TexFormat == MESA_FORMAT_AL88 || - texImage->TexFormat == MESA_FORMAT_SLA8) && - format == GL_LUMINANCE_ALPHA && - type == GL_UNSIGNED_BYTE && - !ctx->Pack.SwapBytes && - _mesa_little_endian()) { - memCopy = GL_TRUE; - } - else if ((texImage->TexFormat == MESA_FORMAT_L8 || - texImage->TexFormat == MESA_FORMAT_SL8) && - format == GL_LUMINANCE && - type == GL_UNSIGNED_BYTE) { - memCopy = GL_TRUE; - } - else if (texImage->TexFormat == MESA_FORMAT_L16 && - format == GL_LUMINANCE && - type == GL_UNSIGNED_SHORT) { - memCopy = GL_TRUE; - } - else if (texImage->TexFormat == MESA_FORMAT_A8 && - format == GL_ALPHA && - type == GL_UNSIGNED_BYTE) { - memCopy = GL_TRUE; - } - else if (texImage->TexFormat == MESA_FORMAT_A16 && - format == GL_ALPHA && - type == GL_UNSIGNED_SHORT) { - memCopy = GL_TRUE; - } + memCopy = _mesa_format_matches_format_and_type(texImage->TexFormat, + format, type, + ctx->Pack.SwapBytes); } if (memCopy) { |