diff options
author | Marek Olšák <[email protected]> | 2012-11-11 15:32:59 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-11-12 21:37:31 +0100 |
commit | e7dde5c8fb8ae6964bd5972d5962c2a26fc6ee0f (patch) | |
tree | 0e0991aa4de860c9c52740c814df975bb0c30729 /src/mesa | |
parent | 6dd839f23a8ee7b6853f7320a2715df44040b358 (diff) |
st/mesa: fix computation of last_level in GenerateMipmap
Array textures were broken.
NOTE: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_gen_mipmap.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 889200686e4..c0926131254 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -121,30 +121,16 @@ compute_num_levels(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target) { - if (target == GL_TEXTURE_RECTANGLE_ARB) { - return 1; - } - else { - const struct gl_texture_image *baseImage = - _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel); - GLuint size, numLevels; + const struct gl_texture_image *baseImage; + GLuint numLevels; - size = MAX2(baseImage->Width2, baseImage->Height2); - size = MAX2(size, baseImage->Depth2); + baseImage = _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel); - numLevels = texObj->BaseLevel; - - while (size > 0) { - numLevels++; - size >>= 1; - } + numLevels = texObj->BaseLevel + baseImage->MaxNumLevels; + numLevels = MIN2(numLevels, texObj->MaxLevel + 1); + assert(numLevels >= 1); - numLevels = MIN2(numLevels, texObj->MaxLevel + 1); - - assert(numLevels >= 1); - - return numLevels; - } + return numLevels; } |