X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fdestroyqueue.h;fp=source%2Fbackends%2Fvulkan%2Fdestroyqueue.h;h=577e89d0233380496f44520b5a66110598191f36;hb=99ca354f18119f82f1adeca100cd665a8f640317;hp=0000000000000000000000000000000000000000;hpb=4cd245dafe6a7ee5c93edca5aee2d146f1155309;p=libs%2Fgl.git diff --git a/source/backends/vulkan/destroyqueue.h b/source/backends/vulkan/destroyqueue.h new file mode 100644 index 00000000..577e89d0 --- /dev/null +++ b/source/backends/vulkan/destroyqueue.h @@ -0,0 +1,49 @@ +#ifndef MSP_GL_VULKAN_DESTROYQUEUE_H_ +#define MSP_GL_VULKAN_DESTROYQUEUE_H_ + +#include +#include "handles.h" + +namespace Msp { +namespace GL { + +class Device; +class VulkanFunctions; + +class DestroyQueue +{ +private: + struct Entry + { + void *handle = 0; + void (*destroy_func)(const VulkanFunctions &, void *) = 0; + unsigned memory_id = 0; + unsigned on_frame = 0; + }; + + Device &device; + std::deque queue; + unsigned current_frame = 0; + +public: + DestroyQueue(Device &); + ~DestroyQueue(); + + void destroy(VkBuffer, unsigned); + void destroy(VkFence); + void destroy(VkFramebuffer); + void destroy(VkImageView); + void destroy(VkSemaphore); + +private: + template + void destroy(T, unsigned = 0); + +public: + void tick(); +}; + +} // namespace GL +} // namespace Msp + +#endif