File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
sources/Renderer/Vulkan/Memory Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -271,20 +271,26 @@ VKDeviceMemoryRegion* VKDeviceMemory::InsertBlock(VKDeviceMemoryRegionPtr&& regi
271271{
272272 VKDeviceMemoryRegion* regionRef = region.get ();
273273
274- /* Add block by insertion sort */
275274 if (!blocks_.empty ())
276275 {
276+ /* Add block by insertion sort starting search from the right */
277277 for (auto it = blocks_.rbegin (); it != blocks_.rend (); ++it)
278278 {
279279 if ((*it)->GetOffset () < region->GetOffset ())
280280 {
281281 blocks_.insert (it.base (), std::move (region));
282- break ;
282+ return regionRef ;
283283 }
284284 }
285+
286+ /* Insert block at the beginning */
287+ blocks_.insert (blocks_.begin (), std::move (region));
285288 }
286289 else
290+ {
291+ /* Insert first block */
287292 blocks_.emplace_back (std::move (region));
293+ }
288294
289295 return regionRef;
290296}
You can’t perform that action at this time.
0 commit comments