From: res Date: Thu, 10 Jan 2008 09:05:03 +0000 (+0000) Subject: Fix runaway mipmap upload when NULL texture data was specified. X-Git-Tag: xonotic-v0.1.0preview~2560 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=b864489f3bef3a6722c4f4a8ed041fb033c2faaf;p=xonotic%2Fdarkplaces.git Fix runaway mipmap upload when NULL texture data was specified. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7946 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_textures.c b/gl_textures.c index f2fac414..b4649e05 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -874,6 +874,12 @@ static void R_Upload(gltexture_t *glt, const unsigned char *data, int fragx, int Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1); prevbuffer = resizebuffer; } + else + { + if (width > 1) width >>= 1; + if (height > 1) height >>= 1; + if (depth > 1) depth >>= 1; + } qglTexImage1D(GL_TEXTURE_1D, mip++, glt->glinternalformat, width, 0, glt->glformat, GL_UNSIGNED_BYTE, prevbuffer);CHECKGLERROR } } @@ -889,6 +895,12 @@ static void R_Upload(gltexture_t *glt, const unsigned char *data, int fragx, int Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1); prevbuffer = resizebuffer; } + else + { + if (width > 1) width >>= 1; + if (height > 1) height >>= 1; + if (depth > 1) depth >>= 1; + } qglTexImage2D(GL_TEXTURE_2D, mip++, glt->glinternalformat, width, height, 0, glt->glformat, GL_UNSIGNED_BYTE, prevbuffer);CHECKGLERROR } } @@ -904,6 +916,12 @@ static void R_Upload(gltexture_t *glt, const unsigned char *data, int fragx, int Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1); prevbuffer = resizebuffer; } + else + { + if (width > 1) width >>= 1; + if (height > 1) height >>= 1; + if (depth > 1) depth >>= 1; + } qglTexImage3D(GL_TEXTURE_3D, mip++, glt->glinternalformat, width, height, depth, 0, glt->glformat, GL_UNSIGNED_BYTE, prevbuffer);CHECKGLERROR } } @@ -941,6 +959,12 @@ static void R_Upload(gltexture_t *glt, const unsigned char *data, int fragx, int Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1); prevbuffer = resizebuffer; } + else + { + if (width > 1) width >>= 1; + if (height > 1) height >>= 1; + if (depth > 1) depth >>= 1; + } qglTexImage2D(cubemapside[i], mip++, glt->glinternalformat, width, height, 0, glt->glformat, GL_UNSIGNED_BYTE, prevbuffer);CHECKGLERROR } }