Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions rts/Lua/LuaVBOImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,17 @@ bool LuaVBOImpl::CopyTo(const std::shared_ptr<LuaVBOImpl>& destVBO, int copySize

auto result = vbo->CopyTo(*destVBO->vbo, static_cast<GLsizeiptr>(copySizeInBytes));

// VBO::CopyTo only moves GPU->GPU. We need to also copy over the CPU-side bufferData.
if (result && bufferData != nullptr && destVBO->bufferData != nullptr && copySizeInBytes > 0) {
const auto n = std::min({
static_cast<uint32_t>(copySizeInBytes),
bufferSizeInBytes,
destVBO->bufferSizeInBytes
});
if (n > 0)
memcpy(destVBO->bufferData, bufferData, n);
}

if (!wasBound)
vbo->Unbind();

Expand Down
Loading