summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-09-17 18:15:13 +0000
committerBrian Paul <[email protected]>2003-09-17 18:15:13 +0000
commitd2afb39d1997e9f2e3c64fc9fa49393e2839d8a1 (patch)
treed28d90c58f3ef69237fd2a7e6801b46ab71458ae /src/mesa/tnl
parent1a5709dc5bb5dcb0dbb1b0e6c7b058c7a3039f16 (diff)
Implement GL_ELEMENT_ARRAY_BUFFER_ARB for buffer objects.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_array_api.c22
-rw-r--r--src/mesa/tnl/t_array_import.c29
2 files changed, 49 insertions, 2 deletions
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index 95bc293beef..229371fc0a9 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -62,8 +62,14 @@ static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count,
{
if (_tnl_hard_begin(ctx, mode)) {
GLint i;
- for (i = 0 ; i < count ; i++)
- glArrayElement( indices[i] );
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ /* use indices in the buffer object */
+ ASSERT(ctx->Array.ElementArrayBufferObj->Data);
+ indices = (const GLuint *) ctx->Array.ElementArrayBufferObj->Data;
+ }
+ for (i = 0 ; i < count ; i++) {
+ glArrayElement( indices[i] );
+ }
glEnd();
}
}
@@ -260,6 +266,12 @@ _tnl_DrawRangeElements(GLenum mode,
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count);
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ /* use indices in the buffer object */
+ ASSERT(ctx->Array.ElementArrayBufferObj->Data);
+ indices = (GLuint *) ctx->Array.ElementArrayBufferObj->Data;
+ }
+
/* Check arguments, etc.
*/
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
@@ -327,6 +339,12 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type,
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(NULL, "_tnl_DrawElements %d\n", count);
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ /* use indices in the buffer object */
+ ASSERT(ctx->Array.ElementArrayBufferObj->Data);
+ indices = (const GLvoid *) ctx->Array.ElementArrayBufferObj->Data;
+ }
+
/* Check arguments, etc.
*/
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c
index ab11f50c8fe..0a8197c10a4 100644
--- a/src/mesa/tnl/t_array_import.c
+++ b/src/mesa/tnl/t_array_import.c
@@ -56,7 +56,12 @@ static void _tnl_import_vertex( GLcontext *ctx,
writeable,
&is_writeable);
+#if 0
+ /* guess we really don't need to add pointers here - BP */
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->Obj.data = (GLfloat (*)[4]) data;
inputs->Obj.start = (GLfloat *) data;
inputs->Obj.stride = tmp->StrideB;
@@ -81,7 +86,11 @@ static void _tnl_import_normal( GLcontext *ctx,
stride ? 3*sizeof(GLfloat) : 0, writeable,
&is_writeable);
+#if 0
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->Normal.data = (GLfloat (*)[4]) data;
inputs->Normal.start = (GLfloat *) data;
inputs->Normal.stride = tmp->StrideB;
@@ -145,7 +154,11 @@ static void _tnl_import_fogcoord( GLcontext *ctx,
stride ? sizeof(GLfloat) : 0, writeable,
&is_writeable);
+#if 0
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->FogCoord.data = (GLfloat (*)[4]) data;
inputs->FogCoord.start = (GLfloat *) data;
inputs->FogCoord.stride = tmp->StrideB;
@@ -169,7 +182,11 @@ static void _tnl_import_index( GLcontext *ctx,
stride ? sizeof(GLuint) : 0, writeable,
&is_writeable);
+#if 0
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->Index.data = (GLuint *) data;
inputs->Index.start = (GLuint *) data;
inputs->Index.stride = tmp->StrideB;
@@ -197,7 +214,11 @@ static void _tnl_import_texcoord( GLcontext *ctx,
writeable,
&is_writeable);
+#if 0
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->TexCoord[unit].data = (GLfloat (*)[4]) data;
inputs->TexCoord[unit].start = (GLfloat *) data;
inputs->TexCoord[unit].stride = tmp->StrideB;
@@ -224,7 +245,11 @@ static void _tnl_import_edgeflag( GLcontext *ctx,
0,
&is_writeable);
+#if 0
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->EdgeFlag.data = (GLubyte *) data;
inputs->EdgeFlag.start = (GLubyte *) data;
inputs->EdgeFlag.stride = tmp->StrideB;
@@ -253,7 +278,11 @@ static void _tnl_import_attrib( GLcontext *ctx,
writeable,
&is_writeable);
+#if 0
data = ADD_POINTERS(tmp->Ptr, tmp->BufferObj->Data);
+#else
+ data = tmp->Ptr;
+#endif
inputs->Attribs[index].data = (GLfloat (*)[4]) data;
inputs->Attribs[index].start = (GLfloat *) data;
inputs->Attribs[index].stride = tmp->StrideB;