[Mesa-stable] [Mesa-dev] [PATCH] vbo: allow DrawElementsBaseVertex in display lists

Marek Olšák maraeo at gmail.com
Sun Aug 14 11:55:20 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sun, Aug 14, 2016 at 8:30 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Looks like it was missed originally. The multi version is there somehow.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97331
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/mesa/vbo/vbo_save_api.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
> index 650c9b6..f648ccc 100644
> --- a/src/mesa/vbo/vbo_save_api.c
> +++ b/src/mesa/vbo/vbo_save_api.c
> @@ -1176,8 +1176,8 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
>   * then emitting an indexed prim at runtime.
>   */
>  static void GLAPIENTRY
> -_save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
> -                       const GLvoid * indices)
> +_save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
> +                                 const GLvoid * indices, GLint basevertex)
>  {
>     GET_CURRENT_CONTEXT(ctx);
>     struct vbo_save_context *save = &vbo_context(ctx)->save;
> @@ -1214,15 +1214,15 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
>     switch (type) {
>     case GL_UNSIGNED_BYTE:
>        for (i = 0; i < count; i++)
> -         CALL_ArrayElement(GET_DISPATCH(), (((GLubyte *) indices)[i]));
> +         CALL_ArrayElement(GET_DISPATCH(), (basevertex + ((GLubyte *) indices)[i]));
>        break;
>     case GL_UNSIGNED_SHORT:
>        for (i = 0; i < count; i++)
> -         CALL_ArrayElement(GET_DISPATCH(), (((GLushort *) indices)[i]));
> +         CALL_ArrayElement(GET_DISPATCH(), (basevertex + ((GLushort *) indices)[i]));
>        break;
>     case GL_UNSIGNED_INT:
>        for (i = 0; i < count; i++)
> -         CALL_ArrayElement(GET_DISPATCH(), (((GLuint *) indices)[i]));
> +         CALL_ArrayElement(GET_DISPATCH(), (basevertex + ((GLuint *) indices)[i]));
>        break;
>     default:
>        _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)");
> @@ -1234,6 +1234,13 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
>     _ae_unmap_vbos(ctx);
>  }
>
> +static void GLAPIENTRY
> +_save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
> +                       const GLvoid * indices)
> +{
> +   _save_OBE_DrawElementsBaseVertex(mode, count, type, indices, 0);
> +}
> +
>
>  static void GLAPIENTRY
>  _save_OBE_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
> @@ -1471,6 +1478,7 @@ vbo_initialize_save_dispatch(const struct gl_context *ctx,
>  {
>     SET_DrawArrays(exec, _save_OBE_DrawArrays);
>     SET_DrawElements(exec, _save_OBE_DrawElements);
> +   SET_DrawElementsBaseVertex(exec, _save_OBE_DrawElementsBaseVertex);
>     SET_DrawRangeElements(exec, _save_OBE_DrawRangeElements);
>     SET_MultiDrawElementsEXT(exec, _save_OBE_MultiDrawElements);
>     SET_MultiDrawElementsBaseVertex(exec, _save_OBE_MultiDrawElementsBaseVertex);
> --
> 2.7.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list