}
+/**
+ * Examine the enabled vertex arrays to set the exec->array.inputs[] values.
+ * These will point to the arrays to actually use for drawing. Some will
+ * be user-provided arrays, other will be zero-stride const-valued arrays.
+ */
+static void
+vbo_bind_arrays(struct gl_context *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
+
+ _mesa_set_drawing_arrays(ctx, vbo->draw_arrays.inputs);
+
+ if (exec->array.recalculate_inputs) {
+ /* Finally update the inputs array */
+ _vbo_update_inputs(ctx, &vbo->draw_arrays);
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
+ exec->array.recalculate_inputs = GL_FALSE;
+ }
+
+ assert(ctx->NewState == 0);
+ assert(ctx->Array._DrawVAO->NewArrays == 0);
+}
+
+
void
_vbo_draw(struct gl_context *ctx, const struct _mesa_prim *prims,
GLuint nr_prims, const struct _mesa_index_buffer *ib,
unsigned tfb_stream, struct gl_buffer_object *indirect)
{
struct vbo_context *vbo = vbo_context(ctx);
+ vbo_bind_arrays(ctx);
vbo->draw_prims(ctx, prims, nr_prims, ib, index_bounds_valid,
min_index, max_index, tfb_vertcount, tfb_stream, indirect);
}
const struct _mesa_index_buffer *ib)
{
struct vbo_context *vbo = vbo_context(ctx);
+ vbo_bind_arrays(ctx);
vbo->draw_indirect_prims(ctx, mode, indirect_data, indirect_offset,
draw_count, stride, indirect_draw_count_buffer,
indirect_draw_count_offset, ib);
}
-/**
- * Examine the enabled vertex arrays to set the exec->array.inputs[] values.
- * These will point to the arrays to actually use for drawing. Some will
- * be user-provided arrays, other will be zero-stride const-valued arrays.
- */
-static void
-vbo_bind_arrays(struct gl_context *ctx)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct vbo_exec_context *exec = &vbo->exec;
-
- _mesa_set_drawing_arrays(ctx, vbo->draw_arrays.inputs);
-
- if (exec->array.recalculate_inputs) {
- /* Finally update the inputs array */
- _vbo_update_inputs(ctx, &vbo->draw_arrays);
- ctx->NewDriverState |= ctx->DriverFlags.NewArray;
- exec->array.recalculate_inputs = GL_FALSE;
-
- assert(ctx->NewState == 0);
- }
-}
-
-
/**
* Helper function called by the other DrawArrays() functions below.
* This is where we handle primitive restart for drawing non-indexed
if (skip_validated_draw(ctx))
return;
- vbo_bind_arrays(ctx);
-
/* OpenGL 4.5 says that primitive restart is ignored with non-indexed
* draws.
*/
if (skip_draw_elements(ctx, count, indices))
return;
- vbo_bind_arrays(ctx);
-
ib.count = count;
ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
return;
}
- vbo_bind_arrays(ctx);
-
min_index_ptr = (uintptr_t) indices[0];
max_index_ptr = 0;
for (i = 0; i < primcount; i++) {
if (skip_validated_draw(ctx))
return;
- vbo_bind_arrays(ctx);
-
/* init most fields to zero */
memset(&prim, 0, sizeof(prim));
prim.begin = 1;
vbo_validated_drawarraysindirect(struct gl_context *ctx,
GLenum mode, const GLvoid *indirect)
{
- vbo_bind_arrays(ctx);
-
ctx->Driver.DrawIndirect(ctx, mode,
ctx->DrawIndirectBuffer, (GLsizeiptr) indirect,
1 /* draw_count */ , 16 /* stride */ ,
if (primcount == 0)
return;
- vbo_bind_arrays(ctx);
-
ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset,
primcount, stride, NULL, 0, NULL);
{
struct _mesa_index_buffer ib;
- vbo_bind_arrays(ctx);
-
ib.count = 0; /* unknown */
ib.index_size = sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
if (primcount == 0)
return;
- vbo_bind_arrays(ctx);
-
/* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */
if (maxdrawcount == 0)
return;
- vbo_bind_arrays(ctx);
-
ctx->Driver.DrawIndirect(ctx, mode,
ctx->DrawIndirectBuffer, offset,
maxdrawcount, stride,
if (maxdrawcount == 0)
return;
- vbo_bind_arrays(ctx);
-
/* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */