/* TODO -- If no new vertices have been stored, don't bother saving * it. */ static void _save_wrap_buffers( GLcontext *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; GLint i = save->prim_count - 1; GLenum mode; GLboolean weak; assert(i < (GLint) save->prim_max); assert(i >= 0); /* Close off in-progress primitive. */ save->prim[i].count = (save->vert_count - save->prim[i].start); mode = save->prim[i].mode; weak = save->prim[i].weak; /* store the copied vertices, and allocate a new list. */ _save_compile_vertex_list( ctx ); /* Restart interrupted primitive */ save->prim[0].mode = mode; save->prim[0].weak = weak; save->prim[0].begin = 0; save->prim[0].end = 0; save->prim[0].pad = 0; save->prim[0].start = 0; save->prim[0].count = 0; save->prim_count = 1; }
/* Cope with EvalCoord/CallList called within a begin/end object: * -- Flush current buffer * -- Fallback to opcodes for the rest of the begin/end object. */ static void dlist_fallback(struct gl_context *ctx) { struct vbo_save_context *save = &vbo_context(ctx)->save; if (save->vert_count || save->prim_count) { if (save->prim_count > 0) { /* Close off in-progress primitive. */ GLint i = save->prim_count - 1; save->prim[i].count = save->vert_count - save->prim[i].start; } /* Need to replay this display list with loopback, * unfortunately, otherwise this primitive won't be handled * properly: */ save->dangling_attr_ref = GL_TRUE; _save_compile_vertex_list(ctx); } _save_copy_to_current(ctx); _save_reset_vertex(ctx); _save_reset_counters(ctx); if (save->out_of_memory) { _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); } else { _mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt); } ctx->Driver.SaveNeedFlush = GL_FALSE; }
static void GLAPIENTRY _save_End(void) { GET_CURRENT_CONTEXT(ctx); struct vbo_save_context *save = &vbo_context(ctx)->save; const GLint i = save->prim_count - 1; ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; save->prim[i].end = 1; save->prim[i].count = (save->vert_count - save->prim[i].start); if (i == (GLint) save->prim_max - 1) { _save_compile_vertex_list(ctx); assert(save->copied.nr == 0); } /* Swap out this vertex format while outside begin/end. Any color, * etc. received between here and the next begin will be compiled * as opcodes. */ if (save->out_of_memory) { _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop); } else { _mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt); } }
void _tnl_SaveFlushVertices( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); /* Noop when we are actually active: */ if (ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM || ctx->Driver.CurrentSavePrimitive <= GL_POLYGON) return; if (tnl->save.initial_counter != tnl->save.counter || tnl->save.prim_count) _save_compile_vertex_list( ctx ); _save_copy_to_current( ctx ); _save_reset_vertex( ctx ); ctx->Driver.SaveNeedFlush = 0; }
void vbo_save_SaveFlushVertices(struct gl_context *ctx) { struct vbo_save_context *save = &vbo_context(ctx)->save; /* Noop when we are actually active: */ if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) return; if (save->vert_count || save->prim_count) _save_compile_vertex_list(ctx); _save_copy_to_current(ctx); _save_reset_vertex(ctx); _save_reset_counters(ctx); ctx->Driver.SaveNeedFlush = GL_FALSE; }
void vbo_save_SaveFlushVertices( GLcontext *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; /* Noop when we are actually active: */ if (ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM || ctx->Driver.CurrentSavePrimitive <= GL_POLYGON) return; if (save->vert_count || save->prim_count) _save_compile_vertex_list( ctx ); _save_copy_to_current( ctx ); _save_reset_vertex( ctx ); _save_reset_counters( ctx ); ctx->Driver.SaveNeedFlush = 0; }
static void GLAPIENTRY _save_End( void ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i = tnl->save.prim_count - 1; ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; tnl->save.prim[i].mode |= PRIM_END; tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - tnl->save.prim[i].start); if (i == (GLint) tnl->save.prim_max - 1) { _save_compile_vertex_list( ctx ); assert(tnl->save.copied.nr == 0); } /* Swap out this vertex format while outside begin/end. Any color, * etc. received between here and the next begin will be compiled * as opcodes. */ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); }