nv30: fix typo
[mesa.git] / src / gallium / drivers / i965 / brw_pipe_vertex.c
1 #include "brw_context.h"
2
3
4 static void brw_set_vertex_elements( struct pipe_context *pipe,
5 unsigned count,
6 const struct pipe_vertex_element *elements )
7 {
8 struct brw_context *brw = brw_context(pipe);
9
10 memcpy(brw->curr.vertex_element, elements, count * sizeof(elements[0]));
11 brw->curr.num_vertex_elements = count;
12
13 brw->state.dirty.mesa |= PIPE_NEW_VERTEX_ELEMENT;
14 }
15
16
17 static void brw_set_vertex_buffers(struct pipe_context *pipe,
18 unsigned count,
19 const struct pipe_vertex_buffer *buffers)
20 {
21 struct brw_context *brw = brw_context(pipe);
22 unsigned i;
23
24 /* Check for no change */
25 if (count == brw->curr.num_vertex_buffers &&
26 memcmp(brw->curr.vertex_buffer,
27 buffers,
28 count * sizeof buffers[0]) == 0)
29 return;
30
31 /* Adjust refcounts */
32 for (i = 0; i < count; i++)
33 pipe_buffer_reference(&brw->curr.vertex_buffer[i].buffer,
34 buffers[i].buffer);
35
36 for ( ; i < brw->curr.num_vertex_buffers; i++)
37 pipe_buffer_reference(&brw->curr.vertex_buffer[i].buffer,
38 NULL);
39
40 /* Copy remaining data */
41 memcpy(brw->curr.vertex_buffer, buffers, count * sizeof buffers[0]);
42 brw->curr.num_vertex_buffers = count;
43
44 brw->state.dirty.mesa |= PIPE_NEW_VERTEX_BUFFER;
45 }
46
47
48 void
49 brw_pipe_vertex_init( struct brw_context *brw )
50 {
51 brw->base.set_vertex_buffers = brw_set_vertex_buffers;
52 brw->base.set_vertex_elements = brw_set_vertex_elements;
53 }
54
55
56 void
57 brw_pipe_vertex_cleanup( struct brw_context *brw )
58 {
59
60 /* Release bound pipe vertex_buffers
61 */
62
63 /* Release some other stuff
64 */
65 #if 0
66 for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
67 bo_reference(&brw->vb.inputs[i].bo, NULL);
68 brw->vb.inputs[i].bo = NULL;
69 }
70 #endif
71 }