diff options
author | marha <marha@users.sourceforge.net> | 2011-09-26 17:08:48 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-26 17:08:48 +0200 |
commit | 95acf9816e008fa46a6c2fa2f35500deb358bb69 (patch) | |
tree | ad86feed38d780515cf9da608c5ea21eed04e17d /mesalib/src/mesa/swrast/s_texture.c | |
parent | 4f67039e9191d5251c39069bd791a05c5cf22022 (diff) | |
parent | 873965b49f283ad028dd4e0e5b7e93a758c84993 (diff) | |
download | vcxsrv-95acf9816e008fa46a6c2fa2f35500deb358bb69.tar.gz vcxsrv-95acf9816e008fa46a6c2fa2f35500deb358bb69.tar.bz2 vcxsrv-95acf9816e008fa46a6c2fa2f35500deb358bb69.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
libXmu/src/CmapAlloc.c
Diffstat (limited to 'mesalib/src/mesa/swrast/s_texture.c')
-rw-r--r-- | mesalib/src/mesa/swrast/s_texture.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c index 7e3fc2806..aa073753f 100644 --- a/mesalib/src/mesa/swrast/s_texture.c +++ b/mesalib/src/mesa/swrast/s_texture.c @@ -67,6 +67,7 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, gl_format format, GLsizei width, GLsizei height, GLsizei depth) { + struct swrast_texture_image *swImg = swrast_texture_image(texImage); GLuint bytes = _mesa_format_image_size(format, width, height, depth); /* This _should_ be true (revisit if these ever fail) */ @@ -77,6 +78,26 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx, assert(!texImage->Data); texImage->Data = _mesa_align_malloc(bytes, 512); + if ((width == 1 || _mesa_is_pow_two(texImage->Width2)) && + (height == 1 || _mesa_is_pow_two(texImage->Height2)) && + (depth == 1 || _mesa_is_pow_two(texImage->Depth2))) + swImg->_IsPowerOfTwo = GL_TRUE; + else + swImg->_IsPowerOfTwo = GL_FALSE; + + /* Compute Width/Height/DepthScale for mipmap lod computation */ + if (texImage->TexObject->Target == GL_TEXTURE_RECTANGLE_NV) { + /* scale = 1.0 since texture coords directly map to texels */ + swImg->WidthScale = 1.0; + swImg->HeightScale = 1.0; + swImg->DepthScale = 1.0; + } + else { + swImg->WidthScale = (GLfloat) texImage->Width; + swImg->HeightScale = (GLfloat) texImage->Height; + swImg->DepthScale = (GLfloat) texImage->Depth; + } + return texImage->Data != NULL; } @@ -88,7 +109,7 @@ void _swrast_free_texture_image_buffer(struct gl_context *ctx, struct gl_texture_image *texImage) { - if (texImage->Data && !texImage->IsClientData) { + if (texImage->Data) { _mesa_align_free(texImage->Data); } |