Commit bae4b315 authored by Brian Paul's avatar Brian Paul
Browse files

prototype code for vertex array sets/objects (grep for VAO)

parent e23ea371
/* $Id: context.c,v 1.79.2.5 2000/10/17 00:24:11 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -457,6 +456,9 @@ alloc_shared_state( void )
ss->DisplayList = _mesa_NewHashTable();
ss->TexObjects = _mesa_NewHashTable();
#ifdef VAO
ss->ArrayObjects = _mesa_NewHashTable();
#endif
/* Default Texture objects */
outOfMemory = GL_FALSE;
......@@ -1189,6 +1191,13 @@ init_attrib_groups( GLcontext *ctx )
ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT;
/* Vertex arrays */
#ifdef VAO
{
struct gl_array_object *arrayObj;
arrayObj = _mesa_alloc_vertex_array_object(ctx, 0);
ctx->Array.Current = arrayObj;
}
#else
ctx->Array.Vertex.Size = 4;
ctx->Array.Vertex.Type = GL_FLOAT;
ctx->Array.Vertex.Stride = 0;
......@@ -1224,6 +1233,7 @@ init_attrib_groups( GLcontext *ctx )
ctx->Array.EdgeFlag.StrideB = 0;
ctx->Array.EdgeFlag.Ptr = NULL;
ctx->Array.EdgeFlag.Enabled = GL_FALSE;
#endif
ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
/* Pixel transfer */
......
/* $Id: enable.c,v 1.21.4.2 2000/10/21 01:22:13 brianp Exp $ */
/* $Id: enable.c,v 1.21.4.3 2000/11/26 21:10:26 brianp Exp $*/
/*
* Mesa 3-D graphics library
......@@ -433,22 +433,46 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
* CLIENT STATE!!!
*/
case GL_VERTEX_ARRAY:
#ifdef VAO
ctx->Array.Current->Vertex.Enabled = state;
#else
ctx->Array.Vertex.Enabled = state;
#endif
break;
case GL_NORMAL_ARRAY:
#ifdef VAO
ctx->Array.Current->Normal.Enabled = state;
#else
ctx->Array.Normal.Enabled = state;
#endif
break;
case GL_COLOR_ARRAY:
#ifdef VAO
ctx->Array.Current->Color.Enabled = state;
#else
ctx->Array.Color.Enabled = state;
#endif
break;
case GL_INDEX_ARRAY:
#ifdef VAO
ctx->Array.Current->Index.Enabled = state;
#else
ctx->Array.Index.Enabled = state;
#endif
break;
case GL_TEXTURE_COORD_ARRAY:
#ifdef VAO
ctx->Array.Current->TexCoord[ctx->Array.ActiveTexture].Enabled = state;
#else
ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state;
#endif
break;
case GL_EDGE_FLAG_ARRAY:
#ifdef VAO
ctx->Array.Current->EdgeFlag.Enabled = state;
#else
ctx->Array.EdgeFlag.Enabled = state;
#endif
break;
/* GL_HP_occlusion_test */
......@@ -701,17 +725,41 @@ _mesa_IsEnabled( GLenum cap )
* CLIENT STATE!!!
*/
case GL_VERTEX_ARRAY:
#ifdef VAO
return ctx->Array.Current->Vertex.Enabled;
#else
return ctx->Array.Vertex.Enabled;
#endif
case GL_NORMAL_ARRAY:
#ifdef VAO
return ctx->Array.Current->Normal.Enabled;
#else
return ctx->Array.Normal.Enabled;
#endif
case GL_COLOR_ARRAY:
#ifdef VAO
return ctx->Array.Current->Color.Enabled;
#else
return ctx->Array.Color.Enabled;
#endif
case GL_INDEX_ARRAY:
#ifdef VAO
return ctx->Array.Current->Index.Enabled;
#else
return ctx->Array.Index.Enabled;
#endif
case GL_TEXTURE_COORD_ARRAY:
#ifdef VAO
return ctx->Array.Current->TexCoord[ctx->Array.ActiveTexture].Enabled;
#else
return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
#endif
case GL_EDGE_FLAG_ARRAY:
#ifdef VAO
return ctx->Array.Current->EdgeFlag.Enabled;
#else
return ctx->Array.EdgeFlag.Enabled;
#endif
/* GL_HP_occlusion_test */
case GL_OCCLUSION_TEST_HP:
......@@ -777,22 +825,46 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state )
switch (cap) {
case GL_VERTEX_ARRAY:
#ifdef VAO
ctx->Array.Current->Vertex.Enabled = state;
#else
ctx->Array.Vertex.Enabled = state;
#endif
break;
case GL_NORMAL_ARRAY:
#ifdef VAO
ctx->Array.Current->Normal.Enabled = state;
#else
ctx->Array.Normal.Enabled = state;
#endif
break;
case GL_COLOR_ARRAY:
#ifdef VAO
ctx->Array.Current->Color.Enabled = state;
#else
ctx->Array.Color.Enabled = state;
#endif
break;
case GL_INDEX_ARRAY:
#ifdef VAO
ctx->Array.Current->Index.Enabled = state;
#else
ctx->Array.Index.Enabled = state;
#endif
break;
case GL_TEXTURE_COORD_ARRAY:
#ifdef VAO
ctx->Array.Current->TexCoord[ctx->Array.ActiveTexture].Enabled = state;
#else
ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state;
#endif
break;
case GL_EDGE_FLAG_ARRAY:
#ifdef VAO
ctx->Array.Current->EdgeFlag.Enabled = state;
#else
ctx->Array.EdgeFlag.Enabled = state;
#endif
break;
default:
gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
......
This diff is collapsed.
/* $Id: hash.c,v 1.9 2000/03/21 22:20:42 brianp Exp $ */
/* $Id: hash.c,v 1.9.4.1 2000/11/26 21:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
......@@ -101,7 +101,6 @@ void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key)
const struct HashEntry *entry;
assert(table);
assert(key);
pos = key & (TABLE_SIZE-1);
entry = table->Table[pos];
......@@ -130,7 +129,6 @@ void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
struct HashEntry *entry;
assert(table);
assert(key);
_glthread_LOCK_MUTEX(table->Mutex);
......@@ -172,7 +170,6 @@ void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
struct HashEntry *entry, *prev;
assert(table);
assert(key);
_glthread_LOCK_MUTEX(table->Mutex);
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment