Small patch for nv50_vbo.c
Hi all!
I saw TODO comment in nv50_vbo.c and decided to look at similar file, nvc0_vbo.c. I copied those two lines into nv50 with slight name change (nvc0->nv50) and apparently it doesn't fix any OpenGL app I have, but does not broke them further (I have compute pacthes currently applied, so some breakage expected).
src/gallium/drivers/nouveau/nv50/nv50_vbo.c +6 -2
@@ -189,8 +189,12 @@ nv50_user_vbuf_range(struct nv50_context *nv50, unsigned vbi,assert (vbi <PIPE_MAX_ATTRIBS );if (unlikely (nv50->vertex->instance_bufs & (1 << vbi))) {/* TODO: use min and max instance divisor to get a proper range */ - *base =0 ; - *size = nv50->vtxbuf[vbi].buffer.resource->width0; +const uint32_t div = nv50->vertex->min_instance_div[vbi]; + *base = nv50->instance_off * nv50->vtxbuf[vbi].stride; + *size = (nv50->instance_max / div) * nv50->vtxbuf[vbi].stride + + nv50->vertex->vb_access_size[vbi]; +// *base = 0; +// *size = nv50->vtxbuf[vbi].buffer.resource->width0; }else {/* NOTE: if there are user buffers, we *must* have index bounds */ assert (nv50->vb_elt_limit != ~0 );
Does this look correct?
This isn't meant to fix applications, it's meant to limit the range of access to the buffer, for robustness/etc reasons. One would have to look very carefully, as all this logic is rather tricky.
Quoted 32 lines · Andrew Randrianasulu
Hi all!
I saw TODO comment in
nv50_vbo.cand decided to look at similar file,nvc0_vbo.c. I copied those two lines into nv50 with slight name change (nvc0->nv50) and apparently it doesn't fix any OpenGL app I have, but does not broke them further (I have compute pacthes currently applied, so some breakage expected).src/gallium/drivers/nouveau/nv50/nv50_vbo.c +6
-2@@ -189,8 +189,12 @@ nv50_user_vbuf_range(struct nv50_context *nv50, unsigned vbi,assert (vbi <PIPE_MAX_ATTRIBS );if (unlikely (nv50->vertex->instance_bufs & (1 << vbi))) {/* TODO: use min and max instance divisor to get a proper range */ - *base =0 ; - *size = nv50->vtxbuf[vbi].buffer.resource->width0; +const uint32_t div = nv50->vertex->min_instance_div[vbi]; + *base = nv50->instance_off * nv50->vtxbuf[vbi].stride; + *size = (nv50->instance_max / div) * nv50->vtxbuf[vbi].stride + + nv50->vertex->vb_access_size[vbi]; +// *base = 0; +// *size = nv50->vtxbuf[vbi].buffer.resource->width0; }else {/* NOTE: if there are user buffers, we *must* have index bounds */ assert (nv50->vb_elt_limit != ~0 );Does this look correct?
_______________________________________________
Nouveau mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau