Hi all,
Texture sampling for non-power-of-two textures (NPOT) using GL_LINEAR
min/max filtering and GL_REPEAT wrap mode was broken in the software
rasterizer. The function used to compute the texel locations in this
case was not NPOT ready. The fix was pretty straightforward. You will
find the patch below.
Enjoy,
Etienne
--
Etienne Clement -- software developer
email: [EMAIL PROTECTED]
tel: 514.954.7483 fax: 514.393.0110
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index f55e234..4dc96fe 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -473,15 +473,6 @@ repeat_remainder(GLint a, GLint b)
}
-/* Power of two image sizes only */
-#define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \
-{ \
- U = S * SIZE - 0.5F;
\
- I0 = IFLOOR(U) & (SIZE - 1);
\
- I1 = (I0 + 1) & (SIZE - 1); \
-}
-
-
/**
* For linear interpolation between mipmap levels N and N+1, this function
* computes N.
@@ -1044,10 +1035,9 @@ sample_2d_linear_repeat(GLcontext *ctx,
ASSERT(tObj->WrapT == GL_REPEAT);
ASSERT(img->Border == 0);
ASSERT(img->_BaseFormat != GL_COLOR_INDEX);
- ASSERT(img->_IsPowerOfTwo);
- COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1);
- COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[1], v, height, j0, j1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
+ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1);
img->FetchTexelc(img, i0, j0, 0, t00);
img->FetchTexelc(img, i1, j0, 0, t10);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev