From 39ce344c9b5df62c00e4b3bae9af37b897146415 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Fri, 27 Nov 2026 12:31:34 -0400 Subject: [PATCH] Use fixed storage for image initialization barriers --- app/src/main/cpp/framegen/ddfg/record_impl.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/cpp/framegen/ddfg/record_impl.inc b/app/src/main/cpp/framegen/ddfg/record_impl.inc index 1d53c50328..7db0037ab6 100644 --- a/app/src/main/cpp/framegen/ddfg/record_impl.inc +++ b/app/src/main/cpp/framegen/ddfg/record_impl.inc @@ -389,8 +389,8 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur if (!reuseFlow) { // Batch fresh-image transitions that share the same stage and access masks. - std::vector initBarriers; - initBarriers.reserve(static_cast(4 * kLevels + 1)); + std::array initBarriers{}; + size_t initBarrierCount = 0; auto addInitBarrier = [&](VkImage image) { VkImageMemoryBarrier b{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; @@ -400,7 +400,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur b.image = image; b.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - initBarriers.push_back(b); + initBarriers[initBarrierCount++] = b; }; for (auto& i : pyrA_) addInitBarrier(i.image); for (auto& i : pyrB_) addInitBarrier(i.image); @@ -414,10 +414,10 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur // The final flow level is cleared through TRANSFER_DST_OPTIMAL below; // the other levels can use the common initialization barrier. for (int l = flowFinest_; l < kLevels - 1; ++l) addInitBarrier(flowLvl_[l].image); - if (!initBarriers.empty()) { + if (initBarrierCount != 0) { dd_->CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, - 0, nullptr, static_cast(initBarriers.size()), initBarriers.data()); + 0, nullptr, static_cast(initBarrierCount), initBarriers.data()); } { VkClearColorValue zero{};