diff options
author | Brian Paul <[email protected]> | 2012-01-26 20:01:12 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-01-27 18:21:45 -0700 |
commit | b27792335e284bcddcbcfa807e5152feff330f58 (patch) | |
tree | 116db2a337312b0e08792d3f8acdb771c44b69fe /src/mesa/main/texstore.c | |
parent | 94a0d38c240625202d21a7c4522ad8a1c9bc1a89 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r-- | src/mesa/main/texstore.c | 48 |
1 files changed, 4 insertions, 44 deletions
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, |