X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fvbo%2Fvbo_exec_api.c;h=f0a7eeadd0f8194a05d34929c0833ff52a066b63;hb=395e08a839bca94b8c0cd7fca4b48bb06bc02952;hp=bfa6d76886a36ad5c207895d51638e133befe5e8;hpb=cef97267d696d37f4dccb22951499ca25d5d87ad;p=mesa.git diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index bfa6d76886a..f0a7eeadd0f 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -57,7 +57,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. static void reset_attrfv( struct vbo_exec_context *exec ); -/* Close off the last primitive, execute the buffer, restart the +/** + * Close off the last primitive, execute the buffer, restart the * primitive. */ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec ) @@ -106,7 +107,8 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec ) } -/* Deal with buffer wrapping where provoked by the vertex buffer +/** + * Deal with buffer wrapping where provoked by the vertex buffer * filling up, as opposed to upgrade_vertex(). */ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ) @@ -135,7 +137,7 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ) } -/* +/** * Copy the active vertex's values to the ctx->Current fields. */ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) @@ -208,7 +210,8 @@ static void vbo_exec_copy_from_current( struct vbo_exec_context *exec ) } -/* Flush existing data, set new attrib size, replay copied vertices. +/** + * Flush existing data, set new attrib size, replay copied vertices. */ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec, GLuint attr, @@ -392,8 +395,7 @@ do { \ #if FEATURE_evaluators -/* Eval - */ + static void GLAPIENTRY vbo_exec_EvalCoord1f( GLfloat u ) { GET_CURRENT_CONTEXT( ctx ); @@ -492,8 +494,8 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) #endif /* FEATURE_evaluators */ -/* Build a list of primitives on the fly. Keep - * ctx->Driver.CurrentExecPrimitive uptodate as well. +/** + * Called via glBegin. */ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) { @@ -537,6 +539,10 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) } + +/** + * Called via glEnd. + */ static void GLAPIENTRY vbo_exec_End( void ) { GET_CURRENT_CONTEXT( ctx ); @@ -784,8 +790,14 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) _mesa_install_exec_vtxfmt( exec->ctx, &exec->vtxfmt ); for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) { + ASSERT(i < Elements(exec->vtx.attrsz)); exec->vtx.attrsz[i] = 0; + ASSERT(i < Elements(exec->vtx.active_sz)); exec->vtx.active_sz[i] = 0; + } + for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { + ASSERT(i < Elements(exec->vtx.inputs)); + ASSERT(i < Elements(exec->vtx.arrays)); exec->vtx.inputs[i] = &exec->vtx.arrays[i]; } @@ -855,15 +867,27 @@ void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ) } - +/** + * \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT + */ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; +#ifdef DEBUG + /* debug check: make sure we don't get called recursively */ + exec->flush_call_depth++; + assert(exec->flush_call_depth == 1); +#endif + if (0) _mesa_printf("%s\n", __FUNCTION__); if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { if (0) _mesa_printf("%s - inside begin/end\n", __FUNCTION__); +#ifdef DEBUG + exec->flush_call_depth--; + assert(exec->flush_call_depth == 0); +#endif return; } @@ -877,6 +901,11 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) } exec->ctx->Driver.NeedFlush &= ~flags; + +#ifdef DEBUG + exec->flush_call_depth--; + assert(exec->flush_call_depth == 0); +#endif }