Revert "Store the applied element array buffer as a binding pointer."
This reverts commit 0018c85ea45090b5de61d4be1fbfbf96a3cde48b.
Change-Id: Ieab61c0a4cd1b24d606263e9bf2bae31ea2e8ac4
Reviewed-on: https://chromium-review.googlesource.com/289486
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/VertexArrayGL.cpp b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
index 84722a4..f345ab1 100644
--- a/src/libANGLE/renderer/gl/VertexArrayGL.cpp
+++ b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
@@ -26,7 +26,7 @@
mFunctions(functions),
mStateManager(stateManager),
mVertexArrayID(0),
- mAppliedElementArrayBuffer(),
+ mAppliedElementArrayBuffer(0),
mStreamingElementArrayBufferSize(0),
mStreamingElementArrayBuffer(0),
mStreamingArrayBufferSize(0),
@@ -55,13 +55,34 @@
mStreamingArrayBufferSize = 0;
mStreamingArrayBuffer = 0;
- mAppliedElementArrayBuffer.set(nullptr);
for (size_t idx = 0; idx < mAppliedAttributes.size(); idx++)
{
mAppliedAttributes[idx].buffer.set(nullptr);
}
}
+void VertexArrayGL::setElementArrayBuffer(const gl::Buffer *buffer)
+{
+ // If the buffer is being unbound/deleted, reset the currently applied buffer ID
+ // so that even if a new buffer is generated with the same ID, it will be re-bound.
+ if (buffer == nullptr && mAppliedElementArrayBuffer != mStreamingElementArrayBuffer)
+ {
+ mAppliedElementArrayBuffer = 0;
+ }
+}
+
+void VertexArrayGL::setAttribute(size_t idx, const gl::VertexAttribute &attr)
+{
+}
+
+void VertexArrayGL::setAttributeDivisor(size_t idx, GLuint divisor)
+{
+}
+
+void VertexArrayGL::enableAttribute(size_t idx, bool enabledState)
+{
+}
+
gl::Error VertexArrayGL::syncDrawArraysState(const std::vector<GLuint> &activeAttribLocations, GLint first, GLsizei count) const
{
return syncDrawState(activeAttribLocations, first, count, GL_NONE, nullptr, nullptr);
@@ -75,7 +96,7 @@
gl::Error VertexArrayGL::syncDrawState(const std::vector<GLuint> &activeAttribLocations, GLint first, GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const
{
- mStateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID());
+ mStateManager->bindVertexArray(mVertexArrayID, mAppliedElementArrayBuffer);
// Check if any attributes need to be streamed, determines if the index range needs to be computed
bool attributesNeedStreaming = doAttributesNeedStreaming(activeAttribLocations);
@@ -229,11 +250,12 @@
// Need to check the range of indices if attributes need to be streamed
if (elementArrayBuffer != nullptr)
{
- if (elementArrayBuffer != mAppliedElementArrayBuffer.get())
+ const BufferGL *bufferGL = GetImplAs<BufferGL>(elementArrayBuffer);
+ GLuint elementArrayBufferID = bufferGL->getBufferID();
+ if (elementArrayBufferID != mAppliedElementArrayBuffer)
{
- const BufferGL *bufferGL = GetImplAs<BufferGL>(elementArrayBuffer);
- mStateManager->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferGL->getBufferID());
- mAppliedElementArrayBuffer.set(elementArrayBuffer);
+ mStateManager->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementArrayBufferID);
+ mAppliedElementArrayBuffer = elementArrayBufferID;
}
// Only compute the index range if the attributes also need to be streamed
@@ -269,7 +291,7 @@
}
mStateManager->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, mStreamingElementArrayBuffer);
- mAppliedElementArrayBuffer.set(nullptr);
+ mAppliedElementArrayBuffer = mStreamingElementArrayBuffer;
// Make sure the element array buffer is large enough
const gl::Type &indexTypeInfo = gl::GetTypeInfo(type);
@@ -392,8 +414,7 @@
GLuint VertexArrayGL::getAppliedElementArrayBufferID() const
{
- return mAppliedElementArrayBuffer.get() == nullptr ? mStreamingElementArrayBuffer
- : mAppliedElementArrayBuffer.id();
+ return mAppliedElementArrayBuffer;
}
}