diff options
author | marha <marha@users.sourceforge.net> | 2011-09-26 17:04:30 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-26 17:04:30 +0200 |
commit | 873965b49f283ad028dd4e0e5b7e93a758c84993 (patch) | |
tree | 84122d76cb641b54ea85cee9b631fb51c25052b5 /mesalib/src/mesa/swrast/s_texture.c | |
parent | c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (diff) | |
download | vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.tar.gz vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.tar.bz2 vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.zip |
fontconfig libX11 libXext libXft libXmu mesa git update 26 sep 2011
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); } |