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/drivers/nv30 | |
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/drivers/nv30')
-rw-r--r-- | src/gallium/drivers/nv30/nv30_draw.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/nv30/nv30_screen.c | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/nv30/nv30_draw.c b/src/gallium/drivers/nv30/nv30_draw.c index 61e324606f2..c6907fa806f 100644 --- a/src/gallium/drivers/nv30/nv30_draw.c +++ b/src/gallium/drivers/nv30/nv30_draw.c @@ -366,7 +366,7 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) { struct nv30_context *nv30 = nv30_context(pipe); struct draw_context *draw = nv30->draw; - struct pipe_transfer *transfer[PIPE_MAX_ATTRIBS]; + struct pipe_transfer *transfer[PIPE_MAX_ATTRIBS] = {NULL}; struct pipe_transfer *transferi = NULL; int i; @@ -403,7 +403,9 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) } for (i = 0; i < nv30->num_vtxbufs; i++) { - void *map = pipe_buffer_map(pipe, nv30->vtxbuf[i].buffer, + const void *map = nv30->vtxbuf[i].user_buffer; + if (!map) + map = pipe_buffer_map(pipe, nv30->vtxbuf[i].buffer, PIPE_TRANSFER_UNSYNCHRONIZED | PIPE_TRANSFER_READ, &transfer[i]); draw_set_mapped_vertex_buffer(draw, i, map); @@ -425,7 +427,8 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) if (info->indexed) pipe_buffer_unmap(pipe, transferi); for (i = 0; i < nv30->num_vtxbufs; i++) - pipe_buffer_unmap(pipe, transfer[i]); + if (transfer[i]) + pipe_buffer_unmap(pipe, transfer[i]); nv30->draw_dirty = 0; nv30_state_release(nv30); diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 26969ef938b..5d550d13b5e 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -78,10 +78,11 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: - case PIPE_CAP_USER_VERTEX_BUFFERS: case PIPE_CAP_USER_INDEX_BUFFERS: case PIPE_CAP_USER_CONSTANT_BUFFERS: return 1; + case PIPE_CAP_USER_VERTEX_BUFFERS: + return 0; case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 16; /* nv4x capabilities */ |