diff options
author | Nicolai Hähnle <[email protected]> | 2017-04-07 18:20:34 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-04-19 08:10:19 +0200 |
commit | 42d5465b9ba85b4918b9e6fb57994720e3c8a80b (patch) | |
tree | 2e66ed87dc79407f27754fc643d00ca02b11fa9e /src/mesa/vbo/vbo_exec_array.c | |
parent | 756e9ebbdd84018382908d3556973a62dbda09ca (diff) |
mesa: move glMultiDrawArrays to vbo and fix error handling
When any count[i] is negative, we must skip all draws.
Moving to vbo makes the subsequent change easier.
v2:
- provide the function in all contexts, including GLES
- adjust validation accordingly to include the xfb check
v3:
- fix mix-up of pre- and post-xfb prim count (Nils Wallménius)
Cc: [email protected]
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_exec_array.c')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 30c52d5fa4f..6858eb30b73 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -637,6 +637,38 @@ vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first, } +/** + * Called from glMultiDrawArrays when in immediate mode. + */ +static void GLAPIENTRY +vbo_exec_MultiDrawArrays(GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, + "glMultiDrawArrays(%s, %p, %p, %d)\n", + _mesa_enum_to_string(mode), first, count, primcount); + + if (!_mesa_validate_MultiDrawArrays(ctx, mode, count, primcount)) + return; + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + if (0) + check_draw_arrays_data(ctx, first[i], count[i]); + + vbo_draw_arrays(ctx, mode, first[i], count[i], 1, 0); + + if (0) + print_draw_arrays(ctx, mode, first[i], count[i]); + } + } +} + + /** * Map GL_ELEMENT_ARRAY_BUFFER and print contents. @@ -1641,6 +1673,7 @@ vbo_initialize_exec_dispatch(const struct gl_context *ctx, SET_DrawRangeElements(exec, vbo_exec_DrawRangeElements); } + SET_MultiDrawArrays(exec, vbo_exec_MultiDrawArrays); SET_MultiDrawElementsEXT(exec, vbo_exec_MultiDrawElements); if (ctx->API == API_OPENGL_COMPAT) { |