Move client attribs mask to front-end.
The Vulkan and GL back-ends both had a client attributes mask.
This consolidates them into the front-end, where it can also
be used in the validation layer.
Also includes a fix which was incorrectly setting the enabled
mask in setVertexAttribFormatImpl.
Bug: angleproject:1391
Change-Id: I5e45c1e2a56b30a36dec1482d170592c30a16d40
Reviewed-on: https://chromium-review.googlesource.com/1008272
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Luc Ferron <lucferron@chromium.org>
diff --git a/src/libANGLE/VertexArray.cpp b/src/libANGLE/VertexArray.cpp
index 0735c2a..06362d0 100644
--- a/src/libANGLE/VertexArray.cpp
+++ b/src/libANGLE/VertexArray.cpp
@@ -15,7 +15,7 @@
namespace gl
{
-
+// VertexArrayState implementation.
VertexArrayState::VertexArrayState(size_t maxAttribs, size_t maxAttribBindings)
: mLabel(), mVertexBindings(maxAttribBindings)
{
@@ -31,6 +31,12 @@
{
}
+gl::AttributesMask VertexArrayState::getEnabledClientMemoryAttribsMask() const
+{
+ return (mClientMemoryAttribsMask & mEnabledAttributesMask);
+}
+
+// VertexArray implementation.
VertexArray::VertexArray(rx::GLImplFactory *factory,
GLuint id,
size_t maxAttribs,
@@ -49,7 +55,7 @@
void VertexArray::onDestroy(const Context *context)
{
bool isBound = context->isCurrentVertexArray(this);
- for (auto &binding : mState.mVertexBindings)
+ for (VertexBinding &binding : mState.mVertexBindings)
{
binding.setBuffer(context, nullptr, isBound);
}
@@ -202,7 +208,6 @@
attrib->pureInteger = pureInteger;
attrib->relativeOffset = relativeOffset;
mState.mVertexAttributesTypeMask.setIndex(GetVertexAttributeBaseType(*attrib), attribIndex);
- mState.mEnabledAttributesMask.set(attribIndex);
}
void VertexArray::setVertexAttribFormat(size_t attribIndex,
@@ -265,6 +270,8 @@
bindVertexBufferImpl(context, attribIndex, boundBuffer, offset, effectiveStride);
setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_POINTER);
+
+ mState.mClientMemoryAttribsMask.set(attribIndex, boundBuffer == nullptr);
}
void VertexArray::setElementArrayBuffer(const Context *context, Buffer *buffer)