From baaddf47d593b51d215d836a796b95a3cb14a220 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Fri, 2 Dec 2022 16:22:15 +0300 Subject: [PATCH] glamor: fixes GL_INVALID_ENUM errors on ES if there is no quads If there is no quads to draw, then we have a possibility to call glDrawElements with type as zero, which will generate GL_INVALID_ENUM error. While this error is harmless, it is annoying. Signed-off-by: Konstantin Reviewed-by: Adam Jackson --- glamor/glamor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/glamor/glamor.c b/glamor/glamor.c index 617766c2a..848b484cf 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -307,6 +307,10 @@ glamor_gldrawarrays_quads_using_indices(glamor_screen_private *glamor_priv, { unsigned i; + /* If there is no quads to draw, just exit */ + if (count == 0) + return; + /* For a single quad, don't bother with an index buffer. */ if (count == 1) goto fallback;