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>
This commit is contained in:
Mike Blumenkrantz
2024-04-24 11:32:29 -04:00
committed by Marge Bot
parent f153f945fc
commit 4660ee1dea

View File

@@ -816,7 +816,9 @@ draw_elements(GLuint drawid, GLenum mode, GLsizei count, GLenum type,
!_mesa_is_index_type_valid(type) || /* GL_INVALID_VALUE */
ctx->Dispatch.Current == ctx->Dispatch.ContextLost || /* GL_INVALID_OPERATION */
ctx->GLThread.inside_begin_end || /* GL_INVALID_OPERATION */
ctx->GLThread.ListMode))) { /* GL_INVALID_OPERATION */
ctx->GLThread.ListMode || /* GL_INVALID_OPERATION */
mode >= 32 || !((1u << mode) & ctx->SupportedPrimMask) /* GL_INVALID_ENUM */
))) {
if (drawid == 0 && baseinstance == 0) {
if (instance_count == 1 && basevertex == 0) {
if ((count & 0xffff) == count && (uintptr_t)indices <= UINT16_MAX) {
@@ -1156,7 +1158,8 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
*/
if (draw_count > 0 && _mesa_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;
}