diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-25 18:22:57 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2005-01-25 18:22:57 +0000 |
commit | c252b9acc0698e39b10842a57705222ffe55671f (patch) | |
tree | 52459aaf1e64732a2ced9c811d3a0829d9688950 | |
parent | 7a036eedba8c6ab2956f250860f5ce106d0bb767 (diff) |
Add a fast-path for storing GL_RGB/GL_UNSIGNED_BYTE little endian
textures in the _mesa_texformat_argb8888 format.
This is a pretty common case for the DRI drivers and seems to give a
good speedup.
-rw-r--r-- | src/mesa/main/texstore.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7356910132..4ca388dc96 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1007,6 +1007,40 @@ _mesa_texstore_argb8888(STORE_PARAMS) srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } + else if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == &_mesa_texformat_argb8888 && + baseInternalFormat == GL_RGB && + srcFormat == GL_RGB && + srcType == GL_UNSIGNED_BYTE && + littleEndian) { + /* optimized path: GL_RGB, GL_UNSIGNED_BYTE, little endian */ + + /* Avoids creating the tempoary image on this commonly used + * driver path. + */ + const GLubyte *src = srcAddr; + GLubyte *dstImage = (GLubyte *) dstAddr + + dstZoffset * dstImageStride + + dstYoffset * dstRowStride + + dstXoffset * dstFormat->TexelBytes; + GLint img, row, col; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = dstImage; + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + for (col = 0; col < srcWidth; col++) { + dstUI[col] = PACK_COLOR_8888( 0xff, + src[RCOMP], + src[GCOMP], + src[BCOMP] ); + src += 3; + } + dstRow += dstRowStride; + } + dstImage += dstImageStride; + } + } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, |