Cooper Yuan wrote:
Hi Brian,
for non-mipmap case, the value of LastLevel might be wrong. because the
function st_finalize_texture() might be called from non-mipmap case.
The MaxLevel is related to log2(texture width), for non-mipmap case, I
think the LastLevel should be the same as BaseLevel.
...
how about this patch, considering both mipmap and non-mipmap cases.
diff --git a/src/mesa/state_tracker/st_cb_texture.c
b/src/mesa/state_tracker/st_cb_texture.c
index 771a0e2..e0718bd 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1765,8 +1765,13 @@ st_finalize_texture(GLcontext *ctx,
* from the st_generate_mipmap() function when the texture
object is
* incomplete. In that case, we'll have set stObj->lastLevel
before
* we get here.
+ * If face 0 has more than one image, that means it's a mipmap
case,
+ * otherwise the lastLevel should be BaseLevel.
*/
- stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel;
+ if (stObj->base.Image[0][1])
+ stObj->lastLevel = stObj->base._MaxLevel -
stObj->base.BaseLevel;
+ else
+ stObj->lastLevel = stObj->base.BaseLevel;
}
firstImage =
st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
The intention is correct, but the implementation isn't. We should
check the texObj->MinFilter to see if a mipmap filter is being used.
Here's a new patch.
-Brian
diff --git a/src/mesa/state_tracker/st_cb_texture.c
b/src/mesa/state_tracker/st_cb_texture.c
index 771a0e2..6fb8464 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1766,7 +1766,10 @@ st_finalize_texture(GLcontext *ctx,
* incomplete. In that case, we'll have set stObj->lastLevel before
* we get here.
*/
- stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel;
+ if (tObj->MinFilter == GL_LINEAR || tObj->MinFilter == GL_NEAREST)
+ stObj->lastLevel = stObj->base.BaseLevel;
+ else
+ stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel;
}
firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev