summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-09-21 18:54:53 -0600
committerBrian Paul <[email protected]>2011-09-22 10:44:36 -0600
commiteaf376ba354db11f7729452060570b48a029c9a0 (patch)
tree64801ebcccfbe0f83dc4dffbf6feb75ac4457558 /src/mesa/swrast/s_texture.c
parentde414f491526610bb260c73805c81ba413388e20 (diff)
mesa: move gl_texture_image::_IsPowerOfTwo into swrast
It's only used by swrast. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r--src/mesa/swrast/s_texture.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 7e3fc2806d9..14ee0ebc600 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/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,13 @@ _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;
+
return texImage->Data != NULL;
}