diff options
author | Marek Olšák <[email protected]> | 2012-04-19 01:24:32 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-04-24 01:39:22 +0200 |
commit | a0e352f5ebac0f533481d353b7f3ba66b3a9ed7f (patch) | |
tree | 2b6ec5d40a0db94b9faf4aec06721f2526c3e28c /src | |
parent | 039f53b814cef8fce0f591e3ff36a68f4780b620 (diff) |
u_vbuf: simplify u_vbuf_set_vertex_buffers
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index 15fdef443bd..3c6dc9a3ab1 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -689,43 +689,36 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr, unsigned count, mgr->incompatible_vb_layout = FALSE; memset(mgr->incompatible_vb, 0, sizeof(mgr->incompatible_vb)); - if (!mgr->caps.fetch_dword_unaligned) { - /* Check if the strides and offsets are aligned to the size of DWORD. */ - for (i = 0; i < count; i++) { - if (bufs[i].buffer) { - if (bufs[i].stride % 4 != 0 || - bufs[i].buffer_offset % 4 != 0) { - mgr->incompatible_vb_layout = TRUE; - mgr->incompatible_vb[i] = TRUE; - } - } - } - } - for (i = 0; i < count; i++) { const struct pipe_vertex_buffer *vb = &bufs[i]; + struct pipe_vertex_buffer *orig_vb = &mgr->vertex_buffer[i]; + struct pipe_vertex_buffer *real_vb = &mgr->real_vertex_buffer[i]; - pipe_resource_reference(&mgr->vertex_buffer[i].buffer, vb->buffer); + pipe_resource_reference(&orig_vb->buffer, vb->buffer); - mgr->real_vertex_buffer[i].buffer_offset = - mgr->vertex_buffer[i].buffer_offset = vb->buffer_offset; + real_vb->buffer_offset = orig_vb->buffer_offset = vb->buffer_offset; + real_vb->stride = orig_vb->stride = vb->stride; - mgr->real_vertex_buffer[i].stride = - mgr->vertex_buffer[i].stride = vb->stride; + if (!vb->buffer) { + pipe_resource_reference(&real_vb->buffer, NULL); + continue; + } - if (!vb->buffer || - mgr->incompatible_vb[i]) { - pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL); + if (!mgr->caps.fetch_dword_unaligned && + (vb->stride % 4 != 0 || vb->buffer_offset % 4 != 0)) { + mgr->incompatible_vb[i] = TRUE; + mgr->incompatible_vb_layout = TRUE; + pipe_resource_reference(&real_vb->buffer, NULL); continue; } if (vb->buffer->user_ptr) { - pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL); mgr->any_user_vbs = TRUE; + pipe_resource_reference(&real_vb->buffer, NULL); continue; } - pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, vb->buffer); + pipe_resource_reference(&real_vb->buffer, vb->buffer); } for (i = count; i < mgr->nr_vertex_buffers; i++) { |