-static void upload_vertex_buffer(r300ContextPtr rmesa,
- GLcontext *ctx, AOS_DATA *array, int *n_arrays)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- int offset=0, idx=0;
- int i,j;
- radeonScreenPtr rsp=rmesa->radeon.radeonScreen;
- /* Not the most efficient implementation, but, for now, I just want something that
- works */
- /* to do - make single memcpy per column (is it possible ?) */
- /* to do - use dirty flags to avoid redundant copies */
-#define UPLOAD_VECTOR(v, r, f)\
- { \
- /* Is the data dirty ? */ \
- if (v->flags & ((1<<v->size)-1)) { \
- fprintf(stderr, "size=%d vs stride=%d\n", v->size, v->stride); \
- if(v->size*4==v->stride){\
- /* fast path */ \
- memcpy(rsp->gartTextures.map+offset, v->data, v->stride*VB->Count); \
- } else { \
- for(i=0;i<VB->Count;i++){ \
- /* copy one vertex at a time*/ \
- memcpy(rsp->gartTextures.map+offset+i*v->size*4, VEC_ELT(v, GLfloat, i), v->size*4); \
- } \
- } \
- /* v->flags &= ~((1<<v->size)-1);*/ \
- } \
- array[idx].element_size=v->size; \
- array[idx].stride=v->size; \
- array[idx].format=(f); \
- array[idx].ncomponents=v->size; \
- array[idx].offset=rsp->gartTextures.handle+offset; \
- array[idx].reg=r; \
- offset+=v->size*4*VB->Count; \
- idx++; \
- }