From 64a79b2f3ad964fa61c46bf3239634736e508a44 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 Oct 1999 10:43:35 +0000 Subject: [PATCH] applied Jonn Carmack's patch for faster glTexSubImage2D() in Quake --- src/mesa/main/teximage.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index a5d3ef97a57..0f6bde4bb01 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.7 1999/10/21 12:45:03 brianp Exp $ */ +/* $Id: teximage.c,v 1.8 1999/10/22 10:43:35 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1674,7 +1674,7 @@ void gl_TexSubImage2D( GLcontext *ctx, /* row by row. */ GLubyte *dst = destTex->Data + (yoffsetb * destTex->Width + xoffsetb) * texcomponents; - GLubyte *src = (GLubyte *) image->Data; + const GLubyte *src = (const GLubyte *) image->Data; GLint j; for (j=0;jType==GL_UNSIGNED_BYTE + && texcomponents==3 && image->Components == 4 ) { + /* 32 bit (padded) to 24 bit case, used heavily by quake */ + GLubyte *dst = destTex->Data + + (yoffsetb * destTex->Width + xoffsetb) * texcomponents; + const GLubyte *src = (const GLubyte *) image->Data; + GLint j; + for (j=0;jWidth - width) * texcomponents * sizeof(GLubyte); + } + } else { /* General case, convert image pixels into texels, scale, bias, etc */ struct gl_texture_image *subTexImg = image_to_texture(ctx, image, destTex->IntFormat, destTex->Border); GLubyte *dst = destTex->Data + (yoffsetb * destTex->Width + xoffsetb) * texcomponents; - GLubyte *src = subTexImg->Data; + const GLubyte *src = subTexImg->Data; GLint j; for (j=0;j