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 | |
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')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 18 | ||||
-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 |
4 files changed, 34 insertions, 22 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 0cb2ef450e0..3d9833dabb8 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -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 { 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 |