summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-01-01 17:53:55 +0100
committerMarek Olšák <[email protected]>2012-01-05 18:29:11 +0100
commitc727cc175bcbf96f12f27c46819667948d5ebbe2 (patch)
treea6a444ff68a8f20731094ebe2ba86d664f2cca8b /src/gallium/auxiliary
parentf430f794ace50022b1b81408a3721b8e0b2519bb (diff)
u_vbuf: don't map user buffers, just obtain a pointer to them
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 619a5e65761..7c87bf8b210 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -243,12 +243,17 @@ u_vbuf_translate_begin(struct u_vbuf_priv *mgr,
for (i = 0; i < mgr->b.nr_vertex_buffers; i++) {
if (vb_translated[i]) {
struct pipe_vertex_buffer *vb = &mgr->b.vertex_buffer[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]);
+ unsigned offset = vb->buffer_offset + vb->stride * min_index;
+ unsigned size = vb->stride ? num_verts * vb->stride
+ : vb->buffer->width0 - offset;
+ uint8_t *map;
+
+ if (u_vbuf_resource(vb->buffer)->user_ptr) {
+ map = u_vbuf_resource(vb->buffer)->user_ptr + offset;
+ } else {
+ map = pipe_buffer_map_range(mgr->pipe, vb->buffer, offset, size,
+ PIPE_TRANSFER_READ, &vb_transfer[i]);
+ }
tr->set_buffer(tr, i, map, vb->stride, ~0);
}