diff options
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r-- | src/mesa/main/varray.c | 90 |
1 files changed, 13 insertions, 77 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 97b02142936..47c13a3eea0 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -31,6 +31,7 @@ #include "enums.h" #include "mtypes.h" #include "varray.h" +#include "arrayobj.h" #include "dispatch.h" #ifndef GL_BOOLEAN @@ -119,7 +120,7 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.Vertex, _NEW_ARRAY_VERTEX, + update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX, elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.VertexPointer) @@ -164,7 +165,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) return; } - update_array(ctx, &ctx->Array.Normal, _NEW_ARRAY_NORMAL, + update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL, elementSize, 3, type, stride, GL_TRUE, ptr); if (ctx->Driver.NormalPointer) @@ -222,7 +223,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.Color, _NEW_ARRAY_COLOR0, + update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0, elementSize, size, type, stride, GL_TRUE, ptr); if (ctx->Driver.ColorPointer) @@ -254,7 +255,7 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.FogCoord, _NEW_ARRAY_FOGCOORD, + update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD, elementSize, 1, type, stride, GL_FALSE, ptr); if (ctx->Driver.FogCoordPointer) @@ -295,7 +296,7 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.Index, _NEW_ARRAY_INDEX, + update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX, elementSize, 1, type, stride, GL_FALSE, ptr); if (ctx->Driver.IndexPointer) @@ -354,7 +355,7 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, return; } - update_array(ctx, &ctx->Array.SecondaryColor, _NEW_ARRAY_COLOR1, + update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1, elementSize, size, type, stride, GL_TRUE, ptr); if (ctx->Driver.SecondaryColorPointer) @@ -403,7 +404,7 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - update_array(ctx, &ctx->Array.TexCoord[unit], _NEW_ARRAY_TEXCOORD(unit), + update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit], _NEW_ARRAY_TEXCOORD(unit), elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.TexCoordPointer) @@ -422,7 +423,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) return; } - update_array(ctx, &ctx->Array.EdgeFlag, _NEW_ARRAY_EDGEFLAG, + update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG, sizeof(GLboolean), 1, GL_BOOLEAN, stride, GL_FALSE, ptr); if (ctx->Driver.EdgeFlagPointer) @@ -479,7 +480,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, return; } - update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), + update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), elementSize, size, type, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) @@ -550,7 +551,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, return; } - update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), + update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), elementSize, size, type, stride, normalized, ptr); /* XXX fix @@ -923,73 +924,8 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, void _mesa_init_varray(GLcontext *ctx) { - GLuint i; - - /* Vertex arrays */ - ctx->Array.Vertex.Size = 4; - ctx->Array.Vertex.Type = GL_FLOAT; - ctx->Array.Vertex.Stride = 0; - ctx->Array.Vertex.StrideB = 0; - ctx->Array.Vertex.Ptr = NULL; - ctx->Array.Vertex.Enabled = GL_FALSE; - ctx->Array.Vertex.Flags = CA_CLIENT_DATA; - ctx->Array.Normal.Type = GL_FLOAT; - ctx->Array.Normal.Stride = 0; - ctx->Array.Normal.StrideB = 0; - ctx->Array.Normal.Ptr = NULL; - ctx->Array.Normal.Enabled = GL_FALSE; - ctx->Array.Normal.Flags = CA_CLIENT_DATA; - ctx->Array.Color.Size = 4; - ctx->Array.Color.Type = GL_FLOAT; - ctx->Array.Color.Stride = 0; - ctx->Array.Color.StrideB = 0; - ctx->Array.Color.Ptr = NULL; - ctx->Array.Color.Enabled = GL_FALSE; - ctx->Array.Color.Flags = CA_CLIENT_DATA; - ctx->Array.SecondaryColor.Size = 4; - ctx->Array.SecondaryColor.Type = GL_FLOAT; - ctx->Array.SecondaryColor.Stride = 0; - ctx->Array.SecondaryColor.StrideB = 0; - ctx->Array.SecondaryColor.Ptr = NULL; - ctx->Array.SecondaryColor.Enabled = GL_FALSE; - ctx->Array.SecondaryColor.Flags = CA_CLIENT_DATA; - ctx->Array.FogCoord.Size = 1; - ctx->Array.FogCoord.Type = GL_FLOAT; - ctx->Array.FogCoord.Stride = 0; - ctx->Array.FogCoord.StrideB = 0; - ctx->Array.FogCoord.Ptr = NULL; - ctx->Array.FogCoord.Enabled = GL_FALSE; - ctx->Array.FogCoord.Flags = CA_CLIENT_DATA; - ctx->Array.Index.Type = GL_FLOAT; - ctx->Array.Index.Stride = 0; - ctx->Array.Index.StrideB = 0; - ctx->Array.Index.Ptr = NULL; - ctx->Array.Index.Enabled = GL_FALSE; - ctx->Array.Index.Flags = CA_CLIENT_DATA; - for (i = 0; i < MAX_TEXTURE_UNITS; 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; - } - ctx->Array.EdgeFlag.Stride = 0; - ctx->Array.EdgeFlag.StrideB = 0; - ctx->Array.EdgeFlag.Ptr = NULL; - ctx->Array.EdgeFlag.Enabled = GL_FALSE; - ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA; - for (i = 0; i < VERT_ATTRIB_MAX; i++) { - ctx->Array.VertexAttrib[i].Size = 4; - ctx->Array.VertexAttrib[i].Type = GL_FLOAT; - ctx->Array.VertexAttrib[i].Stride = 0; - ctx->Array.VertexAttrib[i].StrideB = 0; - ctx->Array.VertexAttrib[i].Ptr = NULL; - ctx->Array.VertexAttrib[i].Enabled = GL_FALSE; - ctx->Array.VertexAttrib[i].Normalized = GL_FALSE; - ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA; - } + ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); + ctx->Array.ArrayObj = ctx->Array.DefaultArrayObj; ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ } |