summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_state_vertex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_vertex.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_state_vertex.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c
index f01a10de3b..e0230e16a4 100644
--- a/src/gallium/drivers/softpipe/sp_state_vertex.c
+++ b/src/gallium/drivers/softpipe/sp_state_vertex.c
@@ -37,28 +37,35 @@
void
-softpipe_set_vertex_element(struct pipe_context *pipe,
- unsigned index,
- const struct pipe_vertex_element *attrib)
+softpipe_set_vertex_elements(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- assert(index < PIPE_ATTRIB_MAX);
- softpipe->vertex_element[index] = *attrib; /* struct copy */
+
+ assert(count <= PIPE_MAX_ATTRIBS);
+
+ memcpy(softpipe->vertex_element, attribs,
+ count * sizeof(struct pipe_vertex_element));
+
softpipe->dirty |= SP_NEW_VERTEX;
- draw_set_vertex_element(softpipe->draw, index, attrib);
+ draw_set_vertex_elements(softpipe->draw, count, attribs);
}
void
-softpipe_set_vertex_buffer(struct pipe_context *pipe,
- unsigned index,
- const struct pipe_vertex_buffer *buffer)
+softpipe_set_vertex_buffers(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_buffer *buffers)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- assert(index < PIPE_ATTRIB_MAX);
- softpipe->vertex_buffer[index] = *buffer; /* struct copy */
+
+ assert(count <= PIPE_MAX_ATTRIBS);
+
+ memcpy(softpipe->vertex_buffer, buffers, count * sizeof(buffers[0]));
+
softpipe->dirty |= SP_NEW_VERTEX;
- draw_set_vertex_buffer(softpipe->draw, index, buffer);
+ draw_set_vertex_buffers(softpipe->draw, count, buffers);
}