summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_save_api.c
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2019-03-01 09:27:54 +0100
committerMathias Fröhlich <[email protected]>2019-03-15 06:06:42 +0100
commitd66faa54b2d7c8ad4ba6815a17d4d4e39b798c1f (patch)
tree7030f4b17d9d413a901e2c94d8d3e0ef88b6ca49 /src/mesa/vbo/vbo_save_api.c
parenta503f0562ae9b98802c89cb163f34a75cf240330 (diff)
vbo: Fix GL_PRIMITIVE_RESTART_FIXED_INDEX in display list compiles.
The maximum value primitive restart index is different for each index data type. Use the appropriate fixed restart index value. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_save_api.c')
-rw-r--r--src/mesa/vbo/vbo_save_api.c14
1 files changed, 9 insertions, 5 deletions
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)");