- mVertexBuffers[i]->Upload( context, bufferIndex );
- mVertexBuffers[i]->UpdateAttributeLocations( context, bufferIndex, program );
+ if(mIndices.Empty())
+ {
+ mIndexBuffer = nullptr;
+ }
+ else
+ {
+ if(mIndexBuffer == nullptr)
+ {
+ // Currently we are unable to reuse index buffer so the write policy is to preserve current content
+ mIndexBuffer = new GpuBuffer(graphicsController, 0 | Graphics::BufferUsage::INDEX_BUFFER, GpuBuffer::WritePolicy::RETAIN);
+ }
+
+ uint32_t bufferSize = static_cast<uint32_t>(sizeof(uint16_t) * mIndices.Size());
+ mIndexBuffer->UpdateDataBuffer(graphicsController, bufferSize, &mIndices[0]);
+ }
+
+ mIndicesChanged = false;