From 89c488871056185b8633aae7e7573b398827b038 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 19 Apr 2012 19:54:23 +0200 Subject: [PATCH] u_vbuf: don't call u_vbuf_upload_buffers if there's nothing to upload --- src/gallium/auxiliary/util/u_vbuf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index c25385fbf27..2d60c07c4ad 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -980,11 +980,12 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) int start_vertex, min_index; unsigned num_vertices; boolean unroll_indices = FALSE; + uint32_t user_vb_mask = mgr->user_vb_mask; /* Normal draw. No fallback and no user buffers. */ if (!mgr->incompatible_vb_mask && !mgr->ve->incompatible_elem_mask && - !mgr->user_vb_mask) { + !user_vb_mask) { /* Set vertex buffers if needed. */ if (mgr->vertex_buffers_dirty) { pipe->set_vertex_buffers(pipe, mgr->nr_real_vertex_buffers, @@ -1024,6 +1025,8 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) !u_vbuf_mapping_vertex_buffer_blocks(mgr)) { /*printf("num_vertices=%i count=%i\n", num_vertices, info->count);*/ unroll_indices = TRUE; + user_vb_mask &= ~(mgr->nonzero_stride_vb_mask & + mgr->ve->noninstance_vb_mask_any); } } else { /* Nothing to do for per-vertex attribs. */ @@ -1046,10 +1049,13 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info) info->start_instance, info->instance_count, info->start, info->count, min_index, unroll_indices); + + user_vb_mask &= ~(mgr->incompatible_vb_mask | + mgr->ve->incompatible_vb_mask_all); } /* Upload user buffers. */ - if (mgr->user_vb_mask) { + if (user_vb_mask) { u_vbuf_upload_buffers(mgr, start_vertex, num_vertices, info->start_instance, info->instance_count); } -- 2.30.2