| 64 | } |
| 65 | |
| 66 | bool GLVertexArrayObject::needsUpdate(VertexBufferBinding* vertexBufferBinding, |
| 67 | size_t vertexStart) |
| 68 | { |
| 69 | if(mNeedsUpdate) |
| 70 | return true; |
| 71 | |
| 72 | for (const auto& elem : mElementList) |
| 73 | { |
| 74 | uint16 source = elem.getSource(); |
| 75 | |
| 76 | if (!vertexBufferBinding->isBufferBound(source)) |
| 77 | continue; // Skip unbound elements |
| 78 | |
| 79 | VertexElementSemantic sem = elem.getSemantic(); |
| 80 | unsigned short elemIndex = elem.getIndex(); |
| 81 | |
| 82 | uint32 attrib = (uint32)GLSLProgramCommon::getFixedAttributeIndex(sem, elemIndex); |
| 83 | |
| 84 | const HardwareVertexBufferSharedPtr& vertexBuffer = vertexBufferBinding->getBuffer(source); |
| 85 | if (std::find(mAttribsBound.begin(), mAttribsBound.end(), |
| 86 | std::make_pair(attrib, vertexBuffer.get())) == mAttribsBound.end()) |
| 87 | return true; |
| 88 | |
| 89 | if (vertexBuffer->isInstanceData() && |
| 90 | std::find(mInstanceAttribsBound.begin(), mInstanceAttribsBound.end(), attrib) == |
| 91 | mInstanceAttribsBound.end()) |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | if(vertexStart != mVertexStart) { |
| 96 | return true; |
| 97 | } |
| 98 | |
| 99 | return false; |
| 100 | } |
| 101 | |
| 102 | void GLVertexArrayObject::bindToGpu(GLRenderSystemCommon* rs, |
| 103 | VertexBufferBinding* vertexBufferBinding, |