glthread: check for invalid primitive modes in DrawElementsBaseVertex

fixes KHR-GLESEXT.draw_elements_base_vertex_tests.invalid_mode_argument

cc: mesa-stable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28903>
(cherry picked from commit 4660ee1dea)
This commit is contained in:
Mike Blumenkrantz 2024-04-24 11:32:29 -04:00 committed by Eric Engestrom
parent 695c875b04
commit b4af8ee0a5
2 changed files with 5 additions and 3 deletions

View file

@ -2174,7 +2174,7 @@
"description": "glthread: check for invalid primitive modes in DrawElementsBaseVertex",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -790,7 +790,8 @@ draw_elements(GLuint drawid, GLenum mode, GLsizei count, GLenum type,
ctx->Dispatch.Current == ctx->Dispatch.ContextLost ||
/* This will just generate GL_INVALID_OPERATION, as it should. */
ctx->GLThread.inside_begin_end ||
ctx->GLThread.ListMode) {
ctx->GLThread.ListMode ||
mode >= 32 || !((1u << mode) & ctx->SupportedPrimMask)) {
if (instance_count == 1 && baseinstance == 0 && drawid == 0) {
int cmd_size = sizeof(struct marshal_cmd_DrawElementsBaseVertex);
struct marshal_cmd_DrawElementsBaseVertex *cmd =
@ -1059,7 +1060,8 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
*/
if (draw_count > 0 && is_index_type_valid(type) &&
ctx->Dispatch.Current != ctx->Dispatch.ContextLost &&
!ctx->GLThread.inside_begin_end) {
!ctx->GLThread.inside_begin_end &&
!(mode >= 32 || !((1u << mode) & ctx->SupportedPrimMask))) {
user_buffer_mask = _mesa_is_desktop_gl_core(ctx) ? 0 : get_user_buffer_mask(ctx);
has_user_indices = vao->CurrentElementBufferName == 0;
}