When using glDrawElements with glPrimitiveRestartIndexNV during the compilation of a render list, there is a crash when Mesa reaches the second restart index of the array.
The reason is that when PrimitiveRestartNV is called internally the first time, save_PrimitiveRestartNV() (in \src\mesa\vbo\vbo_save_api.c) is called. It executes _save_End() and _save_Begin(curPrim), but _save_Begin() is a noop function that merely raises an OpenGL error "Recursive glBegin".
I have replaced the content of save_PrimitiveRestartNV() by the following code to make it work:
static void GLAPIENTRY
/* get current primitive mode */
struct vbo_save_context *save = &vbo_context(ctx)->save;
if (save->prim_count == 0) return;
const GLuint i = save->prim_count - 1;
curPrim = save->prim[i].mode;
/* restart primitive */
vbo_save_NotifyBegin(ctx, (curPrim | VBO_SAVE_PRIM_WEAK
Contrarily to what is stated, ctx->Driver.CurrentSavePrimitive is not correctly set before _save_PrimitiveRestartNV() is called, whence this intricate code to get the current primitive mode...
I've committed a patch based on your suggestion (commit f5c8bb1e00f358e05ed21f8ed69c9fc3803bf95f) plus an patch for another failure case (commit 9ac55e8219e1f6abeab3c779c8fe710c2bc25f2b).
Closing this bug.