diff options
author | Marek Olšák <[email protected]> | 2012-04-24 20:58:47 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-30 01:14:26 +0200 |
commit | 4552fd50d959ab99546cfa994f8ba5bdf5d66bc7 (patch) | |
tree | 6fa793d4b11531704029adfd33bfd5a94b90e230 /src/gallium/auxiliary/util/u_vbuf.c | |
parent | 7a0545972694e6afc6c5ac60db563defa79c20d9 (diff) |
gallium: add void *user_buffer in pipe_vertex_buffer
This reduces CPU overhead in st_draw_vbo and removes a lot of unnecessary code
in that function which was required only to comply with the gallium interface,
but wasn't any useful really.
Adapted drivers: i915, llvmpipe, r300, softpipe.
No changes required in: r600, radeonsi.
User vertex buffers have been disabled in nv30, nv50, nvc0 and svga to keep
things working.
Diffstat (limited to 'src/gallium/auxiliary/util/u_vbuf.c')
-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 401c8a4a850..e60378c31c7 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -277,8 +277,8 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key, unsigned offset = vb->buffer_offset + vb->stride * start_vertex; uint8_t *map; - if (vb->buffer->user_ptr) { - map = vb->buffer->user_ptr + offset; + if (vb->user_buffer) { + map = (uint8_t*)vb->user_buffer + offset; } else { unsigned size = vb->stride ? num_vertices * vb->stride : sizeof(double)*4; @@ -713,6 +713,7 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, struct pipe_vertex_buffer *real_vb = &mgr->real_vertex_buffer[i]; pipe_resource_reference(&orig_vb->buffer, vb->buffer); + orig_vb->user_buffer = vb->user_buffer; real_vb->buffer_offset = orig_vb->buffer_offset = vb->buffer_offset; real_vb->stride = orig_vb->stride = vb->stride; @@ -721,7 +722,7 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, mgr->nonzero_stride_vb_mask |= 1 << i; } - if (!vb->buffer) { + if (!vb->buffer && !vb->user_buffer) { pipe_resource_reference(&real_vb->buffer, NULL); continue; } @@ -733,7 +734,7 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, continue; } - if (!mgr->caps.user_vertex_buffers && vb->buffer->user_ptr) { + if (!mgr->caps.user_vertex_buffers && vb->user_buffer) { mgr->user_vb_mask |= 1 << i; pipe_resource_reference(&real_vb->buffer, NULL); continue; @@ -798,9 +799,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, continue; } - assert(vb->buffer); - - if (!vb->buffer->user_ptr) { + if (!vb->user_buffer) { continue; } @@ -837,7 +836,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, for (i = 0; i < nr_vbufs; i++) { unsigned start, end = end_offset[i]; struct pipe_vertex_buffer *real_vb; - uint8_t *ptr; + const uint8_t *ptr; if (!end) { continue; @@ -847,7 +846,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, assert(start < end); real_vb = &mgr->real_vertex_buffer[i]; - ptr = mgr->vertex_buffer[i].buffer->user_ptr; + ptr = mgr->vertex_buffer[i].user_buffer; u_upload_data(mgr->uploader, start, end - start, ptr + start, &real_vb->buffer_offset, &real_vb->buffer); |