/* Execute the buffer and save copied vertices.
*/
if (exec->vtx.vert_count)
- vbo_exec_vtx_flush(exec, GL_FALSE);
+ vbo_exec_vtx_flush(exec);
else {
exec->vtx.prim_count = 0;
exec->vtx.copied.nr = 0;
/* This is a glVertex call */ \
GLuint i; \
\
- if (unlikely(!exec->vtx.buffer_ptr)) { \
- vbo_exec_vtx_map(exec); \
- } \
- assert(exec->vtx.buffer_ptr); \
- \
/* copy 32-bit words */ \
for (i = 0; i < exec->vtx.vertex_size; i++) \
exec->vtx.buffer_ptr[i] = exec->vtx.vertex[i]; \
/**
* Flush (draw) vertices.
- * \param unmap - leave VBO unmapped after flushing?
*/
static void
-vbo_exec_FlushVertices_internal(struct vbo_exec_context *exec, GLboolean unmap)
+vbo_exec_FlushVertices_internal(struct vbo_exec_context *exec)
{
- if (exec->vtx.vert_count || unmap) {
- vbo_exec_vtx_flush(exec, unmap);
+ if (exec->vtx.vert_count) {
+ vbo_exec_vtx_flush(exec);
}
if (exec->vtx.vertex_size) {
* begin/end pairs.
*/
if (exec->vtx.vertex_size && !exec->vtx.attr[VBO_ATTRIB_POS].size)
- vbo_exec_FlushVertices_internal(exec, GL_FALSE);
+ vbo_exec_FlushVertices_internal(exec);
i = exec->vtx.prim_count++;
exec->vtx.prim[i].mode = mode;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
if (exec->vtx.prim_count == VBO_MAX_PRIM)
- vbo_exec_vtx_flush(exec, GL_FALSE);
+ vbo_exec_vtx_flush(exec);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
_mesa_flush(ctx);
/* Allocate a real buffer object now */
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName);
+
+ /* Map the buffer. */
+ vbo_exec_vtx_map(exec);
+ assert(exec->vtx.buffer_ptr);
}
return;
}
- /* Flush (draw), and make sure VBO is left unmapped when done */
- vbo_exec_FlushVertices_internal(exec, GL_TRUE);
+ /* Flush (draw). */
+ vbo_exec_FlushVertices_internal(exec);
/* Clear the dirty flush flags, because the flush is finished. */
ctx->Driver.NeedFlush &= ~(FLUSH_UPDATE_CURRENT | flags);
/**
* Execute the buffer and save copied verts.
- * \param unmap if true, leave the VBO unmapped when we're done.
*/
void
-vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean unmap)
+vbo_exec_vtx_flush(struct vbo_exec_context *exec)
{
/* Only unmap if persistent mappings are unsupported. */
bool persistent_mapping = exec->ctx->Extensions.ARB_buffer_storage &&
_mesa_is_bufferobj(exec->vtx.bufferobj) &&
exec->vtx.buffer_map;
- unmap = unmap && !persistent_mapping;
if (0)
vbo_exec_debug_verts(exec);
NULL, 0, NULL);
/* Get new storage -- unless asked not to. */
- if (!persistent_mapping && !unmap)
+ if (!persistent_mapping)
vbo_exec_vtx_map(exec);
}
}
- /* May have to unmap explicitly if we didn't draw:
- */
- if (unmap && exec->vtx.buffer_map) {
- vbo_exec_vtx_unmap(exec);
- }
-
if (persistent_mapping) {
exec->vtx.buffer_used += (exec->vtx.buffer_ptr - exec->vtx.buffer_map) *
sizeof(float);
}
}
- if (unmap || exec->vtx.vertex_size == 0)
+ if (exec->vtx.vertex_size == 0)
exec->vtx.max_vert = 0;
else
exec->vtx.max_vert = vbo_compute_max_verts(exec);