summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-06-15 03:03:06 +0000
committerBrian Paul <[email protected]>2002-06-15 03:03:06 +0000
commit8afe7de8deaf3c9613fd68b344de8c52b02b1879 (patch)
treef600a192c9d0136faea8864a53eabc819eeb791f /src/mesa/main/texstore.c
parent8bdd0dc8d0e9c9cb2c71fbdd4c77e982cfc0b350 (diff)
Implemented GL_NV_texture_rectangle extension.
Replace struct gl_texure_object's Dimension w/ Target field. Added _EnabledUnits to struct gl_texture_attrib - the _ReallyEnabled field is obsolete, but still present for now. This effectively removes the 8-texture units limit, 32 units now possible, but unlikely! New TEXTURE_1D/2D/3D/CUBE/RECT_BIT tokens for unit->_ReallyEnabled field. Updated device drivers to use ctx->Texture._EnabledUnits.
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index abf2d1472f2..7d37bcb00fd 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1,4 +1,4 @@
-/* $Id: texstore.c,v 1.36 2002/04/04 16:59:05 brianp Exp $ */
+/* $Id: texstore.c,v 1.37 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1617,6 +1617,7 @@ _mesa_generate_mipmap(GLcontext *ctx,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
0 };
+ const GLenum targetsRect[] = { GL_TEXTURE_RECTANGLE_NV, 0 };
const GLenum *targets;
GLint level;
GLint maxLevels = 0;
@@ -1624,23 +1625,27 @@ _mesa_generate_mipmap(GLcontext *ctx,
ASSERT(texObj);
ASSERT(texObj->Image[texObj->BaseLevel]);
- switch (texObj->Dimensions) {
- case 1:
+ switch (texObj->Target) {
+ case GL_TEXTURE_1D:
targets = targets1D;
maxLevels = ctx->Const.MaxTextureLevels;
break;
- case 2:
+ case GL_TEXTURE_2D:
targets = targets2D;
maxLevels = ctx->Const.MaxTextureLevels;
break;
- case 3:
+ case GL_TEXTURE_3D:
targets = targets3D;
maxLevels = ctx->Const.Max3DTextureLevels;
break;
- case 6:
+ case GL_TEXTURE_CUBE_MAP_ARB:
targets = targetsCube;
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ targets = targetsRect;
+ maxLevels = 1;
+ break;
default:
_mesa_problem(ctx,
"Bad texture object dimension in _mesa_generate_mipmaps");
@@ -1711,7 +1716,7 @@ _mesa_generate_mipmap(GLcontext *ctx,
MESA_PBUFFER_FREE(dstImage->Data);
/* initialize new image */
- _mesa_init_teximage_fields(ctx, dstImage, dstWidth, dstHeight,
+ _mesa_init_teximage_fields(ctx, t, dstImage, dstWidth, dstHeight,
dstDepth, border, srcImage->Format);
dstImage->DriverData = NULL;
dstImage->TexFormat = srcImage->TexFormat;
@@ -1732,23 +1737,26 @@ _mesa_generate_mipmap(GLcontext *ctx,
/*
* We use simple 2x2 averaging to compute the next mipmap level.
*/
- switch (texObj->Dimensions) {
- case 1:
+ switch (texObj->Target) {
+ case GL_TEXTURE_1D:
make_1d_mipmap(srcImage->TexFormat, border,
srcWidth, (const GLubyte *) srcImage->Data,
dstWidth, (GLubyte *) dstImage->Data);
break;
- case 2:
- case 6:
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP_ARB:
make_2d_mipmap(srcImage->TexFormat, border,
srcWidth, srcHeight, (const GLubyte *) srcImage->Data,
dstWidth, dstHeight, (GLubyte *) dstImage->Data);
break;
- case 3:
+ case GL_TEXTURE_3D:
make_3d_mipmap(srcImage->TexFormat, border,
srcWidth, srcHeight, srcDepth, (const GLubyte *) srcImage->Data,
dstWidth, dstHeight, dstDepth, (GLubyte *) dstImage->Data);
break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ /* no mipmaps, do nothing */
+ break;
default:
_mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps");
return;