aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMaarten Lankhorst <[email protected]>2014-03-18 14:47:40 +0100
committerMaarten Lankhorst <[email protected]>2014-03-18 14:51:06 +0100
commit8fe888fafd992474672cdb10aafadd6f60811136 (patch)
tree01f0e41bd86502644c4432ca9fcc8d9729911c60 /src/gallium
parentd70ad1a4f9110d206b079398dc1c3be43894f3e5 (diff)
nvc0: Handle user mapped vertex buffer for edgeflag
Handle mapping edgeflag data similar to the code around it. This fixes a crash in piglit test gl-2.0-edgeflag. Signed-off-by: Maarten Lankhorst <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
index 51e751cfa57..952828a75fc 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
@@ -98,11 +98,16 @@ nvc0_push_map_edgeflag(struct push_context *ctx, struct nvc0_context *nvc0,
struct pipe_vertex_element *ve = &nvc0->vertex->element[attr].pipe;
struct pipe_vertex_buffer *vb = &nvc0->vtxbuf[ve->vertex_buffer_index];
struct nv04_resource *buf = nv04_resource(vb->buffer);
- unsigned offset = vb->buffer_offset + ve->src_offset;
ctx->edgeflag.stride = vb->stride;
- ctx->edgeflag.data = nouveau_resource_map_offset(&nvc0->base,
+ if (buf) {
+ unsigned offset = vb->buffer_offset + ve->src_offset;
+ ctx->edgeflag.data = nouveau_resource_map_offset(&nvc0->base,
buf, offset, NOUVEAU_BO_RD);
+ } else {
+ ctx->edgeflag.data = (const uint8_t *)vb->user_buffer + ve->src_offset;
+ }
+
if (index_bias)
ctx->edgeflag.data += (intptr_t)index_bias * vb->stride;
}