mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
Hold the vertex buffer handle.
This commit is contained in:
parent
44e6944e9d
commit
fe55eab8fa
2 changed files with 13 additions and 8 deletions
|
|
@ -81,6 +81,8 @@ struct vbuf_stage {
|
|||
ushort *element_map;
|
||||
unsigned nr_elements;
|
||||
|
||||
struct pipe_buffer_handle *buf;
|
||||
|
||||
unsigned prim;
|
||||
|
||||
struct i915_context *i915;
|
||||
|
|
@ -278,7 +280,6 @@ static void vbuf_draw( struct draw_stage *stage )
|
|||
unsigned hwprim;
|
||||
unsigned i;
|
||||
char *ptr;
|
||||
struct pipe_buffer_handle *buf;
|
||||
|
||||
switch(vbuf->prim) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
|
|
@ -298,9 +299,11 @@ static void vbuf_draw( struct draw_stage *stage )
|
|||
assert(vbuf->vertex_ptr - vbuf->vertex_map == vbuf->nr_vertices * vertex_size / 4);
|
||||
|
||||
/* FIXME: handle failure */
|
||||
buf = winsys->buffer_create(winsys, 64);
|
||||
winsys->buffer_data(winsys, buf, 8 + nr * vertex_size, NULL);
|
||||
ptr = winsys->buffer_map(winsys, buf, PIPE_BUFFER_FLAG_WRITE);
|
||||
if(!vbuf->buf)
|
||||
vbuf->buf = winsys->buffer_create(winsys, 64);
|
||||
|
||||
winsys->buffer_data(winsys, vbuf->buf, 8 + nr * vertex_size, NULL);
|
||||
ptr = winsys->buffer_map(winsys, vbuf->buf, PIPE_BUFFER_FLAG_WRITE);
|
||||
*(unsigned *)ptr = _3DPRIMITIVE |
|
||||
hwprim |
|
||||
((4 + vertex_size * nr)/4 - 2);
|
||||
|
|
@ -313,7 +316,7 @@ static void vbuf_draw( struct draw_stage *stage )
|
|||
}
|
||||
*(unsigned *)ptr = MI_BATCH_BUFFER_END;
|
||||
ptr += 4;
|
||||
winsys->buffer_unmap(winsys, buf);
|
||||
winsys->buffer_unmap(winsys, vbuf->buf);
|
||||
|
||||
if (i915->dirty)
|
||||
i915_update_derived( i915 );
|
||||
|
|
@ -345,12 +348,10 @@ static void vbuf_draw( struct draw_stage *stage )
|
|||
/* chain the vertex buffer in the batch buffer */
|
||||
OUT_BATCH(MI_BATCH_BUFFER_START
|
||||
| (2 << 6) /* GTT-mapped memory */);
|
||||
OUT_RELOC( buf, I915_BUFFER_ACCESS_READ, 0 );
|
||||
OUT_RELOC( vbuf->buf, I915_BUFFER_ACCESS_READ, 0 );
|
||||
/* FIXME: we need to flush here since control after chained buffers returns
|
||||
* directly to the ring buffer */
|
||||
FLUSH_BATCH();
|
||||
|
||||
winsys->buffer_reference(winsys, &buf, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ struct i915_winsys {
|
|||
unsigned delta );
|
||||
void (*batch_flush)( struct i915_winsys *sws );
|
||||
|
||||
#if 0
|
||||
void (*batch_chain)( struct i915_winsys *sws,
|
||||
struct pipe_buffer_handle *buf ):
|
||||
#endif
|
||||
};
|
||||
|
||||
#define I915_BUFFER_ACCESS_WRITE 0x1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue