We will need the flush_vertices argument later in this series.
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(0),
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj,
- VERT_ATTRIB_GENERIC(0));
+ VERT_ATTRIB_GENERIC(0), true);
if (texcoord_size > 0) {
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
texcoord_size, GL_FLOAT, GL_RGBA,
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
*buf_obj, 0, sizeof(struct vertex));
_mesa_enable_vertex_array_attrib(ctx, array_obj,
- VERT_ATTRIB_GENERIC(1));
+ VERT_ATTRIB_GENERIC(1), true);
}
} else {
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_POS,
offsetof(struct vertex, x));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
*buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
+ _mesa_enable_vertex_array_attrib(ctx, array_obj,
+ VERT_ATTRIB_POS, true);
if (texcoord_size > 0) {
_mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_TEX(0),
offsetof(struct vertex, tex));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(0),
*buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(0));
+ _mesa_enable_vertex_array_attrib(ctx, array_obj,
+ VERT_ATTRIB_TEX(0), true);
}
if (color_size > 0) {
offsetof(struct vertex, r));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_COLOR0,
*buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_COLOR0);
+ _mesa_enable_vertex_array_attrib(ctx, array_obj,
+ VERT_ATTRIB_COLOR0, true);
}
}
} else {
offsetof(struct vertex, x));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
drawtex->buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
+ _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS, true);
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
offsetof(struct vertex, st[i]));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(i),
drawtex->buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(i));
+ _mesa_enable_vertex_array_attrib(ctx, array_obj,
+ VERT_ATTRIB_TEX(i), true);
}
}
else {
vao_state(struct gl_context *ctx, gl_vert_attrib attr, GLboolean state)
{
if (state)
- _mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO, attr);
+ _mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO, attr, true);
else
- _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attr);
+ _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attr, true);
}
void
_mesa_enable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
- gl_vert_attrib attrib)
+ gl_vert_attrib attrib, bool flush_vertices)
{
assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
if (!vao->VertexAttrib[attrib].Enabled) {
/* was disabled, now being enabled */
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ if (flush_vertices) {
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ }
+
vao->VertexAttrib[attrib].Enabled = GL_TRUE;
const GLbitfield array_bit = VERT_BIT(attrib);
vao->_Enabled |= array_bit;
return;
}
- _mesa_enable_vertex_array_attrib(ctx, vao, VERT_ATTRIB_GENERIC(index));
+ _mesa_enable_vertex_array_attrib(ctx, vao,
+ VERT_ATTRIB_GENERIC(index), true);
}
{
GET_CURRENT_CONTEXT(ctx);
_mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO,
- VERT_ATTRIB_GENERIC(index));
+ VERT_ATTRIB_GENERIC(index), true);
}
{
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao = _mesa_lookup_vao(ctx, vaobj);
- _mesa_enable_vertex_array_attrib(ctx, vao, VERT_ATTRIB_GENERIC(index));
+ _mesa_enable_vertex_array_attrib(ctx, vao,
+ VERT_ATTRIB_GENERIC(index), true);
}
void
_mesa_disable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
- gl_vert_attrib attrib)
+ gl_vert_attrib attrib, bool flush_vertices)
{
assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
if (vao->VertexAttrib[attrib].Enabled) {
/* was enabled, now being disabled */
- FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ if (flush_vertices) {
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ }
+
vao->VertexAttrib[attrib].Enabled = GL_FALSE;
const GLbitfield array_bit = VERT_BIT(attrib);
vao->_Enabled &= ~array_bit;
}
const gl_vert_attrib attrib = VERT_ATTRIB_GENERIC(index);
- _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attrib);
+ _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attrib, true);
}
{
GET_CURRENT_CONTEXT(ctx);
const gl_vert_attrib attrib = VERT_ATTRIB_GENERIC(index);
- _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attrib);
+ _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attrib, true);
}
}
const gl_vert_attrib attrib = VERT_ATTRIB_GENERIC(index);
- _mesa_disable_vertex_array_attrib(ctx, vao, attrib);
+ _mesa_disable_vertex_array_attrib(ctx, vao, attrib, true);
}
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao = _mesa_lookup_vao(ctx, vaobj);
const gl_vert_attrib attrib = VERT_ATTRIB_GENERIC(index);
- _mesa_disable_vertex_array_attrib(ctx, vao, attrib);
+ _mesa_disable_vertex_array_attrib(ctx, vao, attrib, true);
}
extern void
_mesa_enable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
- gl_vert_attrib attrib);
+ gl_vert_attrib attrib, bool flush_vertices);
extern void
_mesa_disable_vertex_array_attrib(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
- gl_vert_attrib attrib);
+ gl_vert_attrib attrib, bool flush_vertices);
extern void