diff options
author | Marek Olšák <[email protected]> | 2012-01-01 17:38:22 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-01-05 18:29:11 +0100 |
commit | f430f794ace50022b1b81408a3721b8e0b2519bb (patch) | |
tree | b57275360abb778a7b10831b79ae294a3421660a | |
parent | 214b87aa0469a12ea72d624cfaee0ca46179ec5f (diff) |
u_vbuf: only map a subrange of buffers to translate
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index b6681978391..619a5e65761 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -194,7 +194,7 @@ u_vbuf_translate_begin(struct u_vbuf_priv *mgr, uint8_t *out_map; struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {0}; struct pipe_resource *out_buffer = NULL; - unsigned i, num_verts, out_offset; + unsigned i, out_offset, num_verts = max_index + 1 - min_index; boolean upload_flushed = FALSE; memset(&key, 0, sizeof(key)); @@ -244,18 +244,17 @@ u_vbuf_translate_begin(struct u_vbuf_priv *mgr, if (vb_translated[i]) { struct pipe_vertex_buffer *vb = &mgr->b.vertex_buffer[i]; - uint8_t *map = pipe_buffer_map(mgr->pipe, vb->buffer, - PIPE_TRANSFER_READ, &vb_transfer[i]); + uint8_t *map = + pipe_buffer_map_range(mgr->pipe, vb->buffer, + vb->buffer_offset + vb->stride * min_index, + num_verts * vb->stride, + PIPE_TRANSFER_READ, &vb_transfer[i]); - tr->set_buffer(tr, i, - map + vb->buffer_offset + vb->stride * min_index, - vb->stride, ~0); + tr->set_buffer(tr, i, map, vb->stride, ~0); } } /* Create and map the output buffer. */ - num_verts = max_index + 1 - min_index; - u_upload_alloc(mgr->b.uploader, key.output_stride * min_index, key.output_stride * num_verts, @@ -269,7 +268,7 @@ u_vbuf_translate_begin(struct u_vbuf_priv *mgr, /* Unmap all buffers. */ for (i = 0; i < mgr->b.nr_vertex_buffers; i++) { - if (vb_translated[i]) { + if (vb_transfer[i]) { pipe_buffer_unmap(mgr->pipe, vb_transfer[i]); } } |