From 39d7524f7b176d4375e230ac60963d197be539f2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 May 2009 16:25:32 -0600 Subject: mesa: added _mesa_print_arrays() for debugging --- src/mesa/main/varray.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index a9c9162be1..8e6ef9caa5 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.2 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1032,6 +1033,50 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, } +/** + * Print vertex array's fields. + */ +static void +print_array(const char *name, GLint index, const struct gl_client_array *array) +{ + if (index >= 0) + _mesa_printf(" %s[%d]: ", name, index); + else + _mesa_printf(" %s: ", name); + _mesa_printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %u), MaxElem=%u\n", + array->Ptr, array->Type, array->Size, + array->_ElementSize, array->StrideB, + array->BufferObj->Name, array->BufferObj->Size, + array->_MaxElement); +} + + +/** + * Print current vertex object/array info. For debug. + */ +void +_mesa_print_arrays(GLcontext *ctx) +{ + const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + GLuint i; + + _mesa_printf("Array Object %u\n", arrayObj->Name); + if (arrayObj->Vertex.Enabled) + print_array("Vertex", -1, &arrayObj->Vertex); + if (arrayObj->Normal.Enabled) + print_array("Normal", -1, &arrayObj->Normal); + if (arrayObj->Color.Enabled) + print_array("Color", -1, &arrayObj->Color); + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + if (arrayObj->TexCoord[i].Enabled) + print_array("TexCoord", i, &arrayObj->TexCoord[i]); + for (i = 0; i < VERT_ATTRIB_MAX; i++) + if (arrayObj->VertexAttrib[i].Enabled) + print_array("Attrib", i, &arrayObj->VertexAttrib[i]); + _mesa_printf(" _MaxElement = %u\n", arrayObj->_MaxElement); +} + + /** * Initialize vertex array state for given context. */ -- cgit v1.2.3 From 8fe3134622eed34159ff6f72a33558a659e8d299 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:36:25 -0600 Subject: mesa: call _mesa_update_array_object_max_element() before printing array info --- src/mesa/main/varray.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 8e6ef9caa5..ac30538925 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1060,6 +1060,8 @@ _mesa_print_arrays(GLcontext *ctx) const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i; + _mesa_update_array_object_max_element(ctx, arrayObj); + _mesa_printf("Array Object %u\n", arrayObj->Name); if (arrayObj->Vertex.Enabled) print_array("Vertex", -1, &arrayObj->Vertex); -- cgit v1.2.3 From a554d7c4d87902833382cb67bd8a282d5c500c6d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:55:33 -0600 Subject: mesa: VertexAttribPointer comments --- src/mesa/main/varray.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index ac30538925..7879e0079b 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -518,6 +518,12 @@ _mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr) #if FEATURE_NV_vertex_program +/** + * Set a vertex attribute array. + * Note that these arrays DO alias the conventional GL vertex arrays + * (position, normal, color, fog, texcoord, etc). + * The generic attribute slots at #16 and above are not touched. + */ void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) @@ -578,6 +584,11 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, #if FEATURE_ARB_vertex_program +/** + * Set a generic vertex attribute array. + * Note that these arrays DO NOT alias the conventional GL vertex arrays + * (position, normal, color, fog, texcoord, etc). + */ void GLAPIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, -- cgit v1.2.3 From 6a2211f00077f49af42e6f087e3120abfb1be5ae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:55:50 -0600 Subject: mesa: remove const qualifier --- src/mesa/main/varray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 7879e0079b..ea11857a98 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1068,7 +1068,7 @@ print_array(const char *name, GLint index, const struct gl_client_array *array) void _mesa_print_arrays(GLcontext *ctx) { - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i; _mesa_update_array_object_max_element(ctx, arrayObj); -- cgit v1.2.3 From 54a5ffbfa1f935c46642a9835f08983cc1fdfeed Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 16:05:11 -0600 Subject: mesa: freshen comments for update_array() --- src/mesa/main/varray.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index ea11857a98..6bf3c485c7 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -37,15 +37,14 @@ /** - * Update the fields of a vertex array object. - * We need to do a few special things for arrays that live in - * vertex buffer objects. + * Set the fields of a vertex array. * * \param array the array to update * \param dirtyBit which bit to set in ctx->Array.NewState for this array * \param elementSize size of each array element, in bytes * \param size components per element (1, 2, 3 or 4) * \param type datatype of each component (GL_FLOAT, GL_INT, etc) + * \param format either GL_RGBA or GL_BGRA * \param stride stride between elements, in elements * \param normalized are integer types converted to floats in [-1, 1]? * \param ptr the address (or offset inside VBO) of the array data -- cgit v1.2.3 From d2a74d76c96957cf0294dcf40d29526621ada95e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 17:03:21 -0600 Subject: mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS --- src/mesa/main/varray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 6bf3c485c7..0982dc7977 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -532,7 +532,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) { + if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)"); return; } -- cgit v1.2.3 From d30163ad4201dcd5a594694ab87be9e59db47edd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:23:02 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/main/dlist.c | 4 ++-- src/mesa/main/varray.c | 4 ++-- src/mesa/vbo/vbo_context.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5120e516e0..dd73a1906b 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -6806,10 +6806,10 @@ _mesa_NewList(GLuint name, GLenum mode) /* Reset acumulated list state: */ - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(ctx->ListState.ActiveAttribSize); i++) ctx->ListState.ActiveAttribSize[i] = 0; - for (i = 0; i < MAT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(ctx->ListState.ActiveMaterialSize); i++) ctx->ListState.ActiveMaterialSize[i] = 0; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 0982dc7977..ff3128b8be 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1079,10 +1079,10 @@ _mesa_print_arrays(GLcontext *ctx) print_array("Normal", -1, &arrayObj->Normal); if (arrayObj->Color.Enabled) print_array("Color", -1, &arrayObj->Color); - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + for (i = 0; i < Elements(arrayObj->TexCoord); i++) if (arrayObj->TexCoord[i].Enabled) print_array("TexCoord", i, &arrayObj->TexCoord[i]); - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) if (arrayObj->VertexAttrib[i].Enabled) print_array("Attrib", i, &arrayObj->VertexAttrib[i]); _mesa_printf(" _MaxElement = %u\n", arrayObj->_MaxElement); diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index f193a4bf1e..90025f62fc 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -214,7 +214,7 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) for (i = 0; i < 4; i++) vbo->map_vp_none[28+i] = i; - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(vbo->map_vp_arb); i++) vbo->map_vp_arb[i] = i; } -- cgit v1.2.3