Mesa (master): nv50: fix instancing of client-side vertex buffers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 11 20:13:56 UTC 2021
Module: Mesa
Branch: master
Commit: f763d0f1952151e0fcae596e85600e7f391ea442
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f763d0f1952151e0fcae596e85600e7f391ea442
Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date: Thu Jan 7 20:39:54 2021 -0500
nv50: fix instancing of client-side vertex buffers
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8396>
---
src/gallium/drivers/nouveau/nv50/nv50_vbo.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
index d7172b6008f..16ce34b0224 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
@@ -189,9 +189,10 @@ 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];
} else {
/* NOTE: if there are user buffers, we *must* have index bounds */
assert(nv50->vb_elt_limit != ~0);
More information about the mesa-commit
mailing list