Mesa (master): vbo: Fix basevertex handling in display list compiles.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 05:34:59 UTC 2019
Module: Mesa
Branch: master
Commit: a503f0562ae9b98802c89cb163f34a75cf240330
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a503f0562ae9b98802c89cb163f34a75cf240330
Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date: Fri Mar 1 09:27:54 2019 +0100
vbo: Fix basevertex handling in display list compiles.
The standard requires that the primitive restart comparison happens before
the basevertex value is added. Do this now, drop a reference to the standard
why this happens at this place.
Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
src/mesa/vbo/vbo_save_api.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index bb578694e00..7f8c06b630c 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1373,8 +1373,15 @@ _save_OBE_MultiDrawArrays(GLenum mode, const GLint *first,
static void
-array_element(struct gl_context *ctx, struct _glapi_table *disp, GLuint elt)
+array_element(struct gl_context *ctx, struct _glapi_table *disp,
+ GLint basevertex, GLuint elt)
{
+ /* Section 10.3.5 Primitive Restart:
+ * [...]
+ * When one of the *BaseVertex drawing commands specified in section 10.5
+ * is used, the primitive restart comparison occurs before the basevertex
+ * offset is added to the array index.
+ */
/* If PrimitiveRestart is enabled and the index is the RestartIndex
* then we call PrimitiveRestartNV and return.
*/
@@ -1383,7 +1390,7 @@ array_element(struct gl_context *ctx, struct _glapi_table *disp, GLuint elt)
return;
}
- _mesa_array_element(ctx, disp, elt);
+ _mesa_array_element(ctx, disp, basevertex + elt);
}
@@ -1432,15 +1439,15 @@ _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]);
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]);
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]);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)");
More information about the mesa-commit
mailing list