Mesa (master): mesa: Use _mesa_array_element in dlist save.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 05:34:59 UTC 2019
Module: Mesa
Branch: master
Commit: b43fae364f8ac27cf782fbbdd699aa9ec4ee6b89
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b43fae364f8ac27cf782fbbdd699aa9ec4ee6b89
Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date: Fri Mar 1 09:27:53 2019 +0100
mesa: Use _mesa_array_element in dlist save.
Make use of the newly factored out _mesa_array_element function
in display list compilation. For now that duplicates out the
primitive restart logic. But that turns out to need a fix in
display list handling anyhow.
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 | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index fb8d68d5560..6122727bae9 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1330,7 +1330,7 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
vbo_save_NotifyBegin(ctx, mode, true);
for (i = 0; i < count; i++)
- CALL_ArrayElement(GET_DISPATCH(), (start + i));
+ _mesa_array_element(ctx, GET_DISPATCH(), start + i);
CALL_End(GET_DISPATCH(), ());
_ae_unmap_vbos(ctx);
@@ -1371,6 +1371,21 @@ _save_OBE_MultiDrawArrays(GLenum mode, const GLint *first,
}
+static void
+array_element(struct gl_context *ctx, struct _glapi_table *disp, GLuint elt)
+{
+ /* If PrimitiveRestart is enabled and the index is the RestartIndex
+ * then we call PrimitiveRestartNV and return.
+ */
+ if (ctx->Array.PrimitiveRestart && elt == ctx->Array.RestartIndex) {
+ CALL_PrimitiveRestartNV(disp, ());
+ return;
+ }
+
+ _mesa_array_element(ctx, disp, elt);
+}
+
+
/* Could do better by copying the arrays and element list intact and
* then emitting an indexed prim at runtime.
*/
@@ -1415,15 +1430,15 @@ _save_OBE_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
switch (type) {
case GL_UNSIGNED_BYTE:
for (i = 0; i < count; i++)
- CALL_ArrayElement(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++)
- CALL_ArrayElement(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++)
- CALL_ArrayElement(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