Mesa (main): util/primconvert: handle indirect draws
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 23 03:52:35 UTC 2021
Module: Mesa
Branch: main
Commit: 26e718fb37a99adf13ae503155de6a144a323ec1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=26e718fb37a99adf13ae503155de6a144a323ec1
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Fri May 21 06:31:31 2021 -0400
util/primconvert: handle indirect draws
this avoids ping-ponging to the driver, which would have to call back
to here anyway with the unwrapped indirect draw
Reviewed-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10973>
---
src/gallium/auxiliary/indices/u_primconvert.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/gallium/auxiliary/indices/u_primconvert.c b/src/gallium/auxiliary/indices/u_primconvert.c
index b18ddce6a68..c37dbe11dc7 100644
--- a/src/gallium/auxiliary/indices/u_primconvert.c
+++ b/src/gallium/auxiliary/indices/u_primconvert.c
@@ -119,14 +119,18 @@ util_primconvert_draw_vbo(struct primconvert_context *pc,
void *dst;
unsigned ib_offset;
- /* indirect emulated prims is not possible, as we need to know
- * draw start/count, so we must emulate. Too bad, so sad, but
- * we are already off the fast-path here.
- */
if (indirect && indirect->buffer) {
- /* num_draws is only applicable for direct draws: */
- assert(num_draws == 1);
- util_draw_indirect(pc->pipe, info, indirect);
+ /* this is stupid, but we're already doing a readback,
+ * so this thing may as well get the rest of the job done
+ */
+ unsigned draw_count = 0;
+ struct u_indirect_params *new_draws = util_draw_indirect_read(pc->pipe, info, indirect, &draw_count);
+ if (!new_draws)
+ return;
+
+ for (unsigned i = 0; i < draw_count; i++)
+ util_primconvert_draw_vbo(pc, &new_draws[i].info, drawid_offset + i, NULL, &new_draws[i].draw, 1);
+ free(new_draws);
return;
}
More information about the mesa-commit
mailing list