summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/attrib.c6
-rw-r--r--src/mesa/main/mtypes.h10
-rw-r--r--src/mesa/main/teximage.c4
-rw-r--r--src/mesa/main/texobj.c24
-rw-r--r--src/mesa/swrast/s_texture.c46
5 files changed, 46 insertions, 44 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index c6475ca5afd..3fab9416884 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.37 2000/11/27 18:59:09 brianp Exp $ */
+/* $Id: attrib.c,v 1.38 2000/12/14 20:25:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -85,8 +85,8 @@ copy_texobj_state( struct gl_texture_object *dest,
dest->MaxLod = src->MaxLod;
dest->BaseLevel = src->BaseLevel;
dest->MaxLevel = src->MaxLevel;
- dest->_P = src->_P;
- dest->_M = src->_M;
+ dest->_MaxLevel = src->_MaxLevel;
+ dest->_MaxLambda = src->_MaxLambda;
dest->Palette = src->Palette;
dest->Complete = src->Complete;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 72676708228..c6b4ac9180b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.5 2000/12/08 00:20:15 brianp Exp $ */
+/* $Id: mtypes.h,v 1.6 2000/12/14 20:25:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -786,10 +786,10 @@ struct gl_texture_object {
GLenum MagFilter; /* magnification filter */
GLfloat MinLod; /* OpenGL 1.2 */
GLfloat MaxLod; /* OpenGL 1.2 */
- GLint BaseLevel; /* OpenGL 1.2 */
- GLint MaxLevel; /* OpenGL 1.2 */
- GLint _P; /* Highest mipmap level */
- GLfloat _M; /* = MIN(MaxLevel, P) - BaseLevel */
+ GLint BaseLevel; /* user-specified, OpenGL 1.2 */
+ GLint MaxLevel; /* user-specified, OpenGL 1.2 */
+ GLint _MaxLevel; /* actual max mipmap level (q in the spec) */
+ GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */
struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
/* Texture cube faces */
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 36412cbb928..4b6e855abc4 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.67 2000/12/09 21:30:43 brianp Exp $ */
+/* $Id: teximage.c,v 1.68 2000/12/14 20:25:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2134,7 +2134,7 @@ _mesa_get_teximages_from_driver(GLcontext *ctx,
* all but this is easier. We're on a (slow) software path
* anyway.
*/
- for (level = 0; level <= texObj->_P; level++) {
+ for (level = texObj->BaseLevel; level <= texObj->_MaxLevel; level++) {
struct gl_texture_image *texImg = texObj->Image[level];
if (texImg && !texImg->Data) {
_mesa_get_teximage_from_driver(ctx, target, level, texObj);
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index f090fcd734c..68ce55b738d 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.35 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: texobj.c,v 1.36 2000/12/14 20:25:56 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -177,6 +177,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
struct gl_texture_object *t )
{
const GLint baseLevel = t->BaseLevel;
+ GLint maxLog2;
t->Complete = GL_TRUE; /* be optimistic */
@@ -187,24 +188,26 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
return;
}
- /* Compute number of mipmap levels */
+ /* Compute _MaxLevel */
if (t->Dimensions == 1) {
- t->_P = t->Image[baseLevel]->WidthLog2;
+ maxLog2 = t->Image[baseLevel]->WidthLog2;
}
else if (t->Dimensions == 2 || t->Dimensions == 6) {
- t->_P = MAX2(t->Image[baseLevel]->WidthLog2,
- t->Image[baseLevel]->HeightLog2);
+ maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2,
+ t->Image[baseLevel]->HeightLog2);
}
else if (t->Dimensions == 3) {
GLint max = MAX2(t->Image[baseLevel]->WidthLog2,
t->Image[baseLevel]->HeightLog2);
- max = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2));
- t->_P = max;
+ maxLog2 = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2));
}
- /* Compute M (see the 1.2 spec) used during mipmapping */
- t->_M = (GLfloat) (MIN2(t->MaxLevel, t->_P) - t->BaseLevel);
+ t->_MaxLevel = baseLevel + maxLog2;
+ t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
+ t->_MaxLevel = MIN2(t->_MaxLevel, ctx->Const.MaxTextureLevels - 1);
+ /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
+ t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
if (t->Dimensions == 6) {
/* make sure that all six cube map level 0 images are the same size */
@@ -237,8 +240,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
*/
GLint i;
GLint minLevel = baseLevel;
- GLint maxLevel = MIN2(t->_P, ctx->Const.MaxTextureLevels-1);
- maxLevel = MIN2(maxLevel, t->MaxLevel);
+ GLint maxLevel = t->_MaxLevel;
if (minLevel > maxLevel) {
t->Complete = GL_FALSE;
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 8b0a5f02f07..b08724f3a95 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.3 2000/12/08 00:09:24 brianp Exp $ */
+/* $Id: s_texture.c,v 1.4 2000/12/14 20:25:59 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -175,8 +175,8 @@ static void palette_sample(const struct gl_texture_object *tObj,
{ \
if (lambda < 0.0F) \
lambda = 0.0F; \
- else if (lambda > tObj->_M) \
- lambda = tObj->_M; \
+ else if (lambda > tObj->_MaxLambda) \
+ lambda = tObj->_MaxLambda; \
level = (GLint) (tObj->BaseLevel + lambda); \
}
@@ -188,11 +188,11 @@ static void palette_sample(const struct gl_texture_object *tObj,
{ \
if (lambda <= 0.5F) \
lambda = 0.0F; \
- else if (lambda > tObj->_M + 0.4999F) \
- lambda = tObj->_M + 0.4999F; \
+ else if (lambda > tObj->_MaxLambda + 0.4999F) \
+ lambda = tObj->_MaxLambda + 0.4999F; \
level = (GLint) (tObj->BaseLevel + lambda + 0.5F); \
- if (level > tObj->_P) \
- level = tObj->_P; \
+ if (level > tObj->_MaxLevel) \
+ level = tObj->_MaxLevel; \
}
@@ -433,8 +433,8 @@ sample_1d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- if (level >= tObj->_P) {
- sample_1d_nearest( tObj, tObj->Image[tObj->_P], s, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_1d_nearest( tObj, tObj->Image[tObj->_MaxLevel], s, rgba );
}
else {
GLchan t0[4], t1[4];
@@ -459,8 +459,8 @@ sample_1d_linear_mipmap_linear( const struct gl_texture_object *tObj,
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- if (level >= tObj->_P) {
- sample_1d_linear( tObj, tObj->Image[tObj->_P], s, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_1d_linear( tObj, tObj->Image[tObj->_MaxLevel], s, rgba );
}
else {
GLchan t0[4], t1[4];
@@ -811,8 +811,8 @@ sample_2d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- if (level >= tObj->_P) {
- sample_2d_nearest( tObj, tObj->Image[tObj->_P], s, t, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_2d_nearest( tObj, tObj->Image[tObj->_MaxLevel], s, t, rgba );
}
else {
GLchan t0[4], t1[4]; /* texels */
@@ -837,8 +837,8 @@ sample_2d_linear_mipmap_linear( const struct gl_texture_object *tObj,
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- if (level >= tObj->_P) {
- sample_2d_linear( tObj, tObj->Image[tObj->_P], s, t, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_2d_linear( tObj, tObj->Image[tObj->_MaxLevel], s, t, rgba );
}
else {
GLchan t0[4], t1[4]; /* texels */
@@ -1314,8 +1314,8 @@ sample_3d_nearest_mipmap_linear( const struct gl_texture_object *tObj,
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- if (level >= tObj->_P) {
- sample_3d_nearest( tObj, tObj->Image[tObj->_P], s, t, r, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_3d_nearest( tObj, tObj->Image[tObj->_MaxLevel], s, t, r, rgba );
}
else {
GLchan t0[4], t1[4]; /* texels */
@@ -1339,8 +1339,8 @@ sample_3d_linear_mipmap_linear( const struct gl_texture_object *tObj,
COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level);
- if (level >= tObj->_P) {
- sample_3d_linear( tObj, tObj->Image[tObj->_P], s, t, r, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_3d_linear( tObj, tObj->Image[tObj->_MaxLevel], s, t, r, rgba );
}
else {
GLchan t0[4], t1[4]; /* texels */
@@ -1602,8 +1602,8 @@ sample_cube_nearest_mipmap_linear( const struct gl_texture_object *tObj,
images = choose_cube_face(tObj, s, t, u, &newS, &newT);
- if (level >= tObj->_P) {
- sample_2d_nearest( tObj, images[tObj->_P], newS, newT, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_2d_nearest( tObj, images[tObj->_MaxLevel], newS, newT, rgba );
}
else {
GLchan t0[4], t1[4]; /* texels */
@@ -1631,8 +1631,8 @@ sample_cube_linear_mipmap_linear( const struct gl_texture_object *tObj,
images = choose_cube_face(tObj, s, t, u, &newS, &newT);
- if (level >= tObj->_P) {
- sample_2d_linear( tObj, images[tObj->_P], newS, newT, rgba );
+ if (level >= tObj->_MaxLevel) {
+ sample_2d_linear( tObj, images[tObj->_MaxLevel], newS, newT, rgba );
}
else {
GLchan t0[4], t1[4];