GLuint HeightLog2; /**< = log2(Height2) */
GLuint DepthLog2; /**< = log2(Depth2) */
GLuint MaxLog2; /**< = MAX(WidthLog2, HeightLog2) */
- GLfloat WidthScale; /**< used for mipmap LOD computation */
- GLfloat HeightScale; /**< used for mipmap LOD computation */
- GLfloat DepthScale; /**< used for mipmap LOD computation */
GLboolean IsClientData; /**< Data owned by client? */
struct gl_texture_object *TexObject; /**< Pointer back to parent object */
img->ImageOffsets[i] = i * width * height;
}
- /* Compute Width/Height/DepthScale for mipmap lod computation */
- if (target == GL_TEXTURE_RECTANGLE_NV) {
- /* scale = 1.0 since texture coords directly map to texels */
- img->WidthScale = 1.0;
- img->HeightScale = 1.0;
- img->DepthScale = 1.0;
- }
- else {
- img->WidthScale = (GLfloat) img->Width;
- img->HeightScale = (GLfloat) img->Height;
- img->DepthScale = (GLfloat) img->Depth;
- }
-
img->TexFormat = format;
}
GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */
-#if 0
/** used for mipmap LOD computation */
GLfloat WidthScale, HeightScale, DepthScale;
+#if 0
GLubyte *Data; /**< The actual texture data in malloc'd memory */
GLint TexelSize; /**< bytes per texel block */
if (texObj) {
const struct gl_texture_image *texImg =
texObj->Image[0][texObj->BaseLevel];
- const GLfloat texW = (GLfloat) texImg->WidthScale;
- const GLfloat texH = (GLfloat) texImg->HeightScale;
+ const struct swrast_texture_image *swImg =
+ swrast_texture_image_const(texImg);
+ const GLfloat texW = (GLfloat) swImg->WidthScale;
+ const GLfloat texH = (GLfloat) swImg->HeightScale;
GLfloat lambda;
GLfloat rgba[4];
if (obj) {
const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel];
+ const struct swrast_texture_image *swImg =
+ swrast_texture_image_const(img);
+
needLambda = (obj->Sampler.MinFilter != obj->Sampler.MagFilter)
|| ctx->FragmentProgram._Current;
/* LOD is calculated directly in the ansiotropic filter, we can
obj->Sampler.MinFilter == GL_LINEAR_MIPMAP_LINEAR) {
needLambda = GL_FALSE;
}
- texW = img->WidthScale;
- texH = img->HeightScale;
+ texW = swImg->WidthScale;
+ texH = swImg->HeightScale;
}
else {
/* using a fragment program */
const struct gl_texture_image *img = tObj->Image[0][level];
const struct gl_texture_image *mostDetailedImage =
tObj->Image[0][tObj->BaseLevel];
- GLfloat tex_u=-0.5 + texcoord[0] * mostDetailedImage->WidthScale * scaling;
- GLfloat tex_v=-0.5 + texcoord[1] * mostDetailedImage->HeightScale * scaling;
+ const struct swrast_texture_image *swImg =
+ swrast_texture_image_const(mostDetailedImage);
+ GLfloat tex_u=-0.5 + texcoord[0] * swImg->WidthScale * scaling;
+ GLfloat tex_v=-0.5 + texcoord[1] * swImg->HeightScale * scaling;
GLfloat ux = dudx * scaling;
GLfloat vx = dvdx * scaling;
const GLfloat lambda_iso[], GLfloat rgba[][4])
{
const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel];
+ const struct swrast_texture_image *swImg = swrast_texture_image_const(tImg);
const GLfloat maxEccentricity =
tObj->Sampler.MaxAnisotropy * tObj->Sampler.MaxAnisotropy;
create_filter_table();
}
- texW = tImg->WidthScale;
- texH = tImg->HeightScale;
+ texW = swImg->WidthScale;
+ texH = swImg->HeightScale;
for (i = 0; i < n; i++) {
const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
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;
}