summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c53
1 files changed, 43 insertions, 10 deletions
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)