diff options
author | Christoph Bumiller <[email protected]> | 2012-05-16 21:08:37 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-05-17 15:24:58 +0200 |
commit | e6caafd9d7fbfcb5906d22be9d6a3c1714e078ac (patch) | |
tree | 3e933ed79288c21fa45d3ce697ea5ca8196ee9f5 /src/gallium/drivers/nvc0/nvc0_state.c | |
parent | ef7bb281292c17b762b57779306e874704c87328 (diff) |
nv50,nvc0: handle user vertex buffers
And restructure VBO validation a little in the process.
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_state.c')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index 5eee9d4bf88..01bd5cef484 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -756,13 +756,20 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, uint32_t constant_vbos = 0; unsigned i; + nvc0->vbo_user = 0; + if (count != nvc0->num_vtxbufs) { for (i = 0; i < count; ++i) { pipe_resource_reference(&nvc0->vtxbuf[i].buffer, vb[i].buffer); - nvc0->vtxbuf[i].buffer_offset = vb[i].buffer_offset; + if (vb[i].user_buffer) { + nvc0->vbo_user |= 1 << i; + nvc0->vtxbuf[i].user_buffer = vb[i].user_buffer; + if (!vb[i].stride) + constant_vbos |= 1 << i; + } else { + nvc0->vtxbuf[i].buffer_offset = vb[i].buffer_offset; + } nvc0->vtxbuf[i].stride = vb[i].stride; - if (!vb[i].stride) - constant_vbos |= 1 << i; } for (; i < nvc0->num_vtxbufs; ++i) pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL); @@ -771,6 +778,13 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, nvc0->dirty |= NVC0_NEW_ARRAYS; } else { for (i = 0; i < count; ++i) { + if (vb[i].user_buffer) { + nvc0->vtxbuf[i].user_buffer = vb[i].user_buffer; + nvc0->vbo_user |= 1 << i; + if (!vb[i].stride) + constant_vbos |= 1 << i; + assert(!vb[i].buffer); + } if (nvc0->vtxbuf[i].buffer == vb[i].buffer && nvc0->vtxbuf[i].buffer_offset == vb[i].buffer_offset && nvc0->vtxbuf[i].stride == vb[i].stride) @@ -778,10 +792,7 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe, pipe_resource_reference(&nvc0->vtxbuf[i].buffer, vb[i].buffer); nvc0->vtxbuf[i].buffer_offset = vb[i].buffer_offset; nvc0->vtxbuf[i].stride = vb[i].stride; - if (likely(vb[i].stride)) - nvc0->dirty |= NVC0_NEW_ARRAYS; - else - constant_vbos |= 1 << i; + nvc0->dirty |= NVC0_NEW_ARRAYS; } } if (constant_vbos != nvc0->constant_vbos) { |