]> git.tdb.fi Git - libs/gl.git/commitdiff
Increment frame after destroying objects instead of before
authorMikko Rasa <tdb@tdb.fi>
Sat, 18 Dec 2021 18:19:55 +0000 (20:19 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 18 Dec 2021 18:21:28 +0000 (20:21 +0200)
Things were getting destroyed one frame too early since the destroy queue
is ticked after rendering a frame.

source/backends/vulkan/destroyqueue.cpp

index 0c3e17c1a1831ecc2ab88534f33b8a0ca8bc7169..32ec5cff580bd32ce2e8e0c72d9c2f4a8d14e7c0 100644 (file)
@@ -66,7 +66,6 @@ void DestroyQueue::tick()
        const VulkanFunctions &vk = device.get_functions();
        MemoryAllocator &allocator = device.get_allocator();
 
-       ++current_frame;
        while(!queue.empty() && current_frame>=queue.front().on_frame)
        {
                const Entry &e = queue.front();
@@ -75,6 +74,8 @@ void DestroyQueue::tick()
                        allocator.release(e.memory_id);
                queue.pop_front();
        }
+
+       ++current_frame;
 }
 
 } // namespace GL