diff options
author | Marek Olšák <[email protected]> | 2017-04-02 16:24:39 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-10 19:00:16 +0200 |
commit | 330d0607ed60fd3edca192e54b4246310f06652f (patch) | |
tree | 56bceba5b291ffcf42209ef1ab7ec515a8f5b666 /src/gallium/drivers/softpipe | |
parent | 22f6624ed318e8131681ec1f2e7b3a59449df412 (diff) |
gallium: remove pipe_index_buffer and set_index_buffer
pipe_draw_info::indexed is replaced with index_size. index_size == 0 means
non-indexed.
Instead of pipe_index_buffer::offset, pipe_draw_info::start is used.
For indexed indirect draws, pipe_draw_info::start is added to the indirect
start. This is the only case when "start" affects indirect draws.
pipe_draw_info::index is a union. Use either index::resource or
index::user depending on the value of pipe_draw_info::has_user_indices.
v2: fixes for nine, svga
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_draw_arrays.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_vertex.c | 14 |
3 files changed, 6 insertions, 25 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index a57f5875537..7ce4dc3560d 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -88,7 +88,6 @@ struct softpipe_context { struct pipe_shader_buffer buffers[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_BUFFERS]; struct pipe_viewport_state viewports[PIPE_MAX_VIEWPORTS]; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - struct pipe_index_buffer index_buffer; struct pipe_resource *mapped_vs_tex[PIPE_MAX_SHADER_SAMPLER_VIEWS]; struct pipe_resource *mapped_gs_tex[PIPE_MAX_SHADER_SAMPLER_VIEWS]; diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index 137ad0565b3..6363701cf92 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -96,21 +96,17 @@ softpipe_draw_vbo(struct pipe_context *pipe, } /* Map index buffer, if present */ - if (info->indexed) { + if (info->index_size) { unsigned available_space = ~0; - mapped_indices = sp->index_buffer.user_buffer; + mapped_indices = info->has_user_indices ? info->index.user : NULL; if (!mapped_indices) { - mapped_indices = softpipe_resource_data(sp->index_buffer.buffer); - if (sp->index_buffer.buffer->width0 > sp->index_buffer.offset) - available_space = - (sp->index_buffer.buffer->width0 - sp->index_buffer.offset); - else - available_space = 0; + mapped_indices = softpipe_resource_data(info->index.resource); + available_space = info->index.resource->width0; } draw_set_indexes(draw, - (ubyte *) mapped_indices + sp->index_buffer.offset, - sp->index_buffer.index_size, available_space); + (ubyte *) mapped_indices, + info->index_size, available_space); } diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c index 48c8d2cb39f..a7a8736390d 100644 --- a/src/gallium/drivers/softpipe/sp_state_vertex.c +++ b/src/gallium/drivers/softpipe/sp_state_vertex.c @@ -97,19 +97,6 @@ softpipe_set_vertex_buffers(struct pipe_context *pipe, } -static void -softpipe_set_index_buffer(struct pipe_context *pipe, - const struct pipe_index_buffer *ib) -{ - struct softpipe_context *softpipe = softpipe_context(pipe); - - if (ib) - memcpy(&softpipe->index_buffer, ib, sizeof(softpipe->index_buffer)); - else - memset(&softpipe->index_buffer, 0, sizeof(softpipe->index_buffer)); -} - - void softpipe_init_vertex_funcs(struct pipe_context *pipe) { @@ -118,5 +105,4 @@ softpipe_init_vertex_funcs(struct pipe_context *pipe) pipe->delete_vertex_elements_state = softpipe_delete_vertex_elements_state; pipe->set_vertex_buffers = softpipe_set_vertex_buffers; - pipe->set_index_buffer = softpipe_set_index_buffer; } |