Adding delayed destruction for resources

This commit is contained in:
2023-11-12 16:11:27 +01:00
parent c1e4891456
commit b3c9af384b
10 changed files with 92 additions and 23 deletions
+18 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include <vulkan/vulkan.h>
#include <functional>
#include "Containers/List.h"
#include "Graphics/Resources.h"
#include "Allocator.h"
@@ -42,10 +43,6 @@ public:
return fence;
}
void wait(uint32 timeout);
/*Event& operator co_await()
{
return signaled;
}*/
bool operator<(const Fence &other) const
{
return fence < other.fence;
@@ -58,6 +55,23 @@ private:
};
DEFINE_REF(Fence)
class DestructionManager
{
public:
DestructionManager(PGraphics graphics);
~DestructionManager();
void queueBuffer(PCmdBuffer cmd, VkBuffer buffer);
void queueImage(PCmdBuffer cmd, VkImage image);
void queueImageView(PCmdBuffer cmd, VkImageView view);
void notifyCmdComplete(PCmdBuffer cmdbuffer);
private:
PGraphics graphics;
Map<PCmdBuffer, List<VkBuffer>> buffers;
Map<PCmdBuffer, List<VkImage>> images;
Map<PCmdBuffer, List<VkImageView>> views;
};
DEFINE_REF(DestructionManager)
class VertexDeclaration : public Gfx::VertexDeclaration
{
public: