diff options
author | Marek Olšák <marek.olsak@amd.com> | 2020-11-22 02:22:45 -0500 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2021-01-04 19:22:33 -0500 |
commit | cbdc00ac3a6170e61d36233560e5b3ce83098906 (patch) | |
tree | 32adbb313cdcc2c249a194d61446b747bcacf75d /src/gallium/drivers/nouveau/nvc0 | |
parent | f2e281c231920c29fab0a72771696aba30c54e0d (diff) |
nouveau: fix handling draw info
index_bias is undefined if index_size == 0.
index bounds are undefined if index_bounds_valid == false.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7679>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c index 5cf02387da3..9b8c05450af 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c @@ -945,8 +945,13 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, int s; /* NOTE: caller must ensure that (min_index + index_bias) is >= 0 */ - nvc0->vb_elt_first = info->min_index + info->index_bias; - nvc0->vb_elt_limit = info->max_index - info->min_index; + if (info->index_bounds_valid) { + nvc0->vb_elt_first = info->min_index + (info->index_size ? info->index_bias : 0); + nvc0->vb_elt_limit = info->max_index - info->min_index; + } else { + nvc0->vb_elt_first = 0; + nvc0->vb_elt_limit = ~0; + } nvc0->instance_off = info->start_instance; nvc0->instance_max = info->instance_count - 1; @@ -1029,7 +1034,7 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(0)); BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 3); PUSH_DATA (push, NVC0_CB_AUX_DRAW_INFO); - PUSH_DATA (push, info->index_bias); + PUSH_DATA (push, info->index_size ? info->index_bias : 0); PUSH_DATA (push, info->start_instance); PUSH_DATA (push, info->drawid); } @@ -1111,7 +1116,7 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info, nvc0_draw_stream_output(nvc0, info, indirect); } else if (info->index_size) { - bool shorten = info->max_index <= 65535; + bool shorten = info->index_bounds_valid && info->max_index <= 65535; if (info->primitive_restart && info->restart_index > 65535) shorten = false; |