diff options
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 33 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 35 |
2 files changed, 68 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) { diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index f8dab0cdaa7..ad54c3b38b3 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1176,6 +1176,40 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count) } +static void GLAPIENTRY +_save_OBE_MultiDrawArrays(GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (!_mesa_is_valid_prim_mode(ctx, mode)) { + _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMultiDrawArrays(mode)"); + return; + } + + if (primcount < 0) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, + "glMultiDrawArrays(primcount<0)"); + return; + } + + for (i = 0; i < primcount; i++) { + if (count[i] < 0) { + _mesa_compile_error(ctx, GL_INVALID_VALUE, + "glMultiDrawArrays(count[i]<0)"); + return; + } + } + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + _save_OBE_DrawArrays(mode, first[i], count[i]); + } + } +} + + /* Could do better by copying the arrays and element list intact and * then emitting an indexed prim at runtime. */ @@ -1484,6 +1518,7 @@ vbo_initialize_save_dispatch(const struct gl_context *ctx, struct _glapi_table *exec) { SET_DrawArrays(exec, _save_OBE_DrawArrays); + SET_MultiDrawArrays(exec, _save_OBE_MultiDrawArrays); SET_DrawElements(exec, _save_OBE_DrawElements); SET_DrawElementsBaseVertex(exec, _save_OBE_DrawElementsBaseVertex); SET_DrawRangeElements(exec, _save_OBE_DrawRangeElements); |