diff options
author | Marek Olšák <[email protected]> | 2011-09-26 14:41:08 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-09-26 15:25:05 +0200 |
commit | 21f71b6c050f8a746f6a671e57afc8e5500c5e77 (patch) | |
tree | fc948927b7f6185767d795dd692d0f865a7922c5 /src/gallium | |
parent | cd9bbb3935320fd838c9b64236ccef865782a248 (diff) |
u_vbuf_mgr: dereference some pointers only once etc.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf_mgr.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c index 46b37aa7484..282efdbfe9a 100644 --- a/src/gallium/auxiliary/util/u_vbuf_mgr.c +++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c @@ -518,9 +518,8 @@ u_vbuf_upload_buffers(struct u_vbuf_priv *mgr, for (i = 0; i < nr_velems; i++) { struct pipe_vertex_element *velem = &mgr->ve->ve[i]; unsigned index = velem->vertex_buffer_index; - unsigned instance_div = velem->instance_divisor; struct pipe_vertex_buffer *vb = &mgr->b.vertex_buffer[index]; - unsigned first, size; + unsigned instance_div, first, size; assert(vb->buffer); @@ -528,6 +527,7 @@ u_vbuf_upload_buffers(struct u_vbuf_priv *mgr, continue; } + instance_div = velem->instance_divisor; first = vb->buffer_offset + velem->src_offset; if (!vb->stride) { @@ -557,22 +557,25 @@ u_vbuf_upload_buffers(struct u_vbuf_priv *mgr, /* Upload buffers. */ for (i = 0; i < nr_vbufs; i++) { - unsigned start = start_offset[i]; - unsigned end = end_offset[i]; + unsigned start, end = end_offset[i]; boolean flushed; + struct pipe_vertex_buffer *real_vb; + uint8_t *ptr; if (!end) { continue; } + + start = start_offset[i]; assert(start < end); - u_upload_data(mgr->b.uploader, start, end - start, - u_vbuf_resource(mgr->b.vertex_buffer[i].buffer)->user_ptr + start, - &mgr->b.real_vertex_buffer[i].buffer_offset, - &mgr->b.real_vertex_buffer[i].buffer, - &flushed); + real_vb = &mgr->b.real_vertex_buffer[i]; + ptr = u_vbuf_resource(mgr->b.vertex_buffer[i].buffer)->user_ptr; + + u_upload_data(mgr->b.uploader, start, end - start, ptr + start, + &real_vb->buffer_offset, &real_vb->buffer, &flushed); - mgr->b.real_vertex_buffer[i].buffer_offset -= start; + real_vb->buffer_offset -= start; } } |