diff options
author | Mathias Fröhlich <[email protected]> | 2016-08-24 08:45:05 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-02-23 05:33:55 +0100 |
commit | 4331969ac44ce29c3dac810242ed2b9a4633999f (patch) | |
tree | 6423130f8e2d359572faaa52c5ce352aa306a751 /src/mesa/main | |
parent | 195bb990ed1a76e5ea9dd37af51f8270e9c3bf7d (diff) |
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 <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/enable.c | 4 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 30 | ||||
-rw-r--r-- | src/mesa/main/varray.h | 4 |
3 files changed, 23 insertions, 15 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 868b73ac68b..7625a4c9577 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -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); } diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index fc9e6fb6ba5..90b874aa49a 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -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); } diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 46f83b22008..93ffb37a0d9 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -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 |