diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2007-01-16 11:22:57 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2007-01-16 11:22:57 +0000 |
commit | 6a3fdc3a1ea6c306d9543791bf172dd1052d7382 (patch) | |
tree | c372c6daff13e435e79914c2e40dfe9d370c337b /src/glu/sgi/libutil/mipmap.c | |
parent | 0b412f8f156b46b0e7220a2b61e0f41781769f66 (diff) | |
parent | a03fc8277180e2171519165a724849e2254ef0b7 (diff) |
Merge branch 'master' of git+ssh://keithw@git.freedesktop.org/git/mesa/mesa into vbo-0.2
Conflicts:
src/mesa/array_cache/sources
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/brw_fallback.c
src/mesa/drivers/dri/i965/brw_vs_emit.c
src/mesa/drivers/dri/i965/brw_vs_tnl.c
src/mesa/drivers/dri/mach64/mach64_context.c
src/mesa/main/extensions.c
src/mesa/main/getstring.c
src/mesa/tnl/sources
src/mesa/tnl/t_save_api.c
src/mesa/tnl/t_save_playback.c
src/mesa/tnl/t_vtx_api.c
src/mesa/tnl/t_vtx_exec.c
src/mesa/vbo/vbo_attrib.h
src/mesa/vbo/vbo_exec_api.c
src/mesa/vbo/vbo_save_api.c
src/mesa/vbo/vbo_save_draw.c
Diffstat (limited to 'src/glu/sgi/libutil/mipmap.c')
-rw-r--r-- | src/glu/sgi/libutil/mipmap.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 5c28c858ec6..44f519a4e21 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -377,6 +377,7 @@ static void halveImage_ubyte(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLubyte *s; const char *t; @@ -390,6 +391,7 @@ static void halveImage_ubyte(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -405,6 +407,7 @@ static void halveImage_ubyte(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -476,6 +479,7 @@ static void halveImage_byte(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLbyte *s; const char *t; @@ -489,6 +493,7 @@ static void halveImage_byte(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -504,6 +509,7 @@ static void halveImage_byte(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -573,6 +579,7 @@ static void halveImage_ushort(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLushort *s; const char *t; @@ -586,6 +593,7 @@ static void halveImage_ushort(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -602,6 +610,7 @@ static void halveImage_ushort(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } else @@ -616,6 +625,7 @@ static void halveImage_ushort(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -708,6 +718,7 @@ static void halveImage_short(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLshort *s; const char *t; @@ -721,6 +732,7 @@ static void halveImage_short(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -737,6 +749,7 @@ static void halveImage_short(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } else @@ -758,6 +771,7 @@ static void halveImage_short(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -850,6 +864,7 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLuint *s; const char *t; @@ -863,6 +878,7 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -881,6 +897,7 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } else @@ -899,6 +916,7 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -990,6 +1008,7 @@ static void halveImage_int(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLint *s; const char *t; @@ -1003,6 +1022,7 @@ static void halveImage_int(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -1019,6 +1039,7 @@ static void halveImage_int(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } else @@ -1041,6 +1062,7 @@ static void halveImage_int(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -1134,6 +1156,7 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, { int i, j, k; int newwidth, newheight; + int padBytes; GLfloat *s; const char *t; @@ -1147,6 +1170,7 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, newwidth = width / 2; newheight = height / 2; + padBytes = ysize - (width*group_size); s = dataout; t = (const char *)datain; @@ -1163,6 +1187,7 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } else @@ -1183,6 +1208,7 @@ static void halveImage_float(GLint components, GLuint width, GLuint height, } t += group_size; } + t += padBytes; t += ysize; } } @@ -3845,10 +3871,12 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, if (width == newwidth && height == newheight) { /* Use usersImage for level userLevel */ if (baseLevel <= level && level <= maxLevel) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glTexImage2D(target, level, internalFormat, width, height, 0, format, type, usersImage); } + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); if(levels == 0) { /* we're done. clean up and return */ glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); @@ -8643,7 +8671,8 @@ static void halveImageSlice(int components, int halfHeight= height / 2; int halfDepth= depth / 2; const char *src= (const char *)dataIn; - int padBytes= rowSizeInBytes - (width * groupSizeInBytes); + int rowPadBytes= rowSizeInBytes - (width * groupSizeInBytes); + int imagePadBytes= imageSizeInBytes - (width*height*groupSizeInBytes); int outIndex= 0; assert((width == 1 || height == 1) && depth >= 2); @@ -8727,7 +8756,7 @@ static void halveImageSlice(int components, /* skip over to next horizontal square of 4 */ src+= groupSizeInBytes; } /* for jj */ - src+= padBytes; + src+= rowPadBytes; src+= rowSizeInBytes; } /* for ii */ @@ -8772,11 +8801,12 @@ static void halveImageSlice(int components, src+= elementSizeInBytes; } /* for cc */ - src+= padBytes; + src+= rowPadBytes; /* skip over to next vertical square of 4 */ src+= rowSizeInBytes; } /* for jj */ + src+= imagePadBytes; src+= imageSizeInBytes; } /* for ii */ @@ -8816,7 +8846,8 @@ static void halveImage3D(int components, int halfHeight= height / 2; int halfDepth= depth / 2; const char *src= (const char *) dataIn; - int padBytes= rowSizeInBytes - (width*groupSizeInBytes); + int rowPadBytes= rowSizeInBytes - (width*groupSizeInBytes); + int imagePadBytes= imageSizeInBytes - (width*height*groupSizeInBytes); int outIndex= 0; for (dd= 0; dd < halfDepth; dd++) { @@ -8872,7 +8903,7 @@ static void halveImage3D(int components, src+= groupSizeInBytes; } /* for jj */ /* skip past pad bytes, if any, to get to next row */ - src+= padBytes; + src+= rowPadBytes; /* src is at beginning of a row here, but it's the second row of * the square block of 4 pixels that we just worked on so we @@ -8887,6 +8918,9 @@ static void halveImage3D(int components, src+= rowSizeInBytes; } /* for ii */ + /* skip past pad bytes, if any, to get to next image */ + src+= imagePadBytes; + src+= imageSizeInBytes; } /* for dd */ |