mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 14:18:07 +02:00
mesa: Add flush_vertices to _mesa_{enable,disable}_vertex_array_attrib.
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>
This commit is contained in:
parent
195bb990ed
commit
4331969ac4
4 changed files with 34 additions and 22 deletions
|
|
@ -350,7 +350,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
|
|||
_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,
|
||||
|
|
@ -359,7 +359,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
|
|||
_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,
|
||||
|
|
@ -368,7 +368,8 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
|
|||
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),
|
||||
|
|
@ -377,7 +378,8 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
|
|||
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) {
|
||||
|
|
@ -387,7 +389,8 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
|
|||
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 {
|
||||
|
|
@ -3345,7 +3348,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
|
|||
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++) {
|
||||
|
|
@ -3356,7 +3359,8 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ static void
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1091,13 +1091,16 @@ _mesa_VertexAttribLPointer(GLuint index, GLint size, GLenum type,
|
|||
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;
|
||||
|
|
@ -1120,7 +1123,8 @@ enable_vertex_array_attrib(struct gl_context *ctx,
|
|||
return;
|
||||
}
|
||||
|
||||
_mesa_enable_vertex_array_attrib(ctx, vao, VERT_ATTRIB_GENERIC(index));
|
||||
_mesa_enable_vertex_array_attrib(ctx, vao,
|
||||
VERT_ATTRIB_GENERIC(index), true);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1138,7 +1142,7 @@ _mesa_EnableVertexAttribArray_no_error(GLuint index)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
_mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO,
|
||||
VERT_ATTRIB_GENERIC(index));
|
||||
VERT_ATTRIB_GENERIC(index), true);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1168,20 +1172,24 @@ _mesa_EnableVertexArrayAttrib_no_error(GLuint vaobj, GLuint index)
|
|||
{
|
||||
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;
|
||||
|
|
@ -1205,7 +1213,7 @@ _mesa_DisableVertexAttribArray(GLuint index)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1214,7 +1222,7 @@ _mesa_DisableVertexAttribArray_no_error(GLuint index)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1241,7 +1249,7 @@ _mesa_DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1251,7 +1259,7 @@ _mesa_DisableVertexArrayAttrib_no_error(GLuint vaobj, GLuint index)
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -111,13 +111,13 @@ _mesa_update_array_format(struct gl_context *ctx,
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue