summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/array_cache/ac_context.c52
-rw-r--r--src/mesa/array_cache/ac_import.c2
-rw-r--r--src/mesa/main/arbprogram.c2
-rw-r--r--src/mesa/main/bufferobj.c135
-rw-r--r--src/mesa/main/bufferobj.h9
-rw-r--r--src/mesa/main/context.c2
-rw-r--r--src/mesa/main/get.c80
-rw-r--r--src/mesa/main/mtypes.h50
-rw-r--r--src/mesa/main/nvprogram.c2
-rw-r--r--src/mesa/main/varray.c65
-rw-r--r--src/mesa/tnl/t_imm_exec.c6
-rw-r--r--src/mesa/tnl/t_vb_program.c2
12 files changed, 273 insertions, 134 deletions
diff --git a/src/mesa/array_cache/ac_context.c b/src/mesa/array_cache/ac_context.c
index 0cd3b8b4fc..e3c09fbd20 100644
--- a/src/mesa/array_cache/ac_context.c
+++ b/src/mesa/array_cache/ac_context.c
@@ -1,4 +1,3 @@
-
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -52,6 +51,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Fallback.Color;
cl->Size = 4;
@@ -61,6 +63,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Fallback.SecondaryColor;
cl->Size = 3;
@@ -70,6 +75,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Fallback.FogCoord;
cl->Size = 1;
@@ -79,6 +87,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) &ctx->Current.Attrib[VERT_ATTRIB_FOG];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Fallback.Index;
cl->Size = 1;
@@ -88,6 +99,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) &ctx->Current.Index;
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) {
cl = &ac->Fallback.TexCoord[i];
@@ -98,6 +112,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
}
cl = &ac->Fallback.EdgeFlag;
@@ -108,6 +125,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) &ctx->Current.EdgeFlag;
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
cl = &ac->Fallback.Attrib[i];
@@ -118,6 +138,9 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Ptr = (void *) ctx->Current.Attrib[i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
}
}
@@ -140,6 +163,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Cache.Normal;
cl->Size = 3;
@@ -149,6 +175,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Cache.Color;
cl->Size = 4;
@@ -158,6 +187,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Cache.SecondaryColor;
cl->Size = 3;
@@ -167,6 +199,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Cache.FogCoord;
cl->Size = 1;
@@ -176,6 +211,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
cl = &ac->Cache.Index;
cl->Size = 1;
@@ -185,6 +223,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
cl = &ac->Cache.TexCoord[i];
@@ -195,6 +236,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
}
cl = &ac->Cache.EdgeFlag;
@@ -205,6 +249,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
for (i = 0 ; i < VERT_ATTRIB_MAX; i++) {
cl = &ac->Cache.Attrib[i];
@@ -215,6 +262,9 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
+#if FEATURE_ARB_vertex_buffer_object
+ cl->BufferObj = ctx->Array.NullBufferObj;
+#endif
}
}
diff --git a/src/mesa/array_cache/ac_import.c b/src/mesa/array_cache/ac_import.c
index ee15a6d749..b2b7eeb219 100644
--- a/src/mesa/array_cache/ac_import.c
+++ b/src/mesa/array_cache/ac_import.c
@@ -36,7 +36,7 @@
#define STRIDE_ARRAY( array, offset ) \
do { \
- char *tmp = (char *) (array).Ptr; \
+ GLubyte *tmp = (array).Ptr; \
tmp += (offset) * (array).StrideB; \
(array).Ptr = tmp; \
} while (0)
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index e5daf17960..b4ebe01399 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -135,7 +135,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)");
return;
}
- params[0] = (GLfloat) ctx->Array.VertexAttrib[index].BufferBinding;
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].BufferObj->Name;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)");
return;
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 344cf06ec4..45631c924b 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -37,20 +37,6 @@
#include "bufferobj.h"
-struct gl_buffer_object {
- GLint RefCount;
- GLuint Name;
- GLenum Target;
-
- GLenum usage;
- GLenum access;
- GLvoid * pointer;
- GLuint size;
-
- void * data;
-};
-
-
/**
* Get the buffer object bound to the specified target in a GL context.
*
@@ -69,16 +55,19 @@ buffer_object_get_target( GLcontext *ctx, GLenum target, const char * str )
switch (target) {
case GL_ARRAY_BUFFER_ARB:
- bufObj = ctx->ArrayBuffer;
+ bufObj = ctx->Array.ArrayBufferObj;
break;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
- bufObj = ctx->ElementArrayBuffer;
+ bufObj = ctx->Array.ElementArrayBufferObj;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "gl%s(target)", str);
break;
}
-
+
+ if (bufObj->Name == 0)
+ return NULL;
+
return bufObj;
}
@@ -121,13 +110,13 @@ buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
return NULL;
}
- if ( (offset + size) > bufObj->size ) {
+ if ( (offset + size) > bufObj->Size ) {
_mesa_error(ctx, GL_INVALID_VALUE,
"gl%s(size + offset > buffer size)", str);
return NULL;
}
- if ( bufObj->pointer != NULL ) {
+ if ( bufObj->Pointer != NULL ) {
_mesa_error(ctx, GL_INVALID_OPERATION, "gl%s", str);
return NULL;
}
@@ -153,6 +142,21 @@ _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
/**
+ * Delete a buffer object.
+ *
+ * This function is intended to be called via
+ * \c dd_function_table::DeleteBufferObject.
+ */
+void
+_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
+{
+ if (bufObj->Data)
+ _mesa_free(bufObj->Data);
+ _mesa_free(bufObj);
+}
+
+
+/**
* Initialize a buffer object to default values.
*/
void
@@ -220,14 +224,14 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
(void) target;
- new_data = _mesa_realloc( bufObj->data, bufObj->size, size );
+ new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
if ( new_data != NULL ) {
- bufObj->data = new_data;
- bufObj->size = size;
- bufObj->usage = usage;
+ bufObj->Data = new_data;
+ bufObj->Size = size;
+ bufObj->Usage = usage;
if ( data != NULL ) {
- _mesa_memcpy( bufObj->data, data, size );
+ _mesa_memcpy( bufObj->Data, data, size );
}
}
}
@@ -256,9 +260,9 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data,
struct gl_buffer_object * bufObj )
{
- if ( (bufObj->data != NULL)
- && ((size + offset) <= bufObj->size) ) {
- _mesa_memcpy( (GLubyte *) bufObj->data + offset, data, size );
+ if ( (bufObj->Data != NULL)
+ && ((size + offset) <= bufObj->Size) ) {
+ _mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size );
}
}
@@ -286,9 +290,9 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, GLvoid * data,
struct gl_buffer_object * bufObj )
{
- if ( (bufObj->data != NULL)
- && ((size + offset) <= bufObj->size) ) {
- _mesa_memcpy( data, (GLubyte *) bufObj->data + offset, size );
+ if ( (bufObj->Data != NULL)
+ && ((size + offset) <= bufObj->Size) ) {
+ _mesa_memcpy( data, (GLubyte *) bufObj->Data + offset, size );
}
}
@@ -313,10 +317,44 @@ void *
_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
struct gl_buffer_object * bufObj )
{
- return bufObj->data;
+ return bufObj->Data;
+}
+
+
+/**
+ * Initialize the state associated with buffer objects
+ */
+void
+_mesa_init_buffer_objects( GLcontext *ctx )
+{
+ GLuint i;
+
+ ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0);
+ ctx->Array.ArrayBufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj;
+
+ /* Vertex array buffers */
+ ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj;
+ ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj;
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+ ctx->Array.TexCoord[i].BufferObj = ctx->Array.NullBufferObj;
+ }
+ ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj;
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ ctx->Array.VertexAttrib[i].BufferObj = ctx->Array.NullBufferObj;
+ }
}
+
+/**********************************************************************/
+/* API Functions */
+/**********************************************************************/
+
void
_mesa_BindBufferARB(GLenum target, GLuint buffer)
{
@@ -333,7 +371,10 @@ _mesa_BindBufferARB(GLenum target, GLuint buffer)
* Get pointer to new buffer object (newBufObj)
*/
if ( buffer == 0 ) {
- newBufObj = NULL;
+ /* The spec says there's not a buffer object named 0, but we use
+ * one internally because it simplifies things.
+ */
+ newBufObj = ctx->Array.NullBufferObj;
}
else {
/* non-default buffer object */
@@ -363,10 +404,10 @@ _mesa_BindBufferARB(GLenum target, GLuint buffer)
switch (target) {
case GL_ARRAY_BUFFER_ARB:
- ctx->ArrayBuffer = newBufObj;
+ ctx->Array.ArrayBufferObj = newBufObj;
break;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
- ctx->ElementArrayBuffer = newBufObj;
+ ctx->Array.ElementArrayBufferObj = newBufObj;
break;
}
@@ -475,7 +516,7 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
GLuint name = first + i;
GLenum target = 0;
bufObj = (*ctx->Driver.NewBufferObject)( ctx, name, target );
- if ( bufObj != NULL ) {
+ if (!bufObj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB");
return;
}
@@ -618,18 +659,18 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
return NULL;
}
- if ( bufObj->pointer != NULL ) {
+ if ( bufObj->Pointer != NULL ) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB");
return NULL;
}
ASSERT(ctx->Driver.MapBuffer);
- bufObj->pointer = (*ctx->Driver.MapBuffer)( ctx, target, access, bufObj );
- if ( bufObj->pointer == NULL ) {
+ bufObj->Pointer = (*ctx->Driver.MapBuffer)( ctx, target, access, bufObj );
+ if ( bufObj->Pointer == NULL ) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)");
}
- return bufObj->pointer;
+ return bufObj->Pointer;
}
@@ -644,11 +685,11 @@ _mesa_UnmapBufferARB(GLenum target)
bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" );
if ( bufObj == NULL ) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB" );
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" );
return GL_FALSE;
}
- if ( bufObj->pointer == NULL ) {
+ if ( bufObj->Pointer == NULL ) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB");
return GL_FALSE;
}
@@ -657,7 +698,7 @@ _mesa_UnmapBufferARB(GLenum target)
status = (*ctx->Driver.UnmapBuffer)( ctx, target, bufObj );
}
- bufObj->pointer = NULL;
+ bufObj->Pointer = NULL;
return status;
}
@@ -678,16 +719,16 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
switch (pname) {
case GL_BUFFER_SIZE_ARB:
- *params = bufObj->size;
+ *params = bufObj->Size;
break;
case GL_BUFFER_USAGE_ARB:
- *params = bufObj->usage;
+ *params = bufObj->Usage;
break;
case GL_BUFFER_ACCESS_ARB:
- *params = bufObj->access;
+ *params = bufObj->Access;
break;
case GL_BUFFER_MAPPED_ARB:
- *params = (bufObj->pointer != NULL);
+ *params = (bufObj->Pointer != NULL);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)");
@@ -714,5 +755,5 @@ _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
return;
}
- *params = bufObj->pointer;
+ *params = bufObj->Pointer;
}
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index ca5c99cac4..dddaa52714 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -29,11 +29,17 @@
#define BUFFEROBJ_H
+#include "context.h"
+
+
/*
* Internal functions
*/
extern void
+_mesa_init_buffer_objects( GLcontext *ctx );
+
+extern void
_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target );
@@ -41,6 +47,9 @@ extern struct gl_buffer_object *
_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target );
extern void
+_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj );
+
+extern void
_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target );
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index dea778c39a..ee299cd311 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -77,6 +77,7 @@
#include "attrib.h"
#include "blend.h"
#include "buffers.h"
+#include "bufferobj.h"
#include "colortab.h"
#include "context.h"
#include "debug.h"
@@ -1092,6 +1093,7 @@ init_attrib_groups( GLcontext *ctx )
_mesa_init_accum( ctx );
_mesa_init_attrib( ctx );
_mesa_init_buffers( ctx );
+ _mesa_init_buffer_objects( ctx );
_mesa_init_color( ctx );
_mesa_init_colortables( ctx );
_mesa_init_current( ctx );
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 0105c52b67..06d7172503 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1558,44 +1558,44 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.ArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.ArrayBufferObj->Name);
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.Vertex.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Vertex.BufferObj->Name);
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.Normal.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Normal.BufferObj->Name);
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.Color.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Color.BufferObj->Name);
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.Index.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Index.BufferObj->Name);
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].BufferObj->Name);
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.EdgeFlag.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.EdgeFlag.BufferObj->Name);
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.SecondaryColor.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.BufferObj->Name);
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.FogCoord.BufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.FogCoord.BufferObj->Name);
break;
/*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.ElementArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.ElementArrayBufferObj->Name);
break;
#endif
@@ -3095,44 +3095,44 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.ArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.ArrayBufferObj->Name;
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.Vertex.BufferBinding;
+ *params = (GLdouble) ctx->Array.Vertex.BufferObj->Name;
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.Normal.BufferBinding;
+ *params = (GLdouble) ctx->Array.Normal.BufferObj->Name;
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.Color.BufferBinding;
+ *params = (GLdouble) ctx->Array.Color.BufferObj->Name;
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.Index.BufferBinding;
+ *params = (GLdouble) ctx->Array.Index.BufferObj->Name;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.TexCoord[clientUnit].BufferBinding;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.EdgeFlag.BufferBinding;
+ *params = (GLdouble) ctx->Array.EdgeFlag.BufferObj->Name;
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.SecondaryColor.BufferBinding;
+ *params = (GLdouble) ctx->Array.SecondaryColor.BufferObj->Name;
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.FogCoord.BufferBinding;
+ *params = (GLdouble) ctx->Array.FogCoord.BufferObj->Name;
break;
/*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.ElementArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.ElementArrayBufferObj->Name;
break;
#endif
@@ -4608,44 +4608,44 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.ArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.ArrayBufferObj->Name;
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.Vertex.BufferBinding;
+ *params = (GLfloat) ctx->Array.Vertex.BufferObj->Name;
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.Normal.BufferBinding;
+ *params = (GLfloat) ctx->Array.Normal.BufferObj->Name;
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.Color.BufferBinding;
+ *params = (GLfloat) ctx->Array.Color.BufferObj->Name;
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.Index.BufferBinding;
+ *params = (GLfloat) ctx->Array.Index.BufferObj->Name;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.TexCoord[clientUnit].BufferBinding;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.EdgeFlag.BufferBinding;
+ *params = (GLfloat) ctx->Array.EdgeFlag.BufferObj->Name;
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.SecondaryColor.BufferBinding;
+ *params = (GLfloat) ctx->Array.SecondaryColor.BufferObj->Name;
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.FogCoord.BufferBinding;
+ *params = (GLfloat) ctx->Array.FogCoord.BufferObj->Name;
break;
/*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.ElementArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.ElementArrayBufferObj->Name;
break;
#endif
@@ -6159,44 +6159,44 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
#if FEATURE_ARB_vertex_buffer_object
case GL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.ArrayBufferBinding;
+ *params = (GLint) ctx->Array.ArrayBufferObj->Name;
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.Vertex.BufferBinding;
+ *params = (GLint) ctx->Array.Vertex.BufferObj->Name;
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.Normal.BufferBinding;
+ *params = (GLint) ctx->Array.Normal.BufferObj->Name;
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.Color.BufferBinding;
+ *params = (GLint) ctx->Array.Color.BufferObj->Name;
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.Index.BufferBinding;
+ *params = (GLint) ctx->Array.Index.BufferObj->Name;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.TexCoord[clientUnit].BufferBinding;
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.EdgeFlag.BufferBinding;
+ *params = (GLint) ctx->Array.EdgeFlag.BufferObj->Name;
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.SecondaryColor.BufferBinding;
+ *params = (GLint) ctx->Array.SecondaryColor.BufferObj->Name;
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.FogCoord.BufferBinding;
+ *params = (GLint) ctx->Array.FogCoord.BufferObj->Name;
break;
/*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.ElementArrayBufferBinding;
+ *params = (GLint) ctx->Array.ElementArrayBufferObj->Name;
break;
#endif
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a2acb1f400..341a028ee6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1252,6 +1252,22 @@ struct gl_attrib_node {
/**
+ * GL_ARB_vertex_buffer_object buffer object
+ */
+struct gl_buffer_object {
+ GLint RefCount;
+ GLuint Name;
+ GLenum Target;
+ GLenum Usage;
+ GLenum Access;
+ GLvoid *Pointer; /**< Only valid while buffer is mapped */
+ GLuint Size; /**< Size of data array in bytes */
+ GLubyte *Data; /**< The storage */
+};
+
+
+
+/**
* Client pixel packing/unpacking attributes
*/
struct gl_pixelstore_attrib {
@@ -1279,11 +1295,13 @@ struct gl_client_array {
GLenum Type;
GLsizei Stride; /**< user-specified stride */
GLsizei StrideB; /**< actual stride in bytes */
- void *Ptr;
+ GLubyte *Ptr;
GLuint Flags;
GLuint Enabled; /**< one of the _NEW_ARRAY_ bits */
GLboolean Normalized; /**< GL_ARB_vertex_program */
- GLuint BufferBinding; /**< GL_ARB_vertex_buffer_object */
+
+ /**< GL_ARB_vertex_buffer_object */
+ struct gl_buffer_object *BufferObj;
};
@@ -1304,15 +1322,17 @@ struct gl_array_attrib {
GLint TexCoordInterleaveFactor;
GLint ActiveTexture; /**< Client Active Texture */
- GLuint LockFirst;
- GLuint LockCount;
+ GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
+ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
GLuint _Enabled; /**< _NEW_ARRAY_* - bit set if array enabled */
GLuint NewState; /**< _NEW_ARRAY_* */
- /* GL_ARB_vertex_buffer_object */
- GLuint ArrayBufferBinding;
- GLuint ElementArrayBufferBinding;
+#if FEATURE_ARB_vertex_buffer_object
+ struct gl_buffer_object *NullBufferObj;
+ struct gl_buffer_object *ArrayBufferObj;
+ struct gl_buffer_object *ElementArrayBufferObj;
+#endif
};
@@ -1589,8 +1609,9 @@ struct gl_shared_state
#endif
/*@}*/
- /** GL_ARB_vertex_buffer_objects */
+#if FEATURE_ARB_vertex_buffer_object
struct _mesa_HashTable *BufferObjects;
+#endif
void *DriverData; /**< Device driver shared state */
};
@@ -1979,7 +2000,6 @@ typedef union node Node;
/* This has to be included here. */
-struct gl_buffer_object;
#include "dd.h"
@@ -2216,18 +2236,6 @@ struct __GLcontextRec {
struct gl_tnl_module TnlModule;
/**
- * \name GL_ARB_vertex_buffer_object state
- *
- * These pointers track the buffer objects last bound via
- * \c glBindBufferObjectARB. If it the last bound object ID was 0 for a
- * given target, the pointer will be \c NULL.
- */
- /*@{*/
- struct gl_buffer_object * ArrayBuffer;
- struct gl_buffer_object * ElementArrayBuffer;
- /*@}*/
-
- /**
* \name Hooks for module contexts.
*
* These will eventually live in the driver or elsewhere.
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
index db95638e26..2fb2077287 100644
--- a/src/mesa/main/nvprogram.c
+++ b/src/mesa/main/nvprogram.c
@@ -454,7 +454,7 @@ _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params)
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
return;
}
- params[0] = ctx->Array.VertexAttrib[index].BufferBinding;
+ params[0] = ctx->Array.VertexAttrib[index].BufferObj->Name;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 14f609d31d..822935b765 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -24,17 +24,14 @@
#include "glheader.h"
+#include "imports.h"
#include "context.h"
#include "enable.h"
#include "enums.h"
#include "dlist.h"
-#include "light.h"
-#include "macros.h"
-#include "state.h"
#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
-#include "math/m_translate.h"
void
@@ -82,6 +79,9 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.Vertex.Type = type;
ctx->Array.Vertex.Stride = stride;
ctx->Array.Vertex.Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.Vertex.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
@@ -90,8 +90,6 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
}
-
-
void
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
{
@@ -134,6 +132,9 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
ctx->Array.Normal.Type = type;
ctx->Array.Normal.Stride = stride;
ctx->Array.Normal.Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.Normal.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_NORMAL;
@@ -142,7 +143,6 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
}
-
void
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
@@ -199,6 +199,9 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.Color.Type = type;
ctx->Array.Color.Stride = stride;
ctx->Array.Color.Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.Color.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_COLOR0;
@@ -207,7 +210,6 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
}
-
void
_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
{
@@ -238,6 +240,9 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.FogCoord.Type = type;
ctx->Array.FogCoord.Stride = stride;
ctx->Array.FogCoord.Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.FogCoord.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_FOGCOORD;
@@ -285,6 +290,9 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
ctx->Array.Index.Type = type;
ctx->Array.Index.Stride = stride;
ctx->Array.Index.Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.Index.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_INDEX;
@@ -350,6 +358,9 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
ctx->Array.SecondaryColor.Type = type;
ctx->Array.SecondaryColor.Stride = stride;
ctx->Array.SecondaryColor.Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.SecondaryColor.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_COLOR1;
@@ -358,7 +369,6 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
}
-
void
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr)
@@ -406,6 +416,9 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
ctx->Array.TexCoord[texUnit].Type = type;
ctx->Array.TexCoord[texUnit].Stride = stride;
ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.TexCoord[texUnit].BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_TEXCOORD(texUnit);
@@ -428,6 +441,9 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr)
ctx->Array.EdgeFlag.Stride = stride;
ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean);
ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr;
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.EdgeFlag.BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_EDGEFLAG;
@@ -436,6 +452,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr)
}
+#if FEATURE_NV_vertex_program
void
_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
GLsizei stride, const GLvoid *ptr)
@@ -489,15 +506,19 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
ctx->Array.VertexAttrib[index].Size = size;
ctx->Array.VertexAttrib[index].Type = type;
ctx->Array.VertexAttrib[index].Ptr = (void *) ptr;
-
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.VertexAttrib[index].BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
if (ctx->Driver.VertexAttribPointer)
ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
}
+#endif
+#if FEATURE_ARB_vertex_program
void
_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
GLboolean normalized,
@@ -566,7 +587,9 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
ctx->Array.VertexAttrib[index].Type = type;
ctx->Array.VertexAttrib[index].Normalized = normalized;
ctx->Array.VertexAttrib[index].Ptr = (void *) ptr;
-
+#if FEATURE_ARB_vertex_buffer_object
+ ctx->Array.VertexAttrib[index].BufferObj = ctx->Array.ArrayBufferObj;
+#endif
ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index);
@@ -575,7 +598,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
*/
}
-
+#endif
void
@@ -631,8 +654,6 @@ _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
}
-
-
void
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
{
@@ -828,7 +849,6 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
}
-
void
_mesa_LockArraysEXT(GLint first, GLsizei count)
{
@@ -875,7 +895,6 @@ _mesa_UnlockArraysEXT( void )
}
-
/* GL_EXT_multi_draw_arrays */
/* Somebody forgot to spec the first and count parameters as const! <sigh> */
void
@@ -957,9 +976,10 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
/***** Initialization *****/
/**********************************************************************/
-void _mesa_init_varray( GLcontext * ctx )
+void
+_mesa_init_varray( GLcontext * ctx )
{
- int i;
+ GLuint i;
/* Vertex arrays */
ctx->Array.Vertex.Size = 4;
@@ -1018,4 +1038,13 @@ void _mesa_init_varray( GLcontext * ctx )
ctx->Array.EdgeFlag.Enabled = GL_FALSE;
ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA;
ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
+ for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+ ctx->Array.TexCoord[i].Size = 4;
+ ctx->Array.TexCoord[i].Type = GL_FLOAT;
+ ctx->Array.TexCoord[i].Stride = 0;
+ ctx->Array.TexCoord[i].StrideB = 0;
+ ctx->Array.TexCoord[i].Ptr = NULL;
+ ctx->Array.TexCoord[i].Enabled = GL_FALSE;
+ ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA;
+ }
}
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index f1d6ee8925..85f63dd8fb 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -298,7 +298,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
}
if (inputs & VERT_BIT_COLOR1) {
- tmp->SecondaryColor.Ptr = IM->Attrib[VERT_ATTRIB_COLOR1] + start;
+ tmp->SecondaryColor.Ptr = (GLubyte *) (IM->Attrib[VERT_ATTRIB_COLOR1] + start);
VB->SecondaryColorPtr[0] = &tmp->SecondaryColor;
}
@@ -308,12 +308,12 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
if (inputs & VERT_BIT_COLOR0) {
if (IM->CopyOrFlag & VERT_BIT_COLOR0) {
- tmp->Color.Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start;
+ tmp->Color.Ptr = (GLubyte *) (IM->Attrib[VERT_ATTRIB_COLOR0] + start);
tmp->Color.StrideB = 4 * sizeof(GLfloat);
tmp->Color.Flags = 0;
}
else {
- tmp->Color.Ptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
+ tmp->Color.Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
tmp->Color.StrideB = 0;
tmp->Color.Flags = CA_CLIENT_DATA; /* hack */
VB->import_source = IM;
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 452c00620f..7fac7ec893 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -287,7 +287,7 @@ static GLboolean run_validate_program( GLcontext *ctx,
*/
static void init_color_array( struct gl_client_array *a, GLvector4f *vec )
{
- a->Ptr = vec->data;
+ a->Ptr = (GLubyte *) vec->data;
a->Size = 4;
a->Type = GL_FLOAT;
a->Stride = 0;