Files
Seele/src/Engine/Graphics/Vulkan/Resources.h
T

86 lines
1.8 KiB
C++
Raw Normal View History

2023-10-26 18:37:29 +02:00
#pragma once
#include <vulkan/vulkan.h>
2023-11-12 16:11:27 +01:00
#include "Containers/List.h"
2023-10-26 18:37:29 +02:00
#include "Graphics/Resources.h"
#include "Allocator.h"
namespace Seele
{
namespace Vulkan
{
2023-11-15 17:42:57 +01:00
DECLARE_REF(DescriptorPool)
2023-11-15 00:06:00 +01:00
DECLARE_REF(CommandPool)
DECLARE_REF(Command)
2023-10-26 18:37:29 +02:00
DECLARE_REF(Graphics)
class Semaphore
{
public:
Semaphore(PGraphics graphics);
virtual ~Semaphore();
2023-11-15 00:06:00 +01:00
constexpr VkSemaphore getHandle() const
2023-10-26 18:37:29 +02:00
{
return handle;
}
private:
VkSemaphore handle;
PGraphics graphics;
};
DEFINE_REF(Semaphore)
class Fence
{
public:
Fence(PGraphics graphics);
~Fence();
bool isSignaled();
void reset();
2023-11-15 00:06:00 +01:00
constexpr VkFence getHandle() const
2023-10-26 18:37:29 +02:00
{
return fence;
}
void wait(uint32 timeout);
bool operator<(const Fence &other) const
{
return fence < other.fence;
}
private:
PGraphics graphics;
bool signaled;
VkFence fence;
};
DEFINE_REF(Fence)
2023-11-12 16:11:27 +01:00
class DestructionManager
{
public:
DestructionManager(PGraphics graphics);
~DestructionManager();
2023-11-15 00:06:00 +01:00
void queueBuffer(PCommand cmd, VkBuffer buffer);
void queueImage(PCommand cmd, VkImage image);
void queueImageView(PCommand cmd, VkImageView view);
void queueSemaphore(PCommand cmd, VkSemaphore sem);
2023-12-02 10:55:00 +01:00
void queueRenderPass(PCommand cmd, VkRenderPass renderPass);
void queueDescriptorPool(PCommand cmd, VkDescriptorPool pool);
2023-11-15 00:06:00 +01:00
void notifyCmdComplete(PCommand cmdbuffer);
2023-11-12 16:11:27 +01:00
private:
PGraphics graphics;
2023-11-15 00:06:00 +01:00
Map<PCommand, List<VkBuffer>> buffers;
Map<PCommand, List<VkImage>> images;
Map<PCommand, List<VkImageView>> views;
Map<PCommand, List<VkSemaphore>> sems;
2023-12-02 10:55:00 +01:00
Map<PCommand, List<VkRenderPass>> renderPasses;
Map<PCommand, List<VkDescriptorPool>> pools;
2023-11-12 16:11:27 +01:00
};
DEFINE_REF(DestructionManager)
2023-11-15 00:06:00 +01:00
class Sampler : public Gfx::Sampler
2023-10-26 18:37:29 +02:00
{
public:
VkSampler sampler;
};
2023-11-15 00:06:00 +01:00
DEFINE_REF(Sampler)
2023-10-26 18:37:29 +02:00
} // namespace Vulkan
} // namespace Seele