From: Brian Paul Date: Fri, 27 Jan 2012 03:01:12 +0000 (-0700) Subject: mesa: use _mesa_format_matches_format_and_type() in texstore code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b27792335e284bcddcbcfa807e5152feff330f58;p=mesa.git mesa: use _mesa_format_matches_format_and_type() in texstore code This simplifies the code quite a bit, consolidates some cases and possibly catches more cases for the memcpy path. More such changes will follow. Do just a few at a time to help bisect any possible regressions. Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f5cd1000446..3db04c42abc 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1243,30 +1243,9 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_RGBA8888 || - dstFormat == MESA_FORMAT_RGBX8888) && - baseInternalFormat == GL_RGBA && - ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) || - (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) || - (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || - (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian))) { - /* simple memcpy path */ - memcpy_texture(ctx, dims, - dstFormat, - dstRowStride, dstSlices, - srcWidth, srcHeight, srcDepth, srcFormat, srcType, - srcAddr, srcPacking); - } - else if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_RGBA8888_REV || - dstFormat == MESA_FORMAT_RGBX8888_REV) && baseInternalFormat == GL_RGBA && - ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || - (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) || - (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8) || - (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian))) { + _mesa_format_matches_format_and_type(dstFormat, srcFormat, srcType, + srcPacking->SwapBytes)) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, @@ -1367,28 +1346,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_ARGB8888 || - dstFormat == MESA_FORMAT_XRGB8888) && baseInternalFormat == GL_RGBA && - srcFormat == GL_BGRA && - ((srcType == GL_UNSIGNED_BYTE && littleEndian) || - srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) { - /* simple memcpy path (little endian) */ - memcpy_texture(ctx, dims, - dstFormat, - dstRowStride, dstSlices, - srcWidth, srcHeight, srcDepth, srcFormat, srcType, - srcAddr, srcPacking); - } - else if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_ARGB8888_REV || - dstFormat == MESA_FORMAT_XRGB8888_REV) && - baseInternalFormat == GL_RGBA && - srcFormat == GL_BGRA && - ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || - srcType == GL_UNSIGNED_INT_8_8_8_8)) { + _mesa_format_matches_format_and_type(dstFormat, srcFormat, srcType, + srcPacking->SwapBytes)) { /* simple memcpy path (big endian) */ memcpy_texture(ctx, dims, dstFormat,