From b4fd63015ac7fd73e0147ff078caec47be729e87 Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Sat, 27 Jan 2018 16:07:22 +0100 Subject: mesa: Track position/generic0 aliasing in the VAO. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the first material attribute no longer aliases with the generic0 attribute, only aliasing between generic0 and position is left and entirely dependent on the enabled state of the VAO. So introduce a gl_attribute_map_mode in the VAO that is used to track how the position and the generic 0 attribute alias. Provide a static const array that can be used to map from vertex program input indices to VERT_ATTRIB_* indices. The outer dimension of the array is meant to be indexed directly by the new VAO member variable. Also provide methods on the VAO to convert bitmasks of VERT_BIT's from the VAO numbering to the vertex processing inputs numbering. v2: s,unsigned char,GLubyte,g s,_ATTRIBUTE_MAP_MODE_MAX,ATTRIBUTE_MAP_MODE_MAX,g Change comment style, add comments. Signed-off-by: Mathias Fröhlich Reviewed-by: Brian Paul --- src/mesa/main/varray.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/mesa/main/varray.c') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index bc0afa6bcf5..81b8fbe8ca7 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1071,8 +1071,13 @@ _mesa_enable_vertex_array_attrib(struct gl_context *ctx, /* was disabled, now being enabled */ FLUSH_VERTICES(ctx, _NEW_ARRAY); vao->VertexAttrib[attrib].Enabled = GL_TRUE; - vao->_Enabled |= VERT_BIT(attrib); - vao->NewArrays |= VERT_BIT(attrib); + const GLbitfield array_bit = VERT_BIT(attrib); + vao->_Enabled |= array_bit; + vao->NewArrays |= array_bit; + + /* Update the map mode if needed */ + if (array_bit & (VERT_BIT_POS|VERT_BIT_GENERIC0)) + _mesa_update_attribute_map_mode(ctx, vao); } } @@ -1150,8 +1155,13 @@ disable_vertex_array_attrib(struct gl_context *ctx, /* was enabled, now being disabled */ FLUSH_VERTICES(ctx, _NEW_ARRAY); vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; - vao->_Enabled &= ~VERT_BIT_GENERIC(index); - vao->NewArrays |= VERT_BIT_GENERIC(index); + const GLbitfield array_bit = VERT_BIT_GENERIC(index); + vao->_Enabled &= ~array_bit; + vao->NewArrays |= array_bit; + + /* Update the map mode if needed */ + if (array_bit & (VERT_BIT_POS|VERT_BIT_GENERIC0)) + _mesa_update_attribute_map_mode(ctx, vao); } } -- cgit v1.2.3