summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/arbprogram.c6
-rw-r--r--src/mesa/main/bufferobj.c47
-rw-r--r--src/mesa/main/config.h1
-rw-r--r--src/mesa/main/get.c132
-rw-r--r--src/mesa/main/mtypes.h11
-rw-r--r--src/mesa/main/nvprogram.c2
6 files changed, 98 insertions, 101 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 6803f4d4d6..e5daf17960 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -130,6 +130,12 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params)
FLUSH_CURRENT(ctx, 0);
COPY_4V(params, ctx->Current.Attrib[index]);
break;
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
+ if (!ctx->Extensions.ARB_vertex_buffer_object) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)");
+ return;
+ }
+ params[0] = (GLfloat) ctx->Array.VertexAttrib[index].BufferBinding;
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 8fcc47699d..344cf06ec4 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -26,7 +26,7 @@
/**
* \file bufferobj.c
* \brief Functions for the GL_ARB_vertex_buffer_object extension.
- * \author Brian Paul
+ * \author Brian Paul, Ian Romanick
*/
@@ -146,7 +146,7 @@ struct gl_buffer_object *
_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
{
struct gl_buffer_object *obj;
- obj = CALLOC_STRUCT(gl_buffer_object);
+ obj = MALLOC_STRUCT(gl_buffer_object);
_mesa_initialize_buffer_object(obj, name, target);
return obj;
}
@@ -159,6 +159,7 @@ void
_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target )
{
+ _mesa_bzero(obj, sizeof(struct gl_buffer_object));
obj->RefCount = 1;
obj->Name = name;
}
@@ -226,7 +227,7 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
bufObj->usage = usage;
if ( data != NULL ) {
- memcpy( bufObj->data, data, size );
+ _mesa_memcpy( bufObj->data, data, size );
}
}
}
@@ -257,7 +258,7 @@ _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
{
if ( (bufObj->data != NULL)
&& ((size + offset) <= bufObj->size) ) {
- memcpy( (GLubyte *) bufObj->data + offset, data, size );
+ _mesa_memcpy( (GLubyte *) bufObj->data + offset, data, size );
}
}
@@ -287,7 +288,7 @@ _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
{
if ( (bufObj->data != NULL)
&& ((size + offset) <= bufObj->size) ) {
- memcpy( data, (GLubyte *) bufObj->data + offset, size );
+ _mesa_memcpy( data, (GLubyte *) bufObj->data + offset, size );
}
}
@@ -468,12 +469,7 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
- /* Return the buffer names */
- for (i=0;i<n;i++) {
- buffer[i] = first + i;
- }
-
- /* Allocate new, empty buffer objects */
+ /* Allocate new, empty buffer objects and return identifiers */
for (i = 0; i < n; i++) {
struct gl_buffer_object *bufObj;
GLuint name = first + i;
@@ -484,6 +480,7 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
return;
}
_mesa_save_buffer_object(ctx, bufObj);
+ buffer[i] = first + i;
}
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
@@ -547,6 +544,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
bufObj = buffer_object_get_target( ctx, target, "BufferDataARB" );
if ( bufObj == NULL ) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB" );
return;
}
@@ -566,11 +564,14 @@ _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
- "BufferSubDataARB" );
- if ( bufObj != NULL ) {
- ASSERT(ctx->Driver.BufferSubData);
- (*ctx->Driver.BufferSubData)( ctx, target, offset, size, data, bufObj );
+ "glBufferSubDataARB" );
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB" );
+ return;
}
+
+ ASSERT(ctx->Driver.BufferSubData);
+ (*ctx->Driver.BufferSubData)( ctx, target, offset, size, data, bufObj );
}
@@ -583,11 +584,13 @@ _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
- "GetBufferSubDataARB" );
- if ( bufObj != NULL ) {
- ASSERT(ctx->Driver.GetBufferSubData);
- (*ctx->Driver.GetBufferSubData)( ctx, target, offset, size, data, bufObj );
+ "glGetBufferSubDataARB" );
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferSubDataARB" );
+ return;
}
+ ASSERT(ctx->Driver.GetBufferSubData);
+ (*ctx->Driver.GetBufferSubData)( ctx, target, offset, size, data, bufObj );
}
@@ -611,6 +614,7 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
bufObj = buffer_object_get_target( ctx, target, "MapBufferARB" );
if ( bufObj == NULL ) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB" );
return NULL;
}
@@ -640,6 +644,7 @@ _mesa_UnmapBufferARB(GLenum target)
bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" );
if ( bufObj == NULL ) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferSubDataARB" );
return GL_FALSE;
}
@@ -666,7 +671,8 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
ASSERT_OUTSIDE_BEGIN_END(ctx);
bufObj = buffer_object_get_target( ctx, target, "GetBufferParameterivARB" );
- if ( bufObj == NULL ) {
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameterivARB" );
return;
}
@@ -704,6 +710,7 @@ _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
bufObj = buffer_object_get_target( ctx, target, "GetBufferPointervARB" );
if ( bufObj == NULL ) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" );
return;
}
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index bbffcd05be..d4c3cf5df8 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -256,6 +256,7 @@
#define FEATURE_ARB_vertex_program 1
#define FEATURE_ARB_fragment_program 1
#define FEATURE_ARB_occlusion_query 1
+#define FEATURE_ARB_vertex_buffer_object 1
#define FEATURE_MESA_program_debug 1
#define FEATURE_NV_fence 1
#define FEATURE_userclip 1
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 29cc14636d..98a60ca20e 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -138,7 +138,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -1003,16 +1004,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(0);
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = ctx->Array.TexCoord[texUnit].Enabled;
+ *params = ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Size);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].Size);
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ENUM_TO_BOOL(ctx->Array.TexCoord[texUnit].Type);
+ *params = ENUM_TO_BOOL(ctx->Array.TexCoord[clientUnit].Type);
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Stride);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].Stride);
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = INT_TO_BOOL(0);
@@ -1561,40 +1562,37 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.VertexArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Vertex.BufferBinding);
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.NormalArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Normal.BufferBinding);
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.ColorArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Color.BufferBinding);
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.IndexArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.Index.BufferBinding);
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.TextureArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].BufferBinding);
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.EdgeFlagArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.EdgeFlag.BufferBinding);
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.SecondaryColorArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.BufferBinding);
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.FogCoordArrayBufferBinding);
- break;
- case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
- CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
- *params = INT_TO_BOOL(ctx->Array.WeightArrayBufferBinding);
+ *params = INT_TO_BOOL(ctx->Array.FogCoord.BufferBinding);
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);
@@ -1683,7 +1681,8 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -2544,16 +2543,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = 0.0;
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = (GLdouble) ctx->Array.TexCoord[texUnit].Enabled;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = (GLdouble) ctx->Array.TexCoord[texUnit].Size;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Size;
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[texUnit].Type);
+ *params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[clientUnit].Type);
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = (GLdouble) ctx->Array.TexCoord[texUnit].Stride;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Stride;
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = 0.0;
@@ -3100,40 +3099,37 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.VertexArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.Vertex.BufferBinding;
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.NormalArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.Normal.BufferBinding;
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.ColorArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.Color.BufferBinding;
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.IndexArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.Index.BufferBinding;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.TextureArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].BufferBinding;
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.EdgeFlagArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.EdgeFlag.BufferBinding;
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.SecondaryColorArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.SecondaryColor.BufferBinding;
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.FogCoordArrayBufferBinding;
- break;
- case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
- CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
- *params = (GLdouble) ctx->Array.WeightArrayBufferBinding;
+ *params = (GLdouble) ctx->Array.FogCoord.BufferBinding;
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;
@@ -3222,7 +3218,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -4085,16 +4082,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = 0.0;
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = (GLfloat) ctx->Array.TexCoord[texUnit].Enabled;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = (GLfloat) ctx->Array.TexCoord[texUnit].Size;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Size;
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ENUM_TO_FLOAT(ctx->Array.TexCoord[texUnit].Type);
+ *params = ENUM_TO_FLOAT(ctx->Array.TexCoord[clientUnit].Type);
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = (GLfloat) ctx->Array.TexCoord[texUnit].Stride;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Stride;
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = 0.0;
@@ -4615,40 +4612,37 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.VertexArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.Vertex.BufferBinding;
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.NormalArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.Normal.BufferBinding;
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.ColorArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.Color.BufferBinding;
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.IndexArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.Index.BufferBinding;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.TextureArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].BufferBinding;
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.EdgeFlagArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.EdgeFlag.BufferBinding;
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.SecondaryColorArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.SecondaryColor.BufferBinding;
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.FogCoordArrayBufferBinding;
- break;
- case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
- CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
- *params = (GLfloat) ctx->Array.WeightArrayBufferBinding;
+ *params = (GLfloat) ctx->Array.FogCoord.BufferBinding;
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;
@@ -4737,7 +4731,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -5599,16 +5594,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = 0;
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = (GLint) ctx->Array.TexCoord[texUnit].Enabled;
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = ctx->Array.TexCoord[texUnit].Size;
+ *params = ctx->Array.TexCoord[clientUnit].Size;
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ctx->Array.TexCoord[texUnit].Type;
+ *params = ctx->Array.TexCoord[clientUnit].Type;
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = ctx->Array.TexCoord[texUnit].Stride;
+ *params = ctx->Array.TexCoord[clientUnit].Stride;
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = 0;
@@ -6168,40 +6163,37 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.VertexArrayBufferBinding;
+ *params = (GLint) ctx->Array.Vertex.BufferBinding;
break;
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.NormalArrayBufferBinding;
+ *params = (GLint) ctx->Array.Normal.BufferBinding;
break;
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.ColorArrayBufferBinding;
+ *params = (GLint) ctx->Array.Color.BufferBinding;
break;
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.IndexArrayBufferBinding;
+ *params = (GLint) ctx->Array.Index.BufferBinding;
break;
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.TextureArrayBufferBinding;
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].BufferBinding;
break;
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.EdgeFlagArrayBufferBinding;
+ *params = (GLint) ctx->Array.EdgeFlag.BufferBinding;
break;
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.SecondaryColorArrayBufferBinding;
+ *params = (GLint) ctx->Array.SecondaryColor.BufferBinding;
break;
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.FogCoordArrayBufferBinding;
- break;
- case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
- CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
- *params = (GLint) ctx->Array.WeightArrayBufferBinding;
+ *params = (GLint) ctx->Array.FogCoord.BufferBinding;
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;
@@ -6288,7 +6280,7 @@ void
_mesa_GetPointerv( GLenum pname, GLvoid **params )
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
@@ -6321,7 +6313,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
*params = ctx->Array.Index.Ptr;
break;
case GL_TEXTURE_COORD_ARRAY_POINTER:
- *params = ctx->Array.TexCoord[texUnit].Ptr;
+ *params = ctx->Array.TexCoord[clientUnit].Ptr;
break;
case GL_EDGE_FLAG_ARRAY_POINTER:
*params = ctx->Array.EdgeFlag.Ptr;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3abf6ea4ac..a2acb1f400 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1283,6 +1283,7 @@ struct gl_client_array {
GLuint Flags;
GLuint Enabled; /**< one of the _NEW_ARRAY_ bits */
GLboolean Normalized; /**< GL_ARB_vertex_program */
+ GLuint BufferBinding; /**< GL_ARB_vertex_buffer_object */
};
@@ -1311,17 +1312,7 @@ struct gl_array_attrib {
/* GL_ARB_vertex_buffer_object */
GLuint ArrayBufferBinding;
- GLuint VertexArrayBufferBinding;
- GLuint NormalArrayBufferBinding;
- GLuint ColorArrayBufferBinding;
- GLuint IndexArrayBufferBinding;
- GLuint TextureArrayBufferBinding;
- GLuint EdgeFlagArrayBufferBinding;
- GLuint SecondaryColorArrayBufferBinding;
- GLuint FogCoordArrayBufferBinding;
- GLuint WeightArrayBufferBinding;
GLuint ElementArrayBufferBinding;
- GLuint VertexAttribArrayBufferBinding[VERT_ATTRIB_MAX];
};
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
index a4af0eb80a..db95638e26 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.VertexAttribArrayBufferBinding[index];
+ params[0] = ctx->Array.VertexAttrib[index].BufferBinding;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV");