Files
sophia/engine/src/resources/pools/render_target_pool.hpp
T
2026-09-30 18:53:16 -07:00

41 lines
1012 B
C++

#pragma once
#include <sophia/handles.hpp>
#include <sophia/util/pool.hpp>
#include "resources/render_target.hpp"
#include "vulkan/device.hpp"
namespace sophia {
class RenderTargetPool {
public:
RenderTargetPool(Device& device, vk::Format format);
RenderTargetPool(const RenderTargetPool&) = delete;
RenderTargetPool& operator=(const RenderTargetPool&) = delete;
RenderTargetHandle create(u32 width, u32 height);
RenderTarget& get(RenderTargetHandle handle) { return pool.get(handle); }
const RenderTarget& get(RenderTargetHandle handle) const {
return pool.get(handle);
}
void release(RenderTargetHandle handle);
bool isAlive(RenderTargetHandle handle) const { return pool.isAlive(handle); }
vk::Format getFormat() const { return format; }
vk::Format getDepthFormat() const { return depthFormat; }
void applyPendingResizes();
private:
Device& device;
vk::Format format;
vk::Format depthFormat;
Pool<RenderTarget> pool{"RenderTarget"};
};
} // namespace sophia