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, mAppliedElementArrayBuffer); // Check if any attributes need to be streamed, determines if the index range needs to be computed bool attributesNeedStreaming = doAttributesNeedStreaming(activeAttribLocations); // Determine if an index buffer needs to be streamed and the range of vertices that need to be copied gl::RangeUI indexRange(0, 0); if (type != GL_NONE) { gl::Error error = syncIndexData(count, type, indices, attributesNeedStreaming, &indexRange, outIndices); if (error.isError()) { return error; } } else { // Not an indexed call, set the range to [first, first + count) indexRange.start = first; indexRange.end = first + count; } // Sync the vertex attribute state and track what data needs to be streamed size_t streamingDataSize = 0; size_t maxAttributeDataSize = 0; gl::Error error = syncAttributeState(activeAttribLocations, attributesNeedStreaming, indexRange, &streamingDataSize, &maxAttributeDataSize); if (error.isError()) { return error; } if (streamingDataSize > 0) { ASSERT(attributesNeedStreaming); gl::Error error = streamAttributes(activeAttribLocations, streamingDataSize, maxAttributeDataSize, indexRange); if (error.isError()) { return error; } } return gl::Error(GL_NO_ERROR); }
gl::Error VertexArrayGL::syncDrawState(const gl::AttributesMask &activeAttributesMask, GLint first, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount, bool primitiveRestartEnabled, const GLvoid **outIndices) const { mStateManager->bindVertexArray(mVertexArrayID, getAppliedElementArrayBufferID()); // Check if any attributes need to be streamed, determines if the index range needs to be computed bool attributesNeedStreaming = mAttributesNeedStreaming.any(); // Determine if an index buffer needs to be streamed and the range of vertices that need to be copied IndexRange indexRange; if (type != GL_NONE) { Error error = syncIndexData(count, type, indices, primitiveRestartEnabled, attributesNeedStreaming, &indexRange, outIndices); if (error.isError()) { return error; } } else { // Not an indexed call, set the range to [first, first + count - 1] indexRange.start = first; indexRange.end = first + count - 1; } if (attributesNeedStreaming) { Error error = streamAttributes(activeAttributesMask, instanceCount, indexRange); if (error.isError()) { return error; } } return Error(GL_NO_ERROR); }