diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-09-23 16:39:43 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-09-23 16:39:43 +0000 |
commit | 53170a3af05725d5154da8abc3ca57570cc5018c (patch) | |
tree | 05495e897d813873006fd5e9dded906a48afef9b | |
parent | 57181b2c0a08ffb9cc6d4190bdd802ad88cc3a83 (diff) |
gl_texture_image RowStride changes from DRI R200 branch
-rw-r--r-- | src/mesa/main/mtypes.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texformat_tmp.h | 18 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 8 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 3 |
5 files changed, 26 insertions, 16 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5084ad6f37..c03d91ba73 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.51.2.12 2002/09/21 17:12:34 brianp Exp $ */ +/* $Id: mtypes.h,v 1.51.2.13 2002/09/23 16:39:43 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -801,6 +801,7 @@ struct gl_texture_image { GLuint Width; /* = 2^WidthLog2 + 2*Border */ GLuint Height; /* = 2^HeightLog2 + 2*Border */ GLuint Depth; /* = 2^DepthLog2 + 2*Border */ + GLuint RowStride; /* == Width unless IsClientData and padded */ GLuint Width2; /* = Width - 2*Border */ GLuint Height2; /* = Height - 2*Border */ GLuint Depth2; /* = Depth - 2*Border */ diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 38e5deec7b..bb994ec2d8 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1,4 +1,4 @@ -/* $Id: texformat_tmp.h,v 1.3.2.3 2002/09/13 23:18:22 brianp Exp $ */ +/* $Id: texformat_tmp.h,v 1.3.2.4 2002/09/23 16:39:44 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -44,13 +44,13 @@ #elif DIM == 2 #define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) + ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) #define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) + ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) #define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + ((t)->Width * (j) + (i))) + ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i))) #define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i))) + ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i))) #define FETCH(x) fetch_2d_texel_##x @@ -58,16 +58,16 @@ #define CHAN_SRC( t, i, j, k, sz ) \ (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz) + (t)->RowStride + (i)) * (sz) #define UBYTE_SRC( t, i, j, k, sz ) \ ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz)) + (t)->RowStride + (i)) * (sz)) #define USHORT_SRC( t, i, j, k ) \ ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) + (t)->RowStride + (i))) #define FLOAT_SRC( t, i, j, k ) \ ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) + (t)->RowStride + (i))) #define FETCH(x) fetch_3d_texel_##x diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8ec070478f..c61a282be8 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.104.2.11 2002/09/20 19:40:54 brianp Exp $ */ +/* $Id: teximage.c,v 1.104.2.12 2002/09/23 16:39:44 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -102,6 +102,7 @@ static void PrintTexture(const struct gl_texture_image *img) printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); data += c; } + data += (img->RowStride - img->Width) * c; printf("\n"); } #endif @@ -612,6 +613,7 @@ clear_teximage_fields(struct gl_texture_image *img) img->Width = 0; img->Height = 0; img->Depth = 0; + img->RowStride = 0; img->Width2 = 0; img->Height2 = 0; img->Depth2 = 0; @@ -643,6 +645,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->Width = width; img->Height = height; img->Depth = depth; + img->RowStride = img->Width; img->WidthLog2 = logbase2(width - 2 * border); if (height == 1) /* 1-D texture */ img->HeightLog2 = 0; @@ -1432,8 +1435,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, depthRow, &ctx->Pack); } else if (format == GL_YCBCR_MESA) { + const GLint rowstride = texImage->RowStride; /* No pixel transfer */ - MEMCPY(dest, (const GLushort *) texImage->Data + row * width, + MEMCPY(dest, (const GLushort *) texImage->Data + row * rowstride, width * sizeof(GLushort)); /* check for byte swapping */ if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 6d6121895a..3a1f3d365e 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.41.2.8 2002/09/13 19:34:43 brianp Exp $ */ +/* $Id: s_texture.c,v 1.41.2.9 2002/09/23 16:39:45 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -883,7 +883,8 @@ sample_linear_2d( GLcontext *ctx, GLuint texUnit, * Optimized 2-D texture sampling: * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter - * No border + * No border, + * RowStride == Width, * Format = GL_RGB */ static void @@ -924,6 +925,7 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter * No border + * RowStride == Width, * Format = GL_RGBA */ static void @@ -980,7 +982,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit, switch (tObj->MagFilter) { case GL_NEAREST: if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT && - img->Border == 0) { + img->Border == 0 && img->Width == img->RowStride) { switch (img->Format) { case GL_RGB: opt_sample_rgb_2d(ctx, texUnit, tObj, n, s, t, NULL, @@ -2039,12 +2041,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->Image[baseLevel]->Border == 0 && + t->Image[baseLevel]->Width == t->Image[baseLevel]->RowStride && t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { swrast->TextureSample[texUnit] = opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->Image[baseLevel]->Border == 0 && + t->Image[baseLevel]->Width == t->Image[baseLevel]->RowStride && t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { swrast->TextureSample[texUnit] = opt_sample_rgba_2d; } diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index efc69b7e44..e2fd8da49c 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.39.2.5 2002/01/30 16:45:29 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.39.2.6 2002/09/23 16:39:45 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1696,6 +1696,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && texObj2D->WrapS==GL_REPEAT && texObj2D->WrapT==GL_REPEAT && texImg->Border==0 + && texImg->Width==texImg->RowStride && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR |