From db1f47ab115852115629efe22ba57261c417a46c Mon Sep 17 00:00:00 2001 From: Tim Sylvester Date: Mon, 6 May 2024 12:50:11 -0700 Subject: [PATCH] Remove obsolete buffer allocation (#2361) --- src/mbgl/mtl/upload_pass.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/mbgl/mtl/upload_pass.cpp b/src/mbgl/mtl/upload_pass.cpp index 1c6d4b829..af9729026 100644 --- a/src/mbgl/mtl/upload_pass.cpp +++ b/src/mbgl/mtl/upload_pass.cpp @@ -163,17 +163,12 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( constexpr std::size_t align = 16; constexpr std::uint8_t padding = 0; - std::vector allData; - allData.reserve((defaults.getTotalSize() + align) * vertexCount); - uint32_t vertexStride = 0; // For each attribute in the program, with the corresponding default and optional override... const auto resolveAttr = [&](const size_t id, auto& default_, auto& override_) -> void { auto& effectiveAttr = override_ ? *override_ : default_; const auto& defaultAttr = static_cast(default_); - const auto stride = defaultAttr.getStride(); - const auto offset = static_cast(allData.size()); const auto index = static_cast(defaultAttr.getIndex()); bindings.resize(std::max(bindings.size(), index + 1)); @@ -222,24 +217,6 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings( }; defaults.resolve(overrides, resolveAttr); - assert(vertexStride * vertexCount <= allData.size()); - - if (!allData.empty()) { - if (auto vertBuf = createVertexBufferResource(allData.data(), allData.size(), usage, /*persistent=*/false)) { - // Fill in the buffer in each binding that was generated without its own buffer - std::for_each(bindings.begin(), bindings.end(), [&](auto& b) { - if (b && !b->vertexBufferResource) { - b->vertexBufferResource = vertBuf.get(); - } - }); - - outBuffers.emplace_back(std::move(vertBuf)); - } else { - assert(false); - return {}; - } - } - return bindings; }