Mesa (main): mesa: discard draws with count=0 to decrease overhead
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Oct 21 21:42:18 UTC 2021
Module: Mesa
Branch: main
Commit: 6ef192bddf1e4cf05753b45016c3184b235830c5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ef192bddf1e4cf05753b45016c3184b235830c5
Author: Marek Olšák <marek.olsak at amd.com>
Date: Mon Oct 18 22:25:25 2021 -0400
mesa: discard draws with count=0 to decrease overhead
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13445>
---
src/mesa/main/draw.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c
index 60bef28378a..90b10c00d51 100644
--- a/src/mesa/main/draw.c
+++ b/src/mesa/main/draw.c
@@ -472,9 +472,6 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, GLenum mode, GLsizei count)
if (error)
_mesa_error(ctx, error, "glDrawArrays");
- if (count == 0)
- return false;
-
return !error;
}
@@ -1291,6 +1288,12 @@ static void
_mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
GLsizei count, GLuint numInstances, GLuint baseInstance)
{
+ /* Viewperf has many draws with count=0. Discarding them is faster than
+ * processing them.
+ */
+ if (!count || !numInstances)
+ return;
+
/* OpenGL 4.5 says that primitive restart is ignored with non-indexed
* draws.
*/
@@ -1727,6 +1730,12 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
GLint basevertex, GLuint numInstances,
GLuint baseInstance)
{
+ /* Viewperf has many draws with count=0. Discarding them is faster than
+ * processing them.
+ */
+ if (!count || !numInstances)
+ return;
+
if (!index_bounds_valid) {
assert(start == 0u);
assert(end == ~0u);
More information about the mesa-commit
mailing list