/** * Called via glArrayElement() and glDrawArrays(). * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions * for all enabled vertex arrays (for elt-th element). * Note: this may be called during display list construction. */ void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) { GET_CURRENT_CONTEXT(ctx); const AEcontext *actx = AE_CONTEXT(ctx); const AEarray *aa; const AEattrib *at; if (actx->NewState) _ae_update_state( ctx ); /* generic attributes */ for (at = actx->attribs; at->func; at++) { const GLubyte *src = at->array->BufferObj->Data + (unsigned long) at->array->Ptr + elt * at->array->StrideB; at->func( at->index, src ); } /* conventional arrays */ for (aa = actx->arrays; aa->func ; aa++) { const GLubyte *src = aa->array->BufferObj->Data + (unsigned long) aa->array->Ptr + elt * aa->array->StrideB; aa->func( src ); } }
/** * Called via glArrayElement() and glDrawArrays(). * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions * for all enabled vertex arrays (for elt-th element). * Note: this may be called during display list construction. */ void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) { GET_CURRENT_CONTEXT(ctx); const AEcontext *actx = AE_CONTEXT(ctx); const AEarray *aa; const AEattrib *at; const struct _glapi_table * const disp = GET_DISPATCH(); if (actx->NewState) _ae_update_state( ctx ); /* generic attributes */ for (at = actx->attribs; at->func; at++) { const GLubyte *src = ADD_POINTERS(at->array->BufferObj->Data, at->array->Ptr) + elt * at->array->StrideB; at->func( at->index, src ); } /* conventional arrays */ for (aa = actx->arrays; aa->offset != -1 ; aa++) { const GLubyte *src = ADD_POINTERS(aa->array->BufferObj->Data, aa->array->Ptr) + elt * aa->array->StrideB; CALL_by_offset( disp, (array_func), aa->offset, ((const void *) src) ); } }
void _ae_map_vbos( GLcontext *ctx ) { AEcontext *actx = AE_CONTEXT(ctx); GLuint i; if (actx->mapped_vbos) return; if (actx->NewState) _ae_update_state(ctx); for (i = 0; i < actx->nr_vbos; i++) ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB, GL_DYNAMIC_DRAW_ARB, actx->vbo[i]); if (actx->nr_vbos) actx->mapped_vbos = GL_TRUE; }
/** * Before replaying glArrayElements calls we need to map (for reading) any * VBOs referenced by the enabled vertex arrays. */ void _ae_map_vbos(struct gl_context *ctx) { AEcontext *actx = AE_CONTEXT(ctx); GLuint i; if (actx->mapped_vbos) return; if (actx->NewState) _ae_update_state(ctx); for (i = 0; i < actx->nr_vbos; i++) ctx->Driver.MapBufferRange(ctx, 0, actx->vbo[i]->Size, GL_MAP_READ_BIT, actx->vbo[i]); if (actx->nr_vbos) actx->mapped_vbos = GL_TRUE; }
/** * Called via glArrayElement() and glDrawArrays(). * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions * for all enabled vertex arrays (for elt-th element). * Note: this may be called during display list construction. */ void GLAPIENTRY _ae_ArrayElement( GLint elt ) { GET_CURRENT_CONTEXT(ctx); const AEcontext *actx = AE_CONTEXT(ctx); const AEarray *aa; const AEattrib *at; const struct _glapi_table * const disp = GET_DISPATCH(); GLboolean do_map; if (actx->NewState) { assert(!actx->mapped_vbos); _ae_update_state( ctx ); } /* Determine if w need to map/unmap VBOs */ do_map = actx->nr_vbos && !actx->mapped_vbos; if (do_map) _ae_map_vbos(ctx); /* emit generic attribute elements */ for (at = actx->attribs; at->func; at++) { const GLubyte *src = ADD_POINTERS(at->array->BufferObj->Pointer, at->array->Ptr) + elt * at->array->StrideB; at->func( at->index, src ); } /* emit conventional arrays elements */ for (aa = actx->arrays; aa->offset != -1 ; aa++) { const GLubyte *src = ADD_POINTERS(aa->array->BufferObj->Pointer, aa->array->Ptr) + elt * aa->array->StrideB; CALL_by_offset( disp, (array_func), aa->offset, ((const void *) src) ); } if (do_map) _ae_unmap_vbos(ctx); }