aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-17 16:03:35 -0700
committerJosé Fonseca <[email protected]>2012-02-22 11:56:20 +0000
commit0df14f9a55383641a9097900272a35ae1cfda4cb (patch)
tree333b904a46f6338418b1346e1927f6acc1f210b4 /src/mesa/main
parent3dd7b53178cb085a1ff3d87844fa51487f8892fc (diff)
mesa: add special case in texstore.c for GL_LUMINANCE_ALPHA src image
About a 10% improvement over the swizzle-copy path. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texstore.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 8c51a948ede..e8190c3922c 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1350,6 +1350,32 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == MESA_FORMAT_ARGB8888 &&
+ srcFormat == GL_LUMINANCE_ALPHA &&
+ baseInternalFormat == GL_RGBA &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* special case of storing LA -> ARGB8888 */
+ int img, row, col;
+ const GLint srcRowStride =
+ _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *srcRow = (const GLubyte *)
+ _mesa_image_address(dims, srcPacking, srcAddr, srcWidth,
+ srcHeight, srcFormat, srcType, img, 0, 0);
+ GLubyte *dstRow = dstSlices[img];
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *d4 = (GLuint *) dstRow;
+ for (col = 0; col < srcWidth; col++) {
+ GLubyte l = srcRow[col * 2 + 0], a = srcRow[col * 2 + 1];
+ d4[col] = PACK_COLOR_8888(a, l, l, l);
+ }
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ }
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
dstFormat == MESA_FORMAT_ARGB8888 &&
srcFormat == GL_RGBA &&
baseInternalFormat == GL_RGBA &&