44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
#pragma once
|
|
#include <vector>
|
|
#include <stdexcept>
|
|
#include <IntrusivePtr.h>
|
|
#include <VulkanPP/VulkanFunctions.hpp>
|
|
|
|
namespace VulkanPP {
|
|
class Device;
|
|
|
|
|
|
|
|
// === Lifetime summary (deterministic) ===
|
|
// Handle: VkDescriptorPool
|
|
// Holds (destroy/free owners + creation parent, or producer parent): Device
|
|
// Keeps (from *CreateInfo/*AllocateInfo): —
|
|
// Destructor calls vkDestroy*/vkFree* only if _owned == true.
|
|
|
|
class DescriptorPool : public RefCounted {
|
|
public:
|
|
VkDescriptorPool getHandle() const noexcept { return _handle; }
|
|
IntrusivePtr<Device> getDevice() const noexcept { return _owner0; }
|
|
public:
|
|
static IntrusivePtr<DescriptorPool> fromHandle(IntrusivePtr<Device> owner0, VkDescriptorPool handle) {
|
|
return IntrusivePtr<DescriptorPool>(new DescriptorPool(owner0, handle, false));
|
|
}
|
|
private:
|
|
explicit DescriptorPool(IntrusivePtr<Device> owner0, VkDescriptorPool handle, bool owned);
|
|
~DescriptorPool() override;
|
|
private:
|
|
VkDescriptorPool _handle{VK_NULL_HANDLE};
|
|
bool _owned{false};
|
|
IntrusivePtr<Device> _owner0;
|
|
|
|
public:
|
|
// Original: vkCreateDescriptorPool
|
|
explicit DescriptorPool(IntrusivePtr<Device> parent, const VkDescriptorPoolCreateInfo* pCreateInfo);
|
|
// Original: vkCreateDescriptorPool (factory)
|
|
static IntrusivePtr<DescriptorPool> create(IntrusivePtr<Device> parent, const VkDescriptorPoolCreateInfo* pCreateInfo);
|
|
|
|
};
|
|
using PDescriptorPool = IntrusivePtr<DescriptorPool>;
|
|
|
|
} // namespace VulkanPP
|