diff options
author | Brian Paul <[email protected]> | 2002-09-23 16:37:13 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-09-23 16:37:13 +0000 |
commit | 681b8c9d1ba06c8c82e687a5ced369b72e6b1eb9 (patch) | |
tree | bfe222c6384be8ef34eadddb44262c9bd9ddc1c2 | |
parent | b7808884bb26b6abdd44a03ff47885fb646686a5 (diff) |
merge gl_texture_image RowStride from DRI 4.0.4
-rw-r--r-- | src/mesa/main/mtypes.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texformat.h | 6 | ||||
-rw-r--r-- | src/mesa/main/texformat_tmp.h | 18 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 8 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 3 |
6 files changed, 28 insertions, 20 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 3b94967e08e..d3c6c6196d3 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.87 2002/09/21 17:34:56 brianp Exp $ */ +/* $Id: mtypes.h,v 1.88 2002/09/23 16:37:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -839,6 +839,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.h b/src/mesa/main/texformat.h index 802f4acefb5..d1e7544a420 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -1,4 +1,4 @@ -/* $Id: texformat.h,v 1.10 2002/09/21 16:51:25 brianp Exp $ */ +/* $Id: texformat.h,v 1.11 2002/09/23 16:37:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -144,8 +144,8 @@ extern const struct gl_texture_format _mesa_texformat_a8; extern const struct gl_texture_format _mesa_texformat_l8; extern const struct gl_texture_format _mesa_texformat_i8; extern const struct gl_texture_format _mesa_texformat_ci8; -extern const struct gl_texture_format _meas_texformat_ycbcr; -extern const struct gl_texture_format _meas_texformat_ycbcr_rev; +extern const struct gl_texture_format _mesa_texformat_ycbcr; +extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; /* The null format: */ diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 35f89d54936..f796928673f 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.7 2002/09/21 16:51:25 brianp Exp $ */ +/* $Id: texformat_tmp.h,v 1.8 2002/09/23 16:37:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -43,13 +43,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 @@ -57,16 +57,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 e62081be5bd..769f74eda74 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.115 2002/09/21 16:51:25 brianp Exp $ */ +/* $Id: teximage.c,v 1.116 2002/09/23 16:37:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -99,7 +99,7 @@ static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) _mesa_printf(ctx, "%02x%02x%02x ", data[0], data[1], data[2]); else if (c==4) _mesa_printf(ctx, "%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); - data += c; + data += (img->RowStride - img->Width) * c; } _mesa_printf(ctx, "\n"); } @@ -611,6 +611,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; @@ -642,6 +643,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->Width = width; img->Height = height; img->Depth = depth; + img->RowStride = width; img->WidthLog2 = logbase2(width - 2 * border); if (height == 1) /* 1-D texture */ img->HeightLog2 = 0; @@ -1413,7 +1415,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, } else if (format == GL_YCBCR_MESA) { /* No pixel transfer */ - MEMCPY(dest, (const GLushort *) texImage->Data + row * width, + const GLint rowstride = texImage->RowStride; + 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 fd2bf95b178..b8428c9a66a 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.66 2002/09/21 16:51:26 brianp Exp $ */ +/* $Id: s_texture.c,v 1.67 2002/09/23 16:37:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1119,7 +1119,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 @@ -1158,6 +1159,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 @@ -1205,7 +1207,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit, const GLboolean repeatNoBorder = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) - && (tImg->Border == 0) + && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) && (tImg->Format != GL_COLOR_INDEX); ASSERT(lambda != NULL); diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 4e2c40625b4..a26f7319c5d 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.61 2002/08/07 00:45:07 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.62 2002/09/23 16:37:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1136,6 +1136,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 |