zink: use multidraw

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11498>
This commit is contained in:
Mike Blumenkrantz 2021-01-20 14:29:14 -05:00 committed by Marge Bot
parent b6855b2e18
commit 60ff9dea27
1 changed files with 20 additions and 6 deletions

View File

@ -297,10 +297,17 @@ draw_indexed(struct zink_context *ctx,
} else {
if (needs_drawid)
update_drawid(ctx, draw_id);
for (unsigned i = 0; i < num_draws; i++)
vkCmdDrawIndexed(cmdbuf,
draws[i].count, dinfo->instance_count,
draws[i].start, draws[i].index_bias, dinfo->start_instance);
if (zink_screen(ctx->base.screen)->info.have_EXT_multi_draw)
zink_screen(ctx->base.screen)->vk.CmdDrawMultiIndexedEXT(cmdbuf, num_draws, (VkMultiDrawIndexedInfoEXT*)draws,
dinfo->instance_count,
dinfo->start_instance, sizeof(struct pipe_draw_start_count_bias),
dinfo->index_bias_varies ? NULL : &draws[0].index_bias);
else {
for (unsigned i = 0; i < num_draws; i++)
vkCmdDrawIndexed(cmdbuf,
draws[i].count, dinfo->instance_count,
draws[i].start, draws[i].index_bias, dinfo->start_instance);
}
}
}
@ -322,8 +329,15 @@ draw(struct zink_context *ctx,
} else {
if (needs_drawid)
update_drawid(ctx, draw_id);
for (unsigned i = 0; i < num_draws; i++)
vkCmdDraw(cmdbuf, draws[i].count, dinfo->instance_count, draws[i].start, dinfo->start_instance);
if (zink_screen(ctx->base.screen)->info.have_EXT_multi_draw)
zink_screen(ctx->base.screen)->vk.CmdDrawMultiEXT(cmdbuf, num_draws, (VkMultiDrawInfoEXT*)draws,
dinfo->instance_count, dinfo->start_instance,
sizeof(struct pipe_draw_start_count_bias));
else {
for (unsigned i = 0; i < num_draws; i++)
vkCmdDraw(cmdbuf, draws[i].count, dinfo->instance_count, draws[i].start, dinfo->start_instance);
}
}
}