summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arrayobj.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2018-01-24 09:14:35 -0700
committerBrian Paul <[email protected]>2018-01-29 08:35:14 -0700
commit0d044f7d619c56c67d8235312363d93e2362248f (patch)
tree14c151223842438d386f5369075b007f44d4c377 /src/mesa/main/arrayobj.c
parentd9894ede02d13735c62da3e0ace9e9c647e2956a (diff)
mesa/vbo: replace vbo_draw_method() with _mesa_set_drawing_arrays()
The arrays specified by ctx->Array._DrawArrays are used for all vertex drawing via vbo_context::draw_prims(). Different arrays are used for immediate mode, vertex arrays, display lists, etc. Changing from one to another requires updating derived/driver array state. Before, we indirectly specifid the arrays with the gl_draw_method values. Now we just directly specify the arrays instead. This is simpler and will allow a subsequent display list optimization. In the future, it might make sense to get rid of ctx->Array._DrawArrays entirely and just pass the arrays as another parameter to vbo_context::draw_prims(). Reviewed-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/main/arrayobj.c')
-rw-r--r--src/mesa/main/arrayobj.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 0f474243a78..2810647c7e7 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -433,20 +433,17 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, bool no_error)
newObj->EverBound = GL_TRUE;
}
- if (ctx->Array.DrawMethod == DRAW_ARRAYS) {
- /* The _DrawArrays pointer is pointing at the VAO being unbound and
- * that VAO may be in the process of being deleted. If it's not going
- * to be deleted, this will have no effect, because the pointer needs
- * to be updated by the VBO module anyway.
- *
- * Before the VBO module can update the pointer, we have to set it
- * to NULL for drivers not to set up arrays which are not bound,
- * or to prevent a crash if the VAO being unbound is going to be
- * deleted.
- */
- ctx->Array._DrawArrays = NULL;
- ctx->Array.DrawMethod = DRAW_NONE;
- }
+ /* The _DrawArrays pointer is pointing at the VAO being unbound and
+ * that VAO may be in the process of being deleted. If it's not going
+ * to be deleted, this will have no effect, because the pointer needs
+ * to be updated by the VBO module anyway.
+ *
+ * Before the VBO module can update the pointer, we have to set it
+ * to NULL for drivers not to set up arrays which are not bound,
+ * or to prevent a crash if the VAO being unbound is going to be
+ * deleted.
+ */
+ _mesa_set_drawing_arrays(ctx, NULL);
ctx->NewState |= _NEW_ARRAY;
_mesa_reference_vao(ctx, &ctx->Array.VAO, newObj);