summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r--src/mesa/swrast/s_texture.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 14ee0ebc600..1dcb08c0a1b 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -85,6 +85,19 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
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;
}