summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
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
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')
-rw-r--r--src/mesa/main/attrib.c47
-rw-r--r--src/mesa/main/config.h9
-rw-r--r--src/mesa/main/context.c53
-rw-r--r--src/mesa/main/enable.c51
-rw-r--r--src/mesa/main/extensions.c4
-rw-r--r--src/mesa/main/get.c58
-rw-r--r--src/mesa/main/mtypes.h96
-rw-r--r--src/mesa/main/state.c57
-rw-r--r--src/mesa/main/teximage.c234
-rw-r--r--src/mesa/main/teximage.h4
-rw-r--r--src/mesa/main/texobj.c113
-rw-r--r--src/mesa/main/texobj.h8
-rw-r--r--src/mesa/main/texstate.c103
-rw-r--r--src/mesa/main/texstore.c32
14 files changed, 619 insertions, 250 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index a7f90155bb6..fb5fbc8b704 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.67 2002/06/15 02:38:15 brianp Exp $ */
+/* $Id: attrib.c,v 1.68 2002/06/15 03:03:06 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -81,9 +81,7 @@ copy_texobj_state( struct gl_texture_object *dest,
const struct gl_texture_object *src )
{
dest->Name = src->Name;
- /*
- dest->Dimensions = src->Dimensions;
- */
+ /*dest->Target = src->Target*/
dest->Priority = src->Priority;
dest->BorderColor[0] = src->BorderColor[0];
dest->BorderColor[1] = src->BorderColor[1];
@@ -383,6 +381,7 @@ _mesa_PushAttrib(GLbitfield mask)
ctx->Texture.Unit[u].Current2D->RefCount++;
ctx->Texture.Unit[u].Current3D->RefCount++;
ctx->Texture.Unit[u].CurrentCubeMap->RefCount++;
+ ctx->Texture.Unit[u].CurrentRect->RefCount++;
}
attr = MALLOC_STRUCT( gl_texture_attrib );
MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) );
@@ -392,6 +391,7 @@ _mesa_PushAttrib(GLbitfield mask)
copy_texobj_state(&attr->Unit[u].Saved2D, attr->Unit[u].Current2D);
copy_texobj_state(&attr->Unit[u].Saved3D, attr->Unit[u].Current3D);
copy_texobj_state(&attr->Unit[u].SavedCubeMap, attr->Unit[u].CurrentCubeMap);
+ copy_texobj_state(&attr->Unit[u].SavedRect, attr->Unit[u].CurrentRect);
}
newnode = new_attrib_node( GL_TEXTURE_BIT );
newnode->data = attr;
@@ -580,11 +580,17 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
(*ctx->Driver.ActiveTexture)(ctx, i);
}
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D,
- (GLboolean) (enable->Texture[i] & TEXTURE0_1D) );
+ (GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D,
- (GLboolean) (enable->Texture[i] & TEXTURE0_2D) );
+ (GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) );
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D,
- (GLboolean) (enable->Texture[i] & TEXTURE0_3D) );
+ (GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) );
+ if (ctx->Extensions.ARB_texture_cube_map)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB,
+ (GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) );
+ if (ctx->Extensions.NV_texture_rectangle)
+ (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV,
+ (GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) );
}
}
@@ -627,18 +633,22 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
const struct gl_texture_unit *unit = &texAttrib->Unit[u];
- GLuint numObjs, i;
+ GLuint i;
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u);
_mesa_set_enable(ctx, GL_TEXTURE_1D,
- (GLboolean) (unit->Enabled & TEXTURE0_1D ? GL_TRUE : GL_FALSE));
+ (GLboolean) (unit->Enabled & TEXTURE_1D_BIT ? GL_TRUE : GL_FALSE));
_mesa_set_enable(ctx, GL_TEXTURE_2D,
- (GLboolean) (unit->Enabled & TEXTURE0_2D ? GL_TRUE : GL_FALSE));
+ (GLboolean) (unit->Enabled & TEXTURE_2D_BIT ? GL_TRUE : GL_FALSE));
_mesa_set_enable(ctx, GL_TEXTURE_3D,
- (GLboolean) (unit->Enabled & TEXTURE0_3D ? GL_TRUE : GL_FALSE));
+ (GLboolean) (unit->Enabled & TEXTURE_3D_BIT ? GL_TRUE : GL_FALSE));
if (ctx->Extensions.ARB_texture_cube_map) {
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB,
- (GLboolean) (unit->Enabled & TEXTURE0_CUBE ? GL_TRUE : GL_FALSE));
+ (GLboolean) (unit->Enabled & TEXTURE_CUBE_BIT ? GL_TRUE : GL_FALSE));
+ }
+ if (ctx->Extensions.NV_texture_rectangle) {
+ _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV,
+ (GLboolean) (unit->Enabled & TEXTURE_RECT_BIT ? GL_TRUE : GL_FALSE));
}
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode);
_mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor);
@@ -695,9 +705,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
}
/* Restore texture object state */
- numObjs = ctx->Extensions.ARB_texture_cube_map ? 4 : 3;
-
- for (i = 0; i < numObjs; i++) {
+ for (i = 0; i < 5; i++) {
GLenum target = 0;
const struct gl_texture_object *obj = NULL;
GLfloat bordColor[4];
@@ -716,9 +724,17 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
obj = &unit->Saved3D;
break;
case 3:
+ if (!ctx->Extensions.ARB_texture_cube_map)
+ continue;
target = GL_TEXTURE_CUBE_MAP_ARB;
obj = &unit->SavedCubeMap;
break;
+ case 4:
+ if (!ctx->Extensions.NV_texture_rectangle)
+ continue;
+ target = GL_TEXTURE_RECTANGLE_NV;
+ obj = &unit->SavedRect;
+ break;
default:
; /* silence warnings */
}
@@ -770,6 +786,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
ctx->Texture.Unit[u].Current2D->RefCount--;
ctx->Texture.Unit[u].Current3D->RefCount--;
ctx->Texture.Unit[u].CurrentCubeMap->RefCount--;
+ ctx->Texture.Unit[u].CurrentRect->RefCount--;
}
}
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index d02baedcc94..f0bd88462db 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -1,10 +1,10 @@
-/* $Id: config.h,v 1.39 2002/06/15 02:38:15 brianp Exp $ */
+/* $Id: config.h,v 1.40 2002/06/15 03:03:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -109,9 +109,12 @@
/* Number of 3D texture mipmap levels */
#define MAX_3D_TEXTURE_LEVELS 8
-/* Number of cube texture mipmap levels */
+/* Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
#define MAX_CUBE_TEXTURE_LEVELS 12
+/* Maximum rectangular texture size - GL_NV_texture_rectangle */
+#define MAX_TEXTURE_RECT_SIZE 2048
+
/* Number of texture units - GL_ARB_multitexture */
#define MAX_TEXTURE_UNITS 8
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2baff7c2990..daf4eb69b36 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.167 2002/06/15 02:38:15 brianp Exp $ */
+/* $Id: context.c,v 1.168 2002/06/15 03:03:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -644,26 +644,33 @@ alloc_shared_state( void )
/* Default Texture objects */
outOfMemory = GL_FALSE;
- ss->Default1D = _mesa_alloc_texture_object(ss, 0, 1);
+ ss->Default1D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_1D);
if (!ss->Default1D) {
outOfMemory = GL_TRUE;
}
- ss->Default2D = _mesa_alloc_texture_object(ss, 0, 2);
+ ss->Default2D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_2D);
if (!ss->Default2D) {
outOfMemory = GL_TRUE;
}
- ss->Default3D = _mesa_alloc_texture_object(ss, 0, 3);
+ ss->Default3D = _mesa_alloc_texture_object(ss, 0, GL_TEXTURE_3D);
if (!ss->Default3D) {
outOfMemory = GL_TRUE;
}
- ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0, 6);
+ ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0,
+ GL_TEXTURE_CUBE_MAP_ARB);
if (!ss->DefaultCubeMap) {
outOfMemory = GL_TRUE;
}
+ ss->DefaultRect = _mesa_alloc_texture_object(ss, 0,
+ GL_TEXTURE_RECTANGLE_NV);
+ if (!ss->DefaultRect) {
+ outOfMemory = GL_TRUE;
+ }
+
if (!ss->DisplayList || !ss->TexObjects || !ss->VertexPrograms
|| outOfMemory) {
/* Ran out of memory at some point. Free everything and return NULL */
@@ -681,6 +688,8 @@ alloc_shared_state( void )
_mesa_free_texture_object(ss, ss->Default3D);
if (ss->DefaultCubeMap)
_mesa_free_texture_object(ss, ss->DefaultCubeMap);
+ if (ss->DefaultRect)
+ _mesa_free_texture_object(ss, ss->DefaultRect);
FREE(ss);
return NULL;
}
@@ -839,6 +848,7 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
texUnit->Current2D = ctx->Shared->Default2D;
texUnit->Current3D = ctx->Shared->Default3D;
texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
+ texUnit->CurrentRect = ctx->Shared->DefaultRect;
}
@@ -896,6 +906,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
+ ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS;
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS;
@@ -1285,7 +1296,8 @@ init_attrib_groups( GLcontext *ctx )
/* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */
- ctx->Texture._ReallyEnabled = 0;
+ ctx->Texture._ReallyEnabled = 0; /* XXX obsolete */
+ ctx->Texture._EnabledUnits = 0;
for (i=0; i<MAX_TEXTURE_UNITS; i++)
init_texture_unit( ctx, i );
ctx->Texture.SharedPalette = GL_FALSE;
@@ -1484,25 +1496,26 @@ alloc_proxy_textures( GLcontext *ctx )
GLboolean out_of_memory;
GLint i;
- ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, 1);
+ ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_1D);
if (!ctx->Texture.Proxy1D) {
return GL_FALSE;
}
- ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, 2);
+ ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_2D);
if (!ctx->Texture.Proxy2D) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
return GL_FALSE;
}
- ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, 3);
+ ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_3D);
if (!ctx->Texture.Proxy3D) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
return GL_FALSE;
}
- ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, 6);
+ ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0,
+ GL_TEXTURE_CUBE_MAP_ARB);
if (!ctx->Texture.ProxyCubeMap) {
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
@@ -1510,6 +1523,16 @@ alloc_proxy_textures( GLcontext *ctx )
return GL_FALSE;
}
+ ctx->Texture.ProxyRect = _mesa_alloc_texture_object(NULL, 0,
+ GL_TEXTURE_RECTANGLE_NV);
+ if (!ctx->Texture.ProxyRect) {
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy3D);
+ _mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap);
+ return GL_FALSE;
+ }
+
out_of_memory = GL_FALSE;
for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
ctx->Texture.Proxy1D->Image[i] = _mesa_alloc_texture_image();
@@ -1523,6 +1546,10 @@ alloc_proxy_textures( GLcontext *ctx )
out_of_memory = GL_TRUE;
}
}
+ ctx->Texture.ProxyRect->Image[0] = _mesa_alloc_texture_image();
+ if (!ctx->Texture.ProxyRect->Image[0])
+ out_of_memory = GL_TRUE;
+
if (out_of_memory) {
for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
if (ctx->Texture.Proxy1D->Image[i]) {
@@ -1538,10 +1565,14 @@ alloc_proxy_textures( GLcontext *ctx )
_mesa_free_texture_image(ctx->Texture.ProxyCubeMap->Image[i]);
}
}
+ if (ctx->Texture.ProxyRect->Image[0]) {
+ _mesa_free_texture_image(ctx->Texture.ProxyRect->Image[0]);
+ }
_mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
_mesa_free_texture_object(NULL, ctx->Texture.Proxy3D);
_mesa_free_texture_object(NULL, ctx->Texture.ProxyCubeMap);
+ _mesa_free_texture_object(NULL, ctx->Texture.ProxyRect);
return GL_FALSE;
}
else {
@@ -1647,6 +1678,7 @@ _mesa_initialize_context( GLcontext *ctx,
ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS;
ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS;
ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS;
+ ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS;
init_attrib_groups( ctx );
@@ -1862,6 +1894,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_texture_object( NULL, ctx->Texture.Proxy2D );
_mesa_free_texture_object( NULL, ctx->Texture.Proxy3D );
_mesa_free_texture_object( NULL, ctx->Texture.ProxyCubeMap );
+ _mesa_free_texture_object( NULL, ctx->Texture.ProxyRect );
/* Free evaluator data */
if (ctx->EvalMap.Map1Vertex3.Points)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index bb0c4b705b2..eb031e8d669 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.65 2002/06/15 02:38:15 brianp Exp $ */
+/* $Id: enable.c,v 1.66 2002/06/15 03:03:07 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -539,9 +539,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
case GL_TEXTURE_1D: {
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D;
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT;
if (state)
- newenabled |= TEXTURE0_1D;
+ newenabled |= TEXTURE_1D_BIT;
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -551,9 +551,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
case GL_TEXTURE_2D: {
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D;
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT;
if (state)
- newenabled |= TEXTURE0_2D;
+ newenabled |= TEXTURE_2D_BIT;
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -563,9 +563,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
case GL_TEXTURE_3D: {
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D;
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT;
if (state)
- newenabled |= TEXTURE0_3D;
+ newenabled |= TEXTURE_3D_BIT;
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -720,10 +720,10 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
const GLuint curr = ctx->Texture.CurrentUnit;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
- GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE;
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT;
CHECK_EXTENSION(ARB_texture_cube_map);
if (state)
- newenabled |= TEXTURE0_CUBE;
+ newenabled |= TEXTURE_CUBE_BIT;
if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -872,6 +872,22 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
}
break;
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ {
+ const GLuint curr = ctx->Texture.CurrentUnit;
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+ GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT;
+ CHECK_EXTENSION(NV_texture_rectangle);
+ if (state)
+ newenabled |= TEXTURE_RECT_BIT;
+ if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texUnit->Enabled = newenabled;
+ }
+ break;
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
@@ -1021,19 +1037,19 @@ _mesa_IsEnabled( GLenum cap )
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- return (texUnit->Enabled & TEXTURE0_1D) ? GL_TRUE : GL_FALSE;
+ return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE;
}
case GL_TEXTURE_2D:
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- return (texUnit->Enabled & TEXTURE0_2D) ? GL_TRUE : GL_FALSE;
+ return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE;
}
case GL_TEXTURE_3D:
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- return (texUnit->Enabled & TEXTURE0_3D) ? GL_TRUE : GL_FALSE;
+ return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE;
}
case GL_TEXTURE_GEN_Q:
{
@@ -1133,7 +1149,7 @@ _mesa_IsEnabled( GLenum cap )
{
const struct gl_texture_unit *texUnit;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE;
+ return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE;
}
/* GL_ARB_multisample */
@@ -1236,6 +1252,15 @@ _mesa_IsEnabled( GLenum cap )
return ctx->Eval.Map2Attrib[map];
}
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION(NV_texture_rectangle);
+ {
+ const struct gl_texture_unit *texUnit;
+ texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE;
+ }
+
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index c86bf7ce2d4..bfecb3af7be 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.74 2002/05/27 17:04:53 brianp Exp $ */
+/* $Id: extensions.c,v 1.75 2002/06/15 03:03:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -114,6 +114,7 @@ static struct {
{ ON, "GL_MESA_window_pos", F(MESA_window_pos) },
{ OFF, "GL_NV_blend_square", F(NV_blend_square) },
{ OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
+ { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
{ OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
@@ -178,6 +179,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_MESA_resize_buffers",
"GL_NV_blend_square",
"GL_NV_point_sprite",
+ "GL_NV_texture_rectangle",
"GL_NV_texgen_reflection",
"GL_NV_vertex_program",
"GL_NV_vertex_program1_1",
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 7f718a7b219..e723d18d5e1 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.81 2002/06/15 02:38:15 brianp Exp $ */
+/* $Id: get.c,v 1.82 2002/06/15 03:03:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1441,6 +1441,20 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = 0;
break;
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_B(NV_texture_rectangle);
+ *params = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_B(NV_texture_rectangle);
+ *params = INT_TO_BOOL(textureUnit->CurrentRect->Name);
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_B(NV_texture_rectangle);
+ *params = INT_TO_BOOL(ctx->Const.MaxTextureRectSize);
+ break;
+
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
}
@@ -2677,6 +2691,20 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
/* GL_NV_vertex_program */
/* XXX to do */
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_D(NV_texture_rectangle);
+ *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_D(NV_texture_rectangle);
+ *params = (GLdouble) textureUnit->CurrentRect->Name;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_D(NV_texture_rectangle);
+ *params = (GLdouble) ctx->Const.MaxTextureRectSize;
+ break;
+
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
}
@@ -3896,6 +3924,20 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
/* GL_NV_vertex_program */
/* XXX to do */
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_F(NV_texture_rectangle);
+ *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_F(NV_texture_rectangle);
+ *params = (GLfloat) textureUnit->CurrentRect->Name;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_F(NV_texture_rectangle);
+ *params = (GLfloat) ctx->Const.MaxTextureRectSize;
+ break;
+
default:
GET_FLOAT_ERROR;
}
@@ -5153,6 +5195,20 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
/* GL_NV_vertex_program */
/* XXX to do */
+ /* GL_NV_texture_rectangle */
+ case GL_TEXTURE_RECTANGLE_NV:
+ CHECK_EXTENSION_I(NV_texture_rectangle);
+ *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ CHECK_EXTENSION_I(NV_texture_rectangle);
+ *params = (GLint) textureUnit->CurrentRect->Name;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:
+ CHECK_EXTENSION_I(NV_texture_rectangle);
+ *params = (GLint) ctx->Const.MaxTextureRectSize;
+ break;
+
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 846ed85de49..608d63244fc 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.79 2002/06/15 02:38:16 brianp Exp $ */
+/* $Id: mtypes.h,v 1.80 2002/06/15 03:03:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -726,52 +726,25 @@ struct gl_stencil_attrib {
#define R_BIT 4
#define Q_BIT 8
-#define NUM_TEXTURE_TARGETS 4 /* 1D, 2D, 3D and CUBE */
-
-/* Texture Enabled flags */
-#define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */
-#define TEXTURE0_2D 0x2
-#define TEXTURE0_3D 0x4
-#define TEXTURE0_CUBE 0x8
-#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE)
-#define TEXTURE1_1D (TEXTURE0_1D << 4) /* Texture unit 1 */
-#define TEXTURE1_2D (TEXTURE0_2D << 4)
-#define TEXTURE1_3D (TEXTURE0_3D << 4)
-#define TEXTURE1_CUBE (TEXTURE0_CUBE << 4)
-#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE)
-#define TEXTURE2_1D (TEXTURE0_1D << 8) /* Texture unit 2 */
-#define TEXTURE2_2D (TEXTURE0_2D << 8)
-#define TEXTURE2_3D (TEXTURE0_3D << 8)
-#define TEXTURE2_CUBE (TEXTURE0_CUBE << 8)
-#define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE)
-#define TEXTURE3_1D (TEXTURE0_1D << 12) /* Texture unit 3 */
-#define TEXTURE3_2D (TEXTURE0_2D << 12)
-#define TEXTURE3_3D (TEXTURE0_3D << 12)
-#define TEXTURE3_CUBE (TEXTURE0_CUBE << 12)
-#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
-#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 4 */
-#define TEXTURE4_2D (TEXTURE0_2D << 16)
-#define TEXTURE4_3D (TEXTURE0_3D << 16)
-#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16)
-#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
-#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 5 */
-#define TEXTURE5_2D (TEXTURE0_2D << 20)
-#define TEXTURE5_3D (TEXTURE0_3D << 20)
-#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20)
-#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
-#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 6 */
-#define TEXTURE6_2D (TEXTURE0_2D << 24)
-#define TEXTURE6_3D (TEXTURE0_3D << 24)
-#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24)
-#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
-#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 7 */
-#define TEXTURE7_2D (TEXTURE0_2D << 28)
-#define TEXTURE7_3D (TEXTURE0_3D << 28)
-#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28)
-#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE)
-
-/* Bitmap versions of the GL_ constants.
- */
+/* Texture.Unit[]._ReallyEnabled flags: */
+#define TEXTURE_1D_BIT 0x01
+#define TEXTURE_2D_BIT 0x02
+#define TEXTURE_3D_BIT 0x04
+#define TEXTURE_CUBE_BIT 0x08
+#define TEXTURE_RECT_BIT 0x10
+
+#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */
+
+/* Texture Enabled flags - XXX these are obsolete!!! */
+#define TEXTURE0_1D TEXTURE_1D_BIT
+#define TEXTURE0_2D TEXTURE_2D_BIT
+#define TEXTURE0_3D TEXTURE_3D_BIT
+#define TEXTURE0_CUBE TEXTURE_CUBE_BIT
+#define TEXTURE0_RECT TEXTURE_RECT_BIT
+#define TEXTURE0_ANY 0x1F
+
+
+/* Bitmap versions of the GL_ constants. */
#define TEXGEN_SPHERE_MAP 0x1
#define TEXGEN_OBJ_LINEAR 0x2
#define TEXGEN_EYE_LINEAR 0x4
@@ -788,8 +761,7 @@ struct gl_stencil_attrib {
-/* A selection of state flags to make driver and module's lives easier.
- */
+/* A selection of state flags to make driver and module's lives easier. */
#define ENABLE_TEXGEN0 0x1
#define ENABLE_TEXGEN1 0x2
#define ENABLE_TEXGEN2 0x4
@@ -846,6 +818,7 @@ struct gl_texture_format {
FetchTexelFunc FetchTexel3D;
};
+
/* Texture image record */
struct gl_texture_image {
GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
@@ -864,6 +837,9 @@ struct gl_texture_image {
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 */
GLvoid *Data; /* Image data, accessed via FetchTexel() */
const struct gl_texture_format *TexFormat;
@@ -883,7 +859,7 @@ struct gl_texture_object {
_glthread_Mutex Mutex; /* for thread safety */
GLint RefCount; /* reference count */
GLuint Name; /* an unsigned integer */
- GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */
+ GLenum Target; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
GLfloat Priority; /* in [0,1] */
GLfloat BorderValues[4]; /* unclamped */
GLchan BorderColor[4]; /* clamped, as GLchan */
@@ -928,13 +904,10 @@ struct gl_texture_object {
};
-
-/*
- * Texture units are new with the multitexture extension.
- */
+/* Texture unit record */
struct gl_texture_unit {
- GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE */
- GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE */
+ GLuint Enabled; /* bitmask of TEXTURE_*_BIT flags */
+ GLuint _ReallyEnabled; /* 0 or exactly one of TEXTURE_*_BIT flags */
GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
GLfloat EnvColor[4];
@@ -972,6 +945,7 @@ struct gl_texture_unit {
struct gl_texture_object *Current2D;
struct gl_texture_object *Current3D;
struct gl_texture_object *CurrentCubeMap; /* GL_ARB_texture_cube_map */
+ struct gl_texture_object *CurrentRect; /* GL_NV_texture_rectangle */
struct gl_texture_object *_Current; /* Points to really enabled tex obj */
@@ -979,13 +953,17 @@ struct gl_texture_unit {
struct gl_texture_object Saved2D;
struct gl_texture_object Saved3D;
struct gl_texture_object SavedCubeMap;
+ struct gl_texture_object SavedRect;
};
+/* The texture attribute group */
struct gl_texture_attrib {
/* multitexture */
GLuint CurrentUnit; /* Active texture unit */
+ GLuint _EnabledUnits; /* one bit set for each really-enabled unit */
+ /* XXX this field will go away, use _EnabledUnits instead! */
GLuint _ReallyEnabled; /* enables for all texture units: */
/* = (Unit[0]._ReallyEnabled << 0) | */
/* (Unit[1]._ReallyEnabled << 4) | */
@@ -1001,6 +979,7 @@ struct gl_texture_attrib {
struct gl_texture_object *Proxy2D;
struct gl_texture_object *Proxy3D;
struct gl_texture_object *ProxyCubeMap;
+ struct gl_texture_object *ProxyRect;
/* GL_EXT_shared_texture_palette */
GLboolean SharedPalette;
@@ -1297,6 +1276,7 @@ struct gl_shared_state {
struct gl_texture_object *Default2D;
struct gl_texture_object *Default3D;
struct gl_texture_object *DefaultCubeMap;
+ struct gl_texture_object *DefaultRect;
/* GL_NV_vertex_program */
struct _mesa_HashTable *VertexPrograms;
@@ -1350,7 +1330,8 @@ struct gl_frame_buffer {
struct gl_constants {
GLint MaxTextureLevels;
GLint Max3DTextureLevels;
- GLint MaxCubeTextureLevels;
+ GLint MaxCubeTextureLevels; /* GL_ARB_texture_cube_map */
+ GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */
GLuint MaxTextureUnits;
GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */
@@ -1432,6 +1413,7 @@ struct gl_extensions {
GLboolean MESA_sprite_point;
GLboolean NV_blend_square;
GLboolean NV_point_sprite;
+ GLboolean NV_texture_rectangle;
GLboolean NV_texgen_reflection;
GLboolean NV_vertex_program;
GLboolean NV_vertex_program1_1;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index d94c9c7337a..f1d83610b48 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.84 2002/06/06 16:31:24 brianp Exp $ */
+/* $Id: state.c,v 1.85 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -763,9 +763,10 @@ update_texture_matrices( GLcontext *ctx )
static void
update_texture_state( GLcontext *ctx )
{
- GLuint i;
+ GLuint unit;
- ctx->Texture._ReallyEnabled = 0;
+ ctx->Texture._ReallyEnabled = 0; /* XXX obsolete */
+ ctx->Texture._EnabledUnits = 0;
ctx->Texture._GenFlags = 0;
ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
@@ -774,8 +775,8 @@ update_texture_state( GLcontext *ctx )
/* Update texture unit state.
*/
- for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
texUnit->_ReallyEnabled = 0;
texUnit->_GenFlags = 0;
@@ -783,49 +784,60 @@ update_texture_state( GLcontext *ctx )
if (!texUnit->Enabled)
continue;
- /* Find the texture of highest dimensionality that is enabled
- * and complete. We'll use it for texturing.
+ /* Look for the highest-priority texture target that's enabled and
+ * complete. That's the one we'll use for texturing.
*/
- if (texUnit->Enabled & TEXTURE0_CUBE) {
+ if (texUnit->Enabled & TEXTURE_CUBE_BIT) {
struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_CUBE;
+ texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT;
texUnit->_Current = texObj;
}
}
- if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_3D)) {
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) {
struct gl_texture_object *texObj = texUnit->Current3D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_3D;
+ texUnit->_ReallyEnabled = TEXTURE_3D_BIT;
texUnit->_Current = texObj;
}
}
- if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) {
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) {
+ struct gl_texture_object *texObj = texUnit->CurrentRect;
+ if (!texObj->Complete) {
+ _mesa_test_texobj_completeness(ctx, texObj);
+ }
+ if (texObj->Complete) {
+ texUnit->_ReallyEnabled = TEXTURE_RECT_BIT;
+ texUnit->_Current = texObj;
+ }
+ }
+
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) {
struct gl_texture_object *texObj = texUnit->Current2D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_2D;
+ texUnit->_ReallyEnabled = TEXTURE_2D_BIT;
texUnit->_Current = texObj;
}
}
- if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_1D)) {
+ if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) {
struct gl_texture_object *texObj = texUnit->Current1D;
if (!texObj->Complete) {
_mesa_test_texobj_completeness(ctx, texObj);
}
if (texObj->Complete) {
- texUnit->_ReallyEnabled = TEXTURE0_1D;
+ texUnit->_ReallyEnabled = TEXTURE_1D_BIT;
texUnit->_Current = texObj;
}
}
@@ -835,9 +847,14 @@ update_texture_state( GLcontext *ctx )
continue;
}
+ /* Texture._ReallyEnabled records the enable state for all units in
+ * one word.
+ */
{
- GLuint flag = texUnit->_ReallyEnabled << (i * NUM_TEXTURE_TARGETS);
- ctx->Texture._ReallyEnabled |= flag;
+ GLuint flag = texUnit->_ReallyEnabled << (unit * NUM_TEXTURE_TARGETS);
+ ctx->Texture._ReallyEnabled |= flag; /* XXX obsolete field! */
+ if (texUnit->_ReallyEnabled)
+ ctx->Texture._EnabledUnits |= (1 << unit);
}
if (texUnit->TexGenEnabled) {
@@ -854,12 +871,12 @@ update_texture_state( GLcontext *ctx )
texUnit->_GenFlags |= texUnit->_GenBitR;
}
- ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(i);
+ ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
ctx->Texture._GenFlags |= texUnit->_GenFlags;
}
- if (ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
- ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
+ if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
+ ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
}
if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 342bab3aac9..2ad0df9d6ba 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.108 2002/04/23 16:44:46 brianp Exp $ */
+/* $Id: teximage.c,v 1.109 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -359,6 +359,10 @@ _mesa_set_tex_image(struct gl_texture_object *tObj,
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
tObj->NegZ[level] = texImage;
return;
+ case GL_TEXTURE_RECTANGLE_NV:
+ ASSERT(level == 0);
+ tObj->Image[level] = texImage;
+ return;
default:
_mesa_problem(NULL, "bad target in _mesa_set_tex_image()");
return;
@@ -435,6 +439,12 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
return ctx->Extensions.ARB_texture_cube_map
? ctx->Texture.ProxyCubeMap : NULL;
+ case GL_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle
+ ? texUnit->CurrentRect : NULL;
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle
+ ? ctx->Texture.ProxyRect : NULL;
default:
_mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
return NULL;
@@ -500,6 +510,22 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
return ctx->Texture.ProxyCubeMap->Image[level];
else
return NULL;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (ctx->Extensions.NV_texture_rectangle) {
+ ASSERT(level == 0);
+ return texUnit->CurrentRect->Image[level];
+ }
+ else {
+ return NULL;
+ }
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ if (ctx->Extensions.NV_texture_rectangle) {
+ ASSERT(level == 0);
+ return ctx->Texture.ProxyRect->Image[level];
+ }
+ else {
+ return NULL;
+ }
default:
_mesa_problem(ctx, "bad target in _mesa_select_tex_image()");
return NULL;
@@ -598,7 +624,7 @@ clear_teximage_fields(struct gl_texture_image *img)
* Initialize basic fields of the gl_texture_image struct.
*/
void
-_mesa_init_teximage_fields(GLcontext *ctx,
+_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat)
@@ -625,6 +651,18 @@ _mesa_init_teximage_fields(GLcontext *ctx,
img->Depth2 = 1 << img->DepthLog2;
img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
img->IsCompressed = is_compressed_format(ctx, internalFormat);
+ /* 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;
+ }
}
@@ -648,31 +686,73 @@ texture_error_check( GLcontext *ctx, GLenum target,
GLint maxLevels = 0, maxTextureSize;
if (dimensions == 1) {
- isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_1D);
- if (target != GL_TEXTURE_1D && !isProxy) {
+ if (target == GL_PROXY_TEXTURE_1D) {
+ isProxy = GL_TRUE;
+ }
+ else if (target == GL_TEXTURE_1D) {
+ isProxy = GL_FALSE;
+ }
+ else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );
return GL_TRUE;
}
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (dimensions == 2) {
- isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D ||
- target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
- if (target != GL_TEXTURE_2D && !isProxy &&
- !(ctx->Extensions.ARB_texture_cube_map &&
- target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
- target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" );
- return GL_TRUE;
- }
- if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D)
+ if (target == GL_PROXY_TEXTURE_2D) {
+ isProxy = GL_TRUE;
maxLevels = ctx->Const.MaxTextureLevels;
- else
+ }
+ else if (target == GL_TEXTURE_2D) {
+ isProxy = GL_FALSE;
+ maxLevels = ctx->Const.MaxTextureLevels;
+ }
+ else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ isProxy = GL_TRUE;
maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ isProxy = GL_FALSE;
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ isProxy = GL_TRUE;
+ maxLevels = 1;
+ }
+ else if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
+ isProxy = GL_FALSE;
+ maxLevels = 1;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)");
+ return GL_TRUE;
+ }
}
else if (dimensions == 3) {
- isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_3D);
- if (target != GL_TEXTURE_3D && !isProxy) {
+ if (target == GL_PROXY_TEXTURE_3D) {
+ isProxy = GL_TRUE;
+ }
+ else if (target == GL_TEXTURE_3D) {
+ isProxy = GL_FALSE;
+ }
+ else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" );
return GL_TRUE;
}
@@ -695,9 +775,24 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
return GL_TRUE;
}
+ if ((target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0) {
+ return GL_TRUE;
+ }
/* Width */
- if (width < 2 * border || width > 2 + maxTextureSize
+ if (target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
+ if (width < 1 || width > ctx->Const.MaxTextureRectSize) {
+ if (!isProxy) {
+ char message[100];
+ sprintf(message, "glTexImage%dD(width=%d)", dimensions, width);
+ _mesa_error(ctx, GL_INVALID_VALUE, message);
+ }
+ return GL_TRUE;
+ }
+ }
+ else if (width < 2 * border || width > 2 + maxTextureSize
|| logbase2( width - 2 * border ) < 0) {
if (!isProxy) {
char message[100];
@@ -708,7 +803,18 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
/* Height */
- if (dimensions >= 2) {
+ if (target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
+ if (height < 1 || height > ctx->Const.MaxTextureRectSize) {
+ if (!isProxy) {
+ char message[100];
+ sprintf(message, "glTexImage%dD(height=%d)", dimensions, height);
+ _mesa_error(ctx, GL_INVALID_VALUE, message);
+ }
+ return GL_TRUE;
+ }
+ }
+ else if (dimensions >= 2) {
if (height < 2 * border || height > 2 + maxTextureSize
|| logbase2( height - 2 * border ) < 0) {
if (!isProxy) {
@@ -745,7 +851,18 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
/* Level */
- if (level < 0 || level >= maxLevels) {
+ if (target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_PROXY_TEXTURE_RECTANGLE_NV) {
+ if (level != 0) {
+ if (!isProxy) {
+ char message[100];
+ sprintf(message, "glTexImage2D(level=%d)", level);
+ _mesa_error(ctx, GL_INVALID_VALUE, message);
+ }
+ return GL_TRUE;
+ }
+ }
+ else if (level < 0 || level >= maxLevels) {
if (!isProxy) {
char message[100];
sprintf(message, "glTexImage%dD(level=%d)", dimensions, level);
@@ -966,10 +1083,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (dimensions == 2) {
- if (ctx->Extensions.ARB_texture_cube_map) {
- if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB ||
- target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) &&
- target != GL_TEXTURE_2D) {
+ if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) {
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
+ return GL_TRUE;
+ }
+ }
+ else if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (!ctx->Extensions.NV_texture_rectangle) {
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
return GL_TRUE;
}
@@ -978,8 +1100,10 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" );
return GL_TRUE;
}
- if (target == GL_PROXY_TEXTURE_2D && target == GL_TEXTURE_2D)
+ if (target == GL_TEXTURE_2D)
maxLevels = ctx->Const.MaxTextureLevels;
+ else if (target == GL_TEXTURE_RECTANGLE_NV)
+ maxLevels = 1;
else
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
@@ -1211,6 +1335,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
else if (target == GL_TEXTURE_3D) {
maxLevels = ctx->Const.Max3DTextureLevels;
}
+ else if (target == GL_TEXTURE_RECTANGLE_NV) {
+ maxLevels = 1;
+ }
else {
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
@@ -1354,7 +1481,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, 1, 1,
border, internalFormat);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
@@ -1410,7 +1538,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- _mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, 1, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -1449,7 +1578,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
- target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ||
+ (ctx->Extensions.NV_texture_rectangle &&
+ target == GL_TEXTURE_RECTANGLE_NV)) {
/* non-proxy target */
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
@@ -1479,8 +1610,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, texImage, postConvWidth, postConvHeight,
- 1, border, internalFormat);
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
+ border, internalFormat);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
@@ -1527,7 +1659,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
else if (target == GL_PROXY_TEXTURE_2D ||
(target == GL_PROXY_TEXTURE_CUBE_MAP_ARB &&
- ctx->Extensions.ARB_texture_cube_map)) {
+ ctx->Extensions.ARB_texture_cube_map) ||
+ (target == GL_PROXY_TEXTURE_RECTANGLE_NV &&
+ ctx->Extensions.NV_texture_rectangle)) {
/* Proxy texture: check for errors and update proxy state */
GLenum error = texture_error_check(ctx, target, level, internalFormat,
format, type, 2,
@@ -1537,8 +1671,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- _mesa_init_teximage_fields(ctx, texImage, postConvWidth,
- postConvHeight, 1, border, internalFormat);
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
+ border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
internalFormat, format, type,
@@ -1600,8 +1735,9 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border,
- internalFormat);
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ width, height, depth,
+ border, internalFormat);
if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
@@ -1657,7 +1793,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- _mesa_init_teximage_fields(ctx, texImage, width, height, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -1871,7 +2007,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, texImage, postConvWidth, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
border, internalFormat);
@@ -1935,7 +2071,8 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, texImage, postConvWidth, postConvHeight, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ postConvWidth, postConvHeight, 1,
border, internalFormat);
ASSERT(ctx->Driver.CopyTexImage2D);
@@ -2119,7 +2256,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
texImage->Data = NULL;
}
- _mesa_init_teximage_fields(ctx, texImage, width, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
if (ctx->Extensions.ARB_texture_compression) {
@@ -2144,7 +2281,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- _mesa_init_teximage_fields(ctx, texImage, width, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -2191,7 +2328,9 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
- target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) {
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ||
+ (ctx->Extensions.NV_texture_rectangle &&
+ target == GL_TEXTURE_RECTANGLE_NV)) {
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
@@ -2218,8 +2357,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
texImage->Data = NULL;
}
- _mesa_init_teximage_fields(ctx, texImage, width, height, 1, border,
- internalFormat);
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
+ border, internalFormat);
if (ctx->Extensions.ARB_texture_compression) {
ASSERT(ctx->Driver.CompressedTexImage2D);
@@ -2243,7 +2382,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- _mesa_init_teximage_fields(ctx, texImage, width, height, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
@@ -2316,8 +2455,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
texImage->Data = NULL;
}
- _mesa_init_teximage_fields(ctx, texImage, width, height, depth, border,
- internalFormat);
+ _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth,
+ border, internalFormat);
if (ctx->Extensions.ARB_texture_compression) {
ASSERT(ctx->Driver.CompressedTexImage3D);
@@ -2342,7 +2481,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
struct gl_texture_image *texImage;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- _mesa_init_teximage_fields(ctx, texImage, width, height, depth,
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ width, height, depth,
border, internalFormat);
ASSERT(ctx->Driver.TestProxyTexImage);
error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level,
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index b86a2805127..03b052c414e 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -1,4 +1,4 @@
-/* $Id: teximage.h,v 1.20 2001/11/18 22:48:13 brianp Exp $ */
+/* $Id: teximage.h,v 1.21 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -48,7 +48,7 @@ _mesa_free_texture_image( struct gl_texture_image *teximage );
extern void
-_mesa_init_teximage_fields(GLcontext *ctx,
+_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat);
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 97140723e7c..f41bc13a171 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.54 2002/06/15 02:38:16 brianp Exp $ */
+/* $Id: texobj.c,v 1.55 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -49,17 +49,23 @@
* table.
* Input: shared - the shared GL state structure to contain the texture object
* name - integer name for the texture object
- * dimensions - either 1, 2, 3 or 6 (cube map)
+ * target - either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D,
+ * GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV
* zero is ok for the sake of GenTextures()
* Return: pointer to new texture object
*/
struct gl_texture_object *
_mesa_alloc_texture_object( struct gl_shared_state *shared,
- GLuint name, GLuint dimensions )
+ GLuint name, GLenum target )
{
struct gl_texture_object *obj;
- ASSERT(dimensions <= 3 || dimensions == 6);
+ ASSERT(target == 0 ||
+ target == GL_TEXTURE_1D ||
+ target == GL_TEXTURE_2D ||
+ target == GL_TEXTURE_3D ||
+ target == GL_TEXTURE_CUBE_MAP_ARB ||
+ target == GL_TEXTURE_RECTANGLE_NV);
obj = CALLOC_STRUCT(gl_texture_object);
@@ -68,12 +74,20 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared,
_glthread_INIT_MUTEX(obj->Mutex);
obj->RefCount = 1;
obj->Name = name;
- obj->Dimensions = dimensions;
+ obj->Target = target;
obj->Priority = 1.0F;
- obj->WrapS = GL_REPEAT;
- obj->WrapT = GL_REPEAT;
- obj->WrapR = GL_REPEAT;
- obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
+ if (target == GL_TEXTURE_RECTANGLE_NV) {
+ obj->WrapS = GL_CLAMP_TO_EDGE;
+ obj->WrapT = GL_CLAMP_TO_EDGE;
+ obj->WrapR = GL_CLAMP_TO_EDGE;
+ obj->MinFilter = GL_LINEAR;
+ }
+ else {
+ obj->WrapS = GL_REPEAT;
+ obj->WrapT = GL_REPEAT;
+ obj->WrapR = GL_REPEAT;
+ obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
+ }
obj->MagFilter = GL_LINEAR;
obj->MinLod = -1000.0;
obj->MaxLod = 1000.0;
@@ -196,24 +210,32 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
/* Compute _MaxLevel */
- if (t->Dimensions == 1) {
+ if (t->Target == GL_TEXTURE_1D) {
maxLog2 = t->Image[baseLevel]->WidthLog2;
maxLevels = ctx->Const.MaxTextureLevels;
}
- else if (t->Dimensions == 2 || t->Dimensions == 6) {
+ else if (t->Target == GL_TEXTURE_2D) {
maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2,
t->Image[baseLevel]->HeightLog2);
- maxLevels = (t->Dimensions == 2) ?
- ctx->Const.MaxTextureLevels : ctx->Const.MaxCubeTextureLevels;
+ maxLevels = ctx->Const.MaxTextureLevels;
}
- else if (t->Dimensions == 3) {
+ else if (t->Target == GL_TEXTURE_3D) {
GLint max = MAX2(t->Image[baseLevel]->WidthLog2,
t->Image[baseLevel]->HeightLog2);
maxLog2 = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2));
maxLevels = ctx->Const.Max3DTextureLevels;
}
+ else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+ maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2,
+ t->Image[baseLevel]->HeightLog2);
+ maxLevels = ctx->Const.MaxCubeTextureLevels;
+ }
+ else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
+ maxLog2 = 0; /* not applicable */
+ maxLevels = 1; /* no mipmapping */
+ }
else {
- _mesa_problem(ctx, "Bad t->Dimension in _mesa_test_texobj_completeness");
+ _mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness");
return;
}
@@ -226,7 +248,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
/* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
- if (t->Dimensions == 6) {
+ if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
/* make sure that all six cube map level 0 images are the same size */
const GLuint w = t->Image[baseLevel]->Width2;
const GLuint h = t->Image[baseLevel]->Height2;
@@ -282,7 +304,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
/* Test things which depend on number of texture image dimensions */
- if (t->Dimensions == 1) {
+ if (t->Target == GL_TEXTURE_1D) {
/* Test 1-D mipmaps */
GLuint width = t->Image[baseLevel]->Width2;
for (i = baseLevel + 1; i < maxLevels; i++) {
@@ -306,7 +328,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
- else if (t->Dimensions == 2) {
+ else if (t->Target == GL_TEXTURE_2D) {
/* Test 2-D mipmaps */
GLuint width = t->Image[baseLevel]->Width2;
GLuint height = t->Image[baseLevel]->Height2;
@@ -339,7 +361,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
- else if (t->Dimensions == 3) {
+ else if (t->Target == GL_TEXTURE_3D) {
/* Test 3-D mipmaps */
GLuint width = t->Image[baseLevel]->Width2;
GLuint height = t->Image[baseLevel]->Height2;
@@ -386,7 +408,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
- else if (t->Dimensions == 6) {
+ else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
/* make sure 6 cube faces are consistant */
GLuint width = t->Image[baseLevel]->Width2;
GLuint height = t->Image[baseLevel]->Height2;
@@ -428,8 +450,12 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
}
}
}
+ else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
+ /* XXX special checking? */
+
+ }
else {
- /* Dimensions = ??? */
+ /* Target = ??? */
_mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n");
}
}
@@ -473,8 +499,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
/* Allocate new, empty texture objects */
for (i=0;i<n;i++) {
GLuint name = first + i;
- GLuint dims = 0;
- (void) _mesa_alloc_texture_object( ctx->Shared, name, dims);
+ GLenum target = 0;
+ (void) _mesa_alloc_texture_object( ctx->Shared, name, target);
}
_glthread_UNLOCK_MUTEX(GenTexturesLock);
@@ -561,7 +587,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *oldTexObj;
struct gl_texture_object *newTexObj = 0;
- GLuint targetDim;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -570,24 +595,28 @@ _mesa_BindTexture( GLenum target, GLuint texName )
switch (target) {
case GL_TEXTURE_1D:
- targetDim = 1;
oldTexObj = texUnit->Current1D;
break;
case GL_TEXTURE_2D:
- targetDim = 2;
oldTexObj = texUnit->Current2D;
break;
case GL_TEXTURE_3D:
- targetDim = 3;
oldTexObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->Extensions.ARB_texture_cube_map) {
- targetDim = 6;
- oldTexObj = texUnit->CurrentCubeMap;
- break;
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
+ }
+ oldTexObj = texUnit->CurrentCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
}
- /* fallthrough */
+ oldTexObj = texUnit->CurrentRect;
+ break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
return;
@@ -614,6 +643,9 @@ _mesa_BindTexture( GLenum target, GLuint texName )
case GL_TEXTURE_CUBE_MAP_ARB:
newTexObj = ctx->Shared->DefaultCubeMap;
break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ newTexObj = ctx->Shared->DefaultRect;
+ break;
default:
; /* Bad targets are caught above */
}
@@ -624,23 +656,30 @@ _mesa_BindTexture( GLenum target, GLuint texName )
newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName);
if (newTexObj) {
/* error checking */
- if (newTexObj->Dimensions > 0 && newTexObj->Dimensions != targetDim) {
+ if (newTexObj->Target != 0 && newTexObj->Target != target) {
/* the named texture object's dimensions don't match the target */
_mesa_error( ctx, GL_INVALID_OPERATION,
"glBindTexture(wrong dimensionality)" );
return;
}
+ if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) {
+ /* have to init wrap and filter state here - kind of klunky */
+ newTexObj->WrapS = GL_CLAMP_TO_EDGE;
+ newTexObj->WrapT = GL_CLAMP_TO_EDGE;
+ newTexObj->WrapR = GL_CLAMP_TO_EDGE;
+ newTexObj->MinFilter = GL_LINEAR;
+ }
}
else {
/* if this is a new texture id, allocate a texture object now */
newTexObj = _mesa_alloc_texture_object( ctx->Shared, texName,
- targetDim);
+ target);
if (!newTexObj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
return;
}
}
- newTexObj->Dimensions = targetDim;
+ newTexObj->Target = target;
}
newTexObj->RefCount++;
@@ -662,8 +701,12 @@ _mesa_BindTexture( GLenum target, GLuint texName )
case GL_TEXTURE_CUBE_MAP_ARB:
texUnit->CurrentCubeMap = newTexObj;
break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ texUnit->CurrentRect = newTexObj;
+ break;
default:
_mesa_problem(ctx, "bad target in BindTexture");
+ return;
}
/* Pass BindTexture call to device driver */
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index d359aa9ba20..3257dc761fc 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -1,10 +1,10 @@
-/* $Id: texobj.h,v 1.6 2001/03/12 00:48:39 gareth Exp $ */
+/* $Id: texobj.h,v 1.7 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -39,7 +39,7 @@
extern struct gl_texture_object *
_mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
- GLuint dimensions );
+ GLenum target );
extern void
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 8319613804f..2284499bf3d 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.74 2002/06/15 02:38:16 brianp Exp $ */
+/* $Id: texstate.c,v 1.75 2002/06/15 03:03:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -967,11 +967,19 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
texObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
- if (ctx->Extensions.ARB_texture_cube_map) {
- texObj = texUnit->CurrentCubeMap;
- break;
+ if (!ctx->Extensions.ARB_texture_cube_map) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
}
- /* fallthrough */
+ texObj = texUnit->CurrentCubeMap;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ if (!ctx->Extensions.NV_texture_rectangle) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
+ return;
+ }
+ texObj = texUnit->CurrentRect;
+ break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" );
return;
@@ -983,11 +991,15 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
if (texObj->MinFilter == eparam)
return;
- if (eparam==GL_NEAREST || eparam==GL_LINEAR
- || eparam==GL_NEAREST_MIPMAP_NEAREST
- || eparam==GL_LINEAR_MIPMAP_NEAREST
- || eparam==GL_NEAREST_MIPMAP_LINEAR
- || eparam==GL_LINEAR_MIPMAP_LINEAR) {
+ if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->MinFilter = eparam;
+ }
+ else if ((eparam==GL_NEAREST_MIPMAP_NEAREST ||
+ eparam==GL_LINEAR_MIPMAP_NEAREST ||
+ eparam==GL_NEAREST_MIPMAP_LINEAR ||
+ eparam==GL_LINEAR_MIPMAP_LINEAR) &&
+ texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->MinFilter = eparam;
}
@@ -1013,13 +1025,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == eparam)
return;
- if (eparam==GL_CLAMP ||
- eparam==GL_REPEAT ||
- eparam==GL_CLAMP_TO_EDGE ||
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
- ctx->Extensions.ARB_texture_border_clamp) ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_mirrored_repeat)) {
+ ctx->Extensions.ARB_texture_border_clamp)) {
+ /* any texture target */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapS = eparam;
+ }
+ else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT_ARB &&
+ ctx->Extensions.ARB_texture_mirrored_repeat))) {
+ /* non-rectangle texture */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapS = eparam;
}
@@ -1031,13 +1048,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == eparam)
return;
- if (eparam==GL_CLAMP ||
- eparam==GL_REPEAT ||
- eparam==GL_CLAMP_TO_EDGE ||
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
- ctx->Extensions.ARB_texture_border_clamp) ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_mirrored_repeat)) {
+ ctx->Extensions.ARB_texture_border_clamp)) {
+ /* any texture target */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapT = eparam;
+ }
+ else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT_ARB &&
+ ctx->Extensions.ARB_texture_mirrored_repeat))) {
+ /* non-rectangle texture */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapT = eparam;
}
@@ -1049,13 +1071,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_R_EXT:
if (texObj->WrapR == eparam)
return;
- if (eparam==GL_CLAMP ||
- eparam==GL_REPEAT ||
- eparam==GL_CLAMP_TO_EDGE ||
+ if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER_ARB &&
- ctx->Extensions.ARB_texture_border_clamp) ||
- (eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_mirrored_repeat)) {
+ ctx->Extensions.ARB_texture_border_clamp)) {
+ /* any texture target */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texObj->WrapR = eparam;
+ }
+ else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ (eparam == GL_REPEAT ||
+ (eparam == GL_MIRRORED_REPEAT_ARB &&
+ ctx->Extensions.ARB_texture_mirrored_repeat))) {
+ /* non-rectangle texture */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapR = eparam;
}
@@ -1103,6 +1130,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
_mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
return;
}
+ if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ return;
+ }
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->BaseLevel = (GLint) params[0];
break;
@@ -1321,6 +1352,9 @@ tex_image_dimensions(GLcontext *ctx, GLenum target)
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
return ctx->Extensions.ARB_texture_cube_map ? 2 : 0;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ return ctx->Extensions.NV_texture_rectangle ? 2 : 0;
default:
_mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()");
return 0;
@@ -1358,9 +1392,17 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
case GL_PROXY_TEXTURE_3D:
maxLevels = ctx->Const.Max3DTextureLevels;
break;
- default:
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
maxLevels = ctx->Const.MaxCubeTextureLevels;
break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_PROXY_TEXTURE_RECTANGLE_NV:
+ maxLevels = 1;
+ break;
+ default:
+ _mesa_problem(ctx, "bad target in _mesa_GetTexLevelParameter");
+ return;
}
if (level < 0 || level >= maxLevels) {
@@ -1381,7 +1423,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
isProxy = (target == GL_PROXY_TEXTURE_1D) ||
(target == GL_PROXY_TEXTURE_2D) ||
(target == GL_PROXY_TEXTURE_3D) ||
- (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
+ (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) ||
+ (target == GL_PROXY_TEXTURE_RECTANGLE_NV);
switch (pname) {
case GL_TEXTURE_WIDTH:
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;