From 3d08e18731bfd39609914bd41e89b9b6d898fd3e Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 31 Mar 2017 15:38:48 +1100 Subject: [PATCH] mesa/vbo: add KHR_no_error support to vbo_exec_DrawArrays*() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit V2: add missing FLUSH_CURRENT() to no_error path Reviewed-by: Nicolai Hähnle --- src/mesa/vbo/vbo_exec_array.c | 49 ++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index ac27b49fcb5..7cc5288c6b4 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -625,8 +625,15 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n", _mesa_enum_to_string(mode), start, count); - if (!_mesa_validate_DrawArrays(ctx, mode, count)) - return; + if (_mesa_is_no_error_enabled(ctx)) { + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state(ctx); + } else { + if (!_mesa_validate_DrawArrays(ctx, mode, count)) + return; + } if (0) check_draw_arrays_data(ctx, start, count); @@ -652,9 +659,17 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n", _mesa_enum_to_string(mode), start, count, numInstances); - if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, - numInstances)) - return; + + if (_mesa_is_no_error_enabled(ctx)) { + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state(ctx); + } else { + if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, + numInstances)) + return; + } if (0) check_draw_arrays_data(ctx, start, count); @@ -682,9 +697,16 @@ vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first, _mesa_enum_to_string(mode), first, count, numInstances, baseInstance); - if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count, - numInstances)) - return; + if (_mesa_is_no_error_enabled(ctx)) { + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state(ctx); + } else { + if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count, + numInstances)) + return; + } if (0) check_draw_arrays_data(ctx, first, count); @@ -1567,8 +1589,15 @@ vbo_exec_DrawArraysIndirect(GLenum mode, const GLvoid *indirect) _mesa_debug(ctx, "glDrawArraysIndirect(%s, %p)\n", _mesa_enum_to_string(mode), indirect); - if (!_mesa_validate_DrawArraysIndirect(ctx, mode, indirect)) - return; + if (_mesa_is_no_error_enabled(ctx)) { + FLUSH_CURRENT(ctx, 0); + + if (ctx->NewState) + _mesa_update_state(ctx); + } else { + if (!_mesa_validate_DrawArraysIndirect(ctx, mode, indirect)) + return; + } if (skip_validated_draw(ctx)) return; -- 2.30.2