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 <ria.freelander@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Konstantin 2022-12-02 16:22:15 +03:00
parent d1f142891e
commit baaddf47d5

View File

@ -307,6 +307,10 @@ glamor_gldrawarrays_quads_using_indices(glamor_screen_private *glamor_priv,
{ {
unsigned i; 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. */ /* For a single quad, don't bother with an index buffer. */
if (count == 1) if (count == 1)
goto fallback; goto fallback;