From d66faa54b2d7c8ad4ba6815a17d4d4e39b798c1f Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Fri, 1 Mar 2019 09:27:54 +0100 Subject: vbo: Fix GL_PRIMITIVE_RESTART_FIXED_INDEX in display list compiles. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The maximum value primitive restart index is different for each index data type. Use the appropriate fixed restart index value. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- src/mesa/vbo/vbo_save_api.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/mesa/vbo/vbo_save_api.c') diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 7f8c06b630c..de0be4e3324 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1374,7 +1374,7 @@ _save_OBE_MultiDrawArrays(GLenum mode, const GLint *first, static void array_element(struct gl_context *ctx, struct _glapi_table *disp, - GLint basevertex, GLuint elt) + GLint basevertex, GLuint elt, unsigned index_size) { /* Section 10.3.5 Primitive Restart: * [...] @@ -1385,7 +1385,8 @@ array_element(struct gl_context *ctx, struct _glapi_table *disp, /* If PrimitiveRestart is enabled and the index is the RestartIndex * then we call PrimitiveRestartNV and return. */ - if (ctx->Array.PrimitiveRestart && elt == ctx->Array.RestartIndex) { + if (ctx->Array._PrimitiveRestart && + elt == _mesa_primitive_restart_index(ctx, index_size)) { CALL_PrimitiveRestartNV(disp, ()); return; } @@ -1439,15 +1440,18 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, switch (type) { case GL_UNSIGNED_BYTE: for (i = 0; i < count; i++) - array_element(ctx, GET_DISPATCH(), basevertex, ((GLubyte *) indices)[i]); + array_element(ctx, GET_DISPATCH(), basevertex, + ((GLubyte *) indices)[i], 1); break; case GL_UNSIGNED_SHORT: for (i = 0; i < count; i++) - array_element(ctx, GET_DISPATCH(), basevertex, ((GLushort *) indices)[i]); + array_element(ctx, GET_DISPATCH(), basevertex, + ((GLushort *) indices)[i], 2); break; case GL_UNSIGNED_INT: for (i = 0; i < count; i++) - array_element(ctx, GET_DISPATCH(), basevertex, ((GLuint *) indices)[i]); + array_element(ctx, GET_DISPATCH(), basevertex, + ((GLuint *) indices)[i], 4); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)"); -- cgit v1.2.3