From c716827f697956960c354277bb5eae2b17925913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 23 Aug 2022 15:02:48 -0400 Subject: [PATCH] glthread: fix draws not compiled into a display list should generate an error Before it just crashed if indices were invalid. Cc: stable Acked-by: Adam Jackson Part-of: --- src/mesa/main/glthread_draw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/glthread_draw.c b/src/mesa/main/glthread_draw.c index 274db8b475c..3af1d3d3e06 100644 --- a/src/mesa/main/glthread_draw.c +++ b/src/mesa/main/glthread_draw.c @@ -396,7 +396,9 @@ draw_arrays(GLenum mode, GLint first, GLsizei count, GLsizei instance_count, * for possible GL errors. */ if (ctx->API == API_OPENGL_CORE || !user_buffer_mask || - count <= 0 || instance_count <= 0) { + count <= 0 || instance_count <= 0 || + /* This will just generate GL_INVALID_OPERATION, as it should. */ + (!compiled_into_dlist && ctx->GLThread.ListMode)) { draw_arrays_async(ctx, mode, first, count, instance_count, baseinstance); return; } @@ -794,7 +796,9 @@ draw_elements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, if (ctx->API == API_OPENGL_CORE || count <= 0 || instance_count <= 0 || max_index < min_index || !is_index_type_valid(type) || - (!user_buffer_mask && !has_user_indices)) { + (!user_buffer_mask && !has_user_indices) || + /* This will just generate GL_INVALID_OPERATION, as it should. */ + (!compiled_into_dlist && ctx->GLThread.ListMode)) { draw_elements_async(ctx, mode, count, type, indices, instance_count, basevertex, baseinstance, index_bounds_valid, min_index, max_index);