nvk: Do not increment instance id across draws

In cases of multiple draws (i.e. indirect draws) instance id should not
increment across draw boundaries. Use a local copy of "begin" to modify
the instance id inside the instances loop only.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
George Ouzounoudis 2022-11-09 19:50:32 +02:00 committed by Marge Bot
parent ff30b05917
commit 0de4083544

View file

@ -1436,6 +1436,11 @@ nvk_build_mme_draw(struct mme_builder *b, struct mme_value begin)
mme_mthd(b, NV9097_SET_GLOBAL_BASE_INSTANCE_INDEX);
mme_emit(b, first_instance);
/* Make a copy of begin because this helper may be called inside an MME loop
* (i.e. indirect draws) and we're going to modify the value of begin below.
*/
begin = mme_mov(b, begin);
mme_loop(b, instance_count) {
mme_mthd(b, NV9097_BEGIN);
mme_emit(b, begin);
@ -1509,6 +1514,11 @@ nvk_mme_build_draw_indexed(struct mme_builder *b,
mme_mthd(b, NV9097_SET_GLOBAL_BASE_INSTANCE_INDEX);
mme_emit(b, first_instance);
/* Make a copy of begin because this helper may be called inside an MME loop
* (i.e. indirect draws) and we're going to modify the value of begin below.
*/
begin = mme_mov(b, begin);
mme_loop(b, instance_count) {
mme_mthd(b, NV9097_BEGIN);
mme_emit(b, begin);