-/*
- * Compute mipmap level of detail.
- * XXX we should really include the R coordinate in this computation
- * in order to do 3-D texture mipmapping.
- */
-static INLINE GLfloat
-compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4],
- const GLfloat qPlane[4], GLfloat cx, GLfloat cy,
- GLfloat invQ, GLfloat texWidth, GLfloat texHeight)
-{
- const GLfloat s = solve_plane(cx, cy, sPlane);
- const GLfloat t = solve_plane(cx, cy, tPlane);
- const GLfloat invQ_x1 = solve_plane_recip(cx+1.0F, cy, qPlane);
- const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0F, qPlane);
- const GLfloat s_x1 = s - sPlane[0] / sPlane[2];
- const GLfloat s_y1 = s - sPlane[1] / sPlane[2];
- const GLfloat t_x1 = t - tPlane[0] / tPlane[2];
- const GLfloat t_y1 = t - tPlane[1] / tPlane[2];
- GLfloat dsdx = s_x1 * invQ_x1 - s * invQ;
- GLfloat dsdy = s_y1 * invQ_y1 - s * invQ;
- GLfloat dtdx = t_x1 * invQ_x1 - t * invQ;
- GLfloat dtdy = t_y1 * invQ_y1 - t * invQ;
- GLfloat maxU, maxV, rho, lambda;
- dsdx = FABSF(dsdx);
- dsdy = FABSF(dsdy);
- dtdx = FABSF(dtdx);
- dtdy = FABSF(dtdy);
- maxU = MAX2(dsdx, dsdy) * texWidth;
- maxV = MAX2(dtdx, dtdy) * texHeight;
- rho = MAX2(maxU, maxV);
- lambda = LOG2(rho);
- return lambda;
-}
-
-