summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_push.c
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2012-05-16 21:08:37 +0200
committerChristoph Bumiller <[email protected]>2012-05-17 15:24:58 +0200
commite6caafd9d7fbfcb5906d22be9d6a3c1714e078ac (patch)
tree3e933ed79288c21fa45d3ce697ea5ca8196ee9f5 /src/gallium/drivers/nv50/nv50_push.c
parentef7bb281292c17b762b57779306e874704c87328 (diff)
nv50,nvc0: handle user vertex buffers
And restructure VBO validation a little in the process.
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_push.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_push.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/gallium/drivers/nv50/nv50_push.c b/src/gallium/drivers/nv50/nv50_push.c
index 1f7bc7679f0..eb6bfbccfa7 100644
--- a/src/gallium/drivers/nv50/nv50_push.c
+++ b/src/gallium/drivers/nv50/nv50_push.c
@@ -220,15 +220,17 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info)
ctx.vertex_words = nv50->vertex->vertex_size;
for (i = 0; i < nv50->num_vtxbufs; ++i) {
- uint8_t *data;
- struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
- struct nv04_resource *res = nv04_resource(vb->buffer);
+ const struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
+ const uint8_t *data;
- data = nouveau_resource_map_offset(&nv50->base, res,
- vb->buffer_offset, NOUVEAU_BO_RD);
+ if (unlikely(vb->buffer))
+ data = nouveau_resource_map_offset(&nv50->base,
+ nv04_resource(vb->buffer), vb->buffer_offset, NOUVEAU_BO_RD);
+ else
+ data = vb->user_buffer;
if (apply_bias && likely(!(nv50->vertex->instance_bufs & (1 << i))))
- data += info->index_bias * vb->stride;
+ data += (ptrdiff_t)info->index_bias * vb->stride;
ctx.translate->set_buffer(ctx.translate, i, data, vb->stride, ~0);
}
@@ -304,10 +306,4 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info)
ctx.instance_id++;
ctx.prim |= NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
}
-
- if (info->indexed)
- nouveau_resource_unmap(nv04_resource(nv50->idxbuf.buffer));
-
- for (i = 0; i < nv50->num_vtxbufs; ++i)
- nouveau_resource_unmap(nv04_resource(nv50->vtxbuf[i].buffer));
}