mesa: add gl_vertex_array_object::NonIdentityBufferAttribMapping

It will be used to skip the indirection from vertex attribs to vertex
buffers.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27525>
This commit is contained in:
Marek Olšák 2022-10-18 01:27:58 -04:00 committed by Marge Bot
parent 10f08c2733
commit bab4399970
3 changed files with 14 additions and 0 deletions

View file

@ -1208,6 +1208,7 @@ copy_array_object(struct gl_context *ctx,
/* The bitmask of bound VBOs needs to match the VertexBinding array */
dest->VertexAttribBufferMask = src->VertexAttribBufferMask;
dest->NonZeroDivisorMask = src->NonZeroDivisorMask;
dest->NonIdentityBufferAttribMapping = src->NonIdentityBufferAttribMapping;
dest->_AttributeMapMode = src->_AttributeMapMode;
/* skip NumUpdates and IsDynamic because they can only increase, not decrease */
}

View file

@ -1667,6 +1667,12 @@ struct gl_vertex_array_object
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
GLbitfield Enabled;
/**
* Mask of vertex attributes that have:
* VertexAttrib[i].BufferBindingIndex != i.
*/
GLbitfield NonIdentityBufferAttribMapping;
/**
* Mask indicating which VertexAttrib and BufferBinding structures have
* been changed since the VAO creation. No bit is ever cleared to 0 by

View file

@ -241,6 +241,11 @@ _mesa_vertex_attrib_binding(struct gl_context *ctx,
}
vao->NonDefaultStateMask |= array_bit | BITFIELD_BIT(bindingIndex);
if (attribIndex != bindingIndex)
vao->NonIdentityBufferAttribMapping |= array_bit;
else
vao->NonIdentityBufferAttribMapping &= ~array_bit;
}
}
@ -4094,6 +4099,8 @@ init_array(struct gl_context *ctx,
assert(index < ARRAY_SIZE(vao->BufferBinding));
struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[index];
vao->NonIdentityBufferAttribMapping &= ~BITFIELD_BIT(index);
_mesa_set_vertex_format(&array->Format, size, type, GL_RGBA,
GL_FALSE, GL_FALSE, GL_FALSE);
array->Stride = 0;