Lines Matching refs:save
106 struct vbo_save_context *save = &vbo_context(ctx)->save; in copy_vertices() local
109 GLuint sz = save->vertex_size; in copy_vertices()
111 fi_type *dst = save->copied.buffer; in copy_vertices()
186 struct vbo_save_context *save = &vbo_context(ctx)->save; in alloc_vertex_store() local
198 save->out_of_memory = in alloc_vertex_store()
208 save->out_of_memory = GL_TRUE; in alloc_vertex_store()
211 if (save->out_of_memory) { in alloc_vertex_store()
213 _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); in alloc_vertex_store()
310 struct vbo_save_context *save = &vbo_context(ctx)->save; in reset_counters() local
312 save->prims = save->prim_store->prims + save->prim_store->used; in reset_counters()
313 save->buffer_map = save->vertex_store->buffer_map + save->vertex_store->used; in reset_counters()
315 assert(save->buffer_map == save->buffer_ptr); in reset_counters()
317 if (save->vertex_size) in reset_counters()
318 save->max_vert = (VBO_SAVE_BUFFER_SIZE - save->vertex_store->used) / in reset_counters()
319 save->vertex_size; in reset_counters()
321 save->max_vert = 0; in reset_counters()
323 save->vert_count = 0; in reset_counters()
324 save->prim_count = 0; in reset_counters()
325 save->prim_max = VBO_SAVE_PRIM_SIZE - save->prim_store->used; in reset_counters()
326 save->dangling_attr_ref = GL_FALSE; in reset_counters()
371 convert_line_loop_to_strip(struct vbo_save_context *save, in convert_line_loop_to_strip() argument
382 const GLuint sz = save->vertex_size; in convert_line_loop_to_strip()
384 const fi_type *src = save->buffer_map + prim->start * sz; in convert_line_loop_to_strip()
386 fi_type *dst = save->buffer_map + (prim->start + prim->count) * sz; in convert_line_loop_to_strip()
392 save->vert_count++; in convert_line_loop_to_strip()
393 save->buffer_ptr += sz; in convert_line_loop_to_strip()
394 save->vertex_store->used += sz; in convert_line_loop_to_strip()
416 struct vbo_save_context *save = &vbo_context(ctx)->save; in compile_vertex_list() local
423 _mesa_dlist_alloc_aligned(ctx, save->opcode_vertex_list, sizeof(*node)); in compile_vertex_list()
433 node->enabled = save->enabled; in compile_vertex_list()
434 memcpy(node->attrsz, save->attrsz, sizeof(node->attrsz)); in compile_vertex_list()
435 memcpy(node->attrtype, save->attrtype, sizeof(node->attrtype)); in compile_vertex_list()
436 node->vertex_size = save->vertex_size; in compile_vertex_list()
438 (save->buffer_map - save->vertex_store->buffer_map) * sizeof(GLfloat); in compile_vertex_list()
439 node->vertex_count = save->vert_count; in compile_vertex_list()
440 node->wrap_count = save->copied.nr; in compile_vertex_list()
441 node->dangling_attr_ref = save->dangling_attr_ref; in compile_vertex_list()
442 node->prims = save->prims; in compile_vertex_list()
443 node->prim_count = save->prim_count; in compile_vertex_list()
444 node->vertex_store = save->vertex_store; in compile_vertex_list()
445 node->prim_store = save->prim_store; in compile_vertex_list()
464 const char *buffer = (const char *) save->vertex_store->buffer_map; in compile_vertex_list()
481 if (save->dangling_attr_ref) in compile_vertex_list()
484 save->vertex_store->used += save->vertex_size * node->vertex_count; in compile_vertex_list()
485 save->prim_store->used += node->prim_count; in compile_vertex_list()
489 save->copied.nr = copy_vertices(ctx, node, save->buffer_map); in compile_vertex_list()
492 convert_line_loop_to_strip(save, node); in compile_vertex_list()
505 ((const char *) save->vertex_store->buffer_map + in compile_vertex_list()
518 if (save->vertex_store->used > in compile_vertex_list()
519 VBO_SAVE_BUFFER_SIZE - 16 * (save->vertex_size + 4)) { in compile_vertex_list()
523 vbo_save_unmap_vertex_store(ctx, save->vertex_store); in compile_vertex_list()
527 save->vertex_store->refcount--; in compile_vertex_list()
528 assert(save->vertex_store->refcount != 0); in compile_vertex_list()
529 save->vertex_store = NULL; in compile_vertex_list()
533 save->vertex_store = alloc_vertex_store(ctx); in compile_vertex_list()
534 save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store); in compile_vertex_list()
535 save->out_of_memory = save->buffer_ptr == NULL; in compile_vertex_list()
539 save->buffer_ptr = save->vertex_store->buffer_map in compile_vertex_list()
540 + save->vertex_store->used; in compile_vertex_list()
543 if (save->prim_store->used > VBO_SAVE_PRIM_SIZE - 6) { in compile_vertex_list()
544 save->prim_store->refcount--; in compile_vertex_list()
545 assert(save->prim_store->refcount != 0); in compile_vertex_list()
546 save->prim_store = alloc_prim_store(); in compile_vertex_list()
558 for (unsigned i = 0; i < save->prim_count; i++) { in compile_vertex_list()
559 save->prims[i].start += start_offset; in compile_vertex_list()
580 struct vbo_save_context *save = &vbo_context(ctx)->save; in wrap_buffers() local
581 GLint i = save->prim_count - 1; in wrap_buffers()
586 assert(i < (GLint) save->prim_max); in wrap_buffers()
591 save->prims[i].count = (save->vert_count - save->prims[i].start); in wrap_buffers()
592 mode = save->prims[i].mode; in wrap_buffers()
593 weak = save->prims[i].weak; in wrap_buffers()
594 no_current_update = save->prims[i].no_current_update; in wrap_buffers()
602 save->prims[0].mode = mode; in wrap_buffers()
603 save->prims[0].weak = weak; in wrap_buffers()
604 save->prims[0].no_current_update = no_current_update; in wrap_buffers()
605 save->prims[0].begin = 0; in wrap_buffers()
606 save->prims[0].end = 0; in wrap_buffers()
607 save->prims[0].pad = 0; in wrap_buffers()
608 save->prims[0].start = 0; in wrap_buffers()
609 save->prims[0].count = 0; in wrap_buffers()
610 save->prims[0].num_instances = 1; in wrap_buffers()
611 save->prims[0].base_instance = 0; in wrap_buffers()
612 save->prims[0].is_indirect = 0; in wrap_buffers()
613 save->prim_count = 1; in wrap_buffers()
624 struct vbo_save_context *save = &vbo_context(ctx)->save; in wrap_filled_vertex() local
633 assert(save->max_vert - save->vert_count > save->copied.nr); in wrap_filled_vertex()
635 numComponents = save->copied.nr * save->vertex_size; in wrap_filled_vertex()
636 memcpy(save->buffer_ptr, in wrap_filled_vertex()
637 save->copied.buffer, in wrap_filled_vertex()
639 save->buffer_ptr += numComponents; in wrap_filled_vertex()
640 save->vert_count += save->copied.nr; in wrap_filled_vertex()
647 struct vbo_save_context *save = &vbo_context(ctx)->save; in copy_to_current() local
648 GLbitfield64 enabled = save->enabled & (~BITFIELD64_BIT(VBO_ATTRIB_POS)); in copy_to_current()
652 assert(save->attrsz[i]); in copy_to_current()
654 save->currentsz[i][0] = save->attrsz[i]; in copy_to_current()
655 COPY_CLEAN_4V_TYPE_AS_UNION(save->current[i], save->attrsz[i], in copy_to_current()
656 save->attrptr[i], save->attrtype[i]); in copy_to_current()
664 struct vbo_save_context *save = &vbo_context(ctx)->save; in copy_from_current() local
665 GLbitfield64 enabled = save->enabled & (~BITFIELD64_BIT(VBO_ATTRIB_POS)); in copy_from_current()
670 switch (save->attrsz[i]) { in copy_from_current()
672 save->attrptr[i][3] = save->current[i][3]; in copy_from_current()
674 save->attrptr[i][2] = save->current[i][2]; in copy_from_current()
676 save->attrptr[i][1] = save->current[i][1]; in copy_from_current()
678 save->attrptr[i][0] = save->current[i][0]; in copy_from_current()
697 struct vbo_save_context *save = &vbo_context(ctx)->save; in upgrade_vertex() local
705 if (save->vert_count) in upgrade_vertex()
708 assert(save->copied.nr == 0); in upgrade_vertex()
718 oldsz = save->attrsz[attr]; in upgrade_vertex()
719 save->attrsz[attr] = newsz; in upgrade_vertex()
720 save->enabled |= BITFIELD64_BIT(attr); in upgrade_vertex()
722 save->vertex_size += newsz - oldsz; in upgrade_vertex()
723 save->max_vert = ((VBO_SAVE_BUFFER_SIZE - save->vertex_store->used) / in upgrade_vertex()
724 save->vertex_size); in upgrade_vertex()
725 save->vert_count = 0; in upgrade_vertex()
729 tmp = save->vertex; in upgrade_vertex()
731 if (save->attrsz[i]) { in upgrade_vertex()
732 save->attrptr[i] = tmp; in upgrade_vertex()
733 tmp += save->attrsz[i]; in upgrade_vertex()
736 save->attrptr[i] = NULL; /* will not be dereferenced. */ in upgrade_vertex()
750 if (save->copied.nr) { in upgrade_vertex()
751 const fi_type *data = save->copied.buffer; in upgrade_vertex()
752 fi_type *dest = save->buffer_map; in upgrade_vertex()
756 if (attr != VBO_ATTRIB_POS && save->currentsz[attr][0] == 0) { in upgrade_vertex()
758 save->dangling_attr_ref = GL_TRUE; in upgrade_vertex()
761 for (i = 0; i < save->copied.nr; i++) { in upgrade_vertex()
762 GLbitfield64 enabled = save->enabled; in upgrade_vertex()
765 assert(save->attrsz[j]); in upgrade_vertex()
769 save->attrtype[j]); in upgrade_vertex()
774 COPY_SZ_4V(dest, newsz, save->current[attr]); in upgrade_vertex()
779 GLint sz = save->attrsz[j]; in upgrade_vertex()
787 save->buffer_ptr = dest; in upgrade_vertex()
788 save->vert_count += save->copied.nr; in upgrade_vertex()
801 struct vbo_save_context *save = &vbo_context(ctx)->save; in fixup_vertex() local
803 if (sz > save->attrsz[attr]) { in fixup_vertex()
809 else if (sz < save->active_sz[attr]) { in fixup_vertex()
811 const fi_type *id = vbo_get_default_vals_as_union(save->attrtype[attr]); in fixup_vertex()
816 for (i = sz; i <= save->attrsz[attr]; i++) in fixup_vertex()
817 save->attrptr[attr][i - 1] = id[i - 1]; in fixup_vertex()
820 save->active_sz[attr] = sz; in fixup_vertex()
832 struct vbo_save_context *save = &vbo_context(ctx)->save; in reset_vertex() local
834 while (save->enabled) { in reset_vertex()
835 const int i = u_bit_scan64(&save->enabled); in reset_vertex()
836 assert(save->attrsz[i]); in reset_vertex()
837 save->attrsz[i] = 0; in reset_vertex()
838 save->active_sz[i] = 0; in reset_vertex()
841 save->vertex_size = 0; in reset_vertex()
857 struct vbo_save_context *save = &vbo_context(ctx)->save; \
859 if (save->active_sz[A] != N) \
863 C *dest = (C *)save->attrptr[A]; \
868 save->attrtype[A] = T; \
874 for (i = 0; i < save->vertex_size; i++) \
875 save->buffer_ptr[i] = save->vertex[i]; \
877 save->buffer_ptr += save->vertex_size; \
879 if (++save->vert_count >= save->max_vert) \
955 struct vbo_save_context *save = &vbo_context(ctx)->save; in dlist_fallback() local
957 if (save->vert_count || save->prim_count) { in dlist_fallback()
958 if (save->prim_count > 0) { in dlist_fallback()
960 GLint i = save->prim_count - 1; in dlist_fallback()
961 save->prims[i].count = save->vert_count - save->prims[i].start; in dlist_fallback()
968 save->dangling_attr_ref = GL_TRUE; in dlist_fallback()
976 if (save->out_of_memory) { in dlist_fallback()
977 _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); in dlist_fallback()
1059 struct vbo_save_context *save = &vbo_context(ctx)->save; in vbo_save_NotifyBegin() local
1060 const GLuint i = save->prim_count++; in vbo_save_NotifyBegin()
1062 assert(i < save->prim_max); in vbo_save_NotifyBegin()
1063 save->prims[i].mode = mode & VBO_SAVE_PRIM_MODE_MASK; in vbo_save_NotifyBegin()
1064 save->prims[i].begin = 1; in vbo_save_NotifyBegin()
1065 save->prims[i].end = 0; in vbo_save_NotifyBegin()
1066 save->prims[i].weak = (mode & VBO_SAVE_PRIM_WEAK) ? 1 : 0; in vbo_save_NotifyBegin()
1067 save->prims[i].no_current_update = in vbo_save_NotifyBegin()
1069 save->prims[i].pad = 0; in vbo_save_NotifyBegin()
1070 save->prims[i].start = save->vert_count; in vbo_save_NotifyBegin()
1071 save->prims[i].count = 0; in vbo_save_NotifyBegin()
1072 save->prims[i].num_instances = 1; in vbo_save_NotifyBegin()
1073 save->prims[i].base_instance = 0; in vbo_save_NotifyBegin()
1074 save->prims[i].is_indirect = 0; in vbo_save_NotifyBegin()
1076 if (save->out_of_memory) { in vbo_save_NotifyBegin()
1077 _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); in vbo_save_NotifyBegin()
1080 _mesa_install_save_vtxfmt(ctx, &save->vtxfmt); in vbo_save_NotifyBegin()
1092 struct vbo_save_context *save = &vbo_context(ctx)->save; in _save_End() local
1093 const GLint i = save->prim_count - 1; in _save_End()
1096 save->prims[i].end = 1; in _save_End()
1097 save->prims[i].count = (save->vert_count - save->prims[i].start); in _save_End()
1099 if (i == (GLint) save->prim_max - 1) { in _save_End()
1101 assert(save->copied.nr == 0); in _save_End()
1108 if (save->out_of_memory) { in _save_End()
1109 _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); in _save_End()
1130 struct vbo_save_context *save = &vbo_context(ctx)->save; in _save_PrimitiveRestartNV() local
1132 if (save->prim_count == 0) { in _save_PrimitiveRestartNV()
1140 GLenum curPrim = save->prims[save->prim_count - 1].mode; in _save_PrimitiveRestartNV()
1171 struct vbo_save_context *save = &vbo_context(ctx)->save; in _save_OBE_DrawArrays() local
1183 if (save->out_of_memory) in _save_OBE_DrawArrays()
1244 struct vbo_save_context *save = &vbo_context(ctx)->save; in _save_OBE_DrawElementsBaseVertex() local
1263 if (save->out_of_memory) in _save_OBE_DrawElementsBaseVertex()
1315 struct vbo_save_context *save = &vbo_context(ctx)->save; in _save_OBE_DrawRangeElements() local
1338 if (save->out_of_memory) in _save_OBE_DrawRangeElements()
1381 struct vbo_save_context *save = &vbo_context(ctx)->save; in vtxfmt_init() local
1382 GLvertexformat *vfmt = &save->vtxfmt; in vtxfmt_init()
1562 struct vbo_save_context *save = &vbo_context(ctx)->save; in vbo_save_SaveFlushVertices() local
1569 if (save->vert_count || save->prim_count) in vbo_save_SaveFlushVertices()
1585 struct vbo_save_context *save = &vbo_context(ctx)->save; in vbo_save_NewList() local
1590 if (!save->prim_store) in vbo_save_NewList()
1591 save->prim_store = alloc_prim_store(); in vbo_save_NewList()
1593 if (!save->vertex_store) in vbo_save_NewList()
1594 save->vertex_store = alloc_vertex_store(ctx); in vbo_save_NewList()
1596 save->buffer_ptr = vbo_save_map_vertex_store(ctx, save->vertex_store); in vbo_save_NewList()
1610 struct vbo_save_context *save = &vbo_context(ctx)->save; in vbo_save_EndList() local
1615 if (save->prim_count > 0) { in vbo_save_EndList()
1616 GLint i = save->prim_count - 1; in vbo_save_EndList()
1618 save->prims[i].end = 0; in vbo_save_EndList()
1619 save->prims[i].count = save->vert_count - save->prims[i].start; in vbo_save_EndList()
1625 save->dangling_attr_ref = GL_TRUE; in vbo_save_EndList()
1635 vbo_save_unmap_vertex_store(ctx, save->vertex_store); in vbo_save_EndList()
1637 assert(save->vertex_size == 0); in vbo_save_EndList()
1648 struct vbo_save_context *save = &vbo_context(ctx)->save; in vbo_save_BeginCallList() local
1649 save->replay_flags |= dlist->Flags; in vbo_save_BeginCallList()
1660 struct vbo_save_context *save = &vbo_context(ctx)->save; in vbo_save_EndCallList() local
1666 save->replay_flags &= VBO_SAVE_FALLBACK; in vbo_save_EndCallList()
1725 struct vbo_save_context *save = &vbo_context(ctx)->save; in current_init() local
1731 save->currentsz[i] = &ctx->ListState.ActiveAttribSize[j]; in current_init()
1732 save->current[i] = (fi_type *) ctx->ListState.CurrentAttrib[j]; in current_init()
1738 save->currentsz[i] = &ctx->ListState.ActiveMaterialSize[j]; in current_init()
1739 save->current[i] = (fi_type *) ctx->ListState.CurrentMaterial[j]; in current_init()
1748 vbo_save_api_init(struct vbo_save_context *save) in vbo_save_api_init() argument
1750 struct gl_context *ctx = save->ctx; in vbo_save_api_init()
1753 save->opcode_vertex_list = in vbo_save_api_init()
1762 _mesa_noop_vtxfmt_init(&save->vtxfmt_noop); in vbo_save_api_init()
1766 save->inputs[i] = &save->arrays[i]; in vbo_save_api_init()