Mesa (master): gallium/u_threaded: skip draws if user index buffer size has size == 0
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Jan 9 07:10:54 UTC 2021
Module: Mesa
Branch: master
Commit: be50c7f329707a4501fd8e4fc1d7ddeeead0353e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=be50c7f329707a4501fd8e4fc1d7ddeeead0353e
Author: Marek Olšák <marek.olsak at amd.com>
Date: Tue Jan 5 23:14:55 2021 -0500
gallium/u_threaded: skip draws if user index buffer size has size == 0
This happens when all draws have count == 0.
Fixes: 85b6ba136bdc2db5 "st/mesa: implement Driver.DrawGallium callbacks
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8345>
---
src/gallium/auxiliary/util/u_threaded_context.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index bdd1ac99fb0..7d5150528bc 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -2401,6 +2401,9 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
struct pipe_resource *buffer = NULL;
unsigned offset;
+ if (!size)
+ return;
+
/* This must be done before adding draw_vbo, because it could generate
* e.g. transfer_unmap and flush partially-uninitialized draw_vbo
* to the driver if it was done afterwards.
@@ -2445,6 +2448,9 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
for (unsigned i = 0; i < num_draws; i++)
total_count += draws[i].count;
+ if (!total_count)
+ return;
+
/* Allocate space for all index buffers.
*
* This must be done before adding draw_vbo, because it could generate
More information about the mesa-commit
mailing list