62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
|
|
#pragma once
|
|
|
|
#if !defined(IWA_DESCRIPTOR_SET_HPP_INCLUDED)
|
|
#define IWA_DESCRIPTOR_SET_HPP_INCLUDED
|
|
|
|
#include <vector>
|
|
#include "iwa/object.hpp"
|
|
#include "iwa/vkwrapper.hpp"
|
|
|
|
namespace iwa
|
|
{
|
|
struct DescriptorSetLayoutCreationArgs
|
|
{
|
|
std::vector<vk::DescriptorSetLayoutBinding> bindings;
|
|
std::vector<vk::DescriptorBindingFlags> bindingFlags;
|
|
vk::DescriptorSetLayoutCreateFlags flags = {};
|
|
};
|
|
|
|
class DescriptorSetLayout : public Object<DescriptorSetLayout, BaseObject, class Device>, public MixinVulkanObject<vk::DescriptorSetLayout>
|
|
{
|
|
public:
|
|
DescriptorSetLayout(ObjectPtr<class Device> owner, const DescriptorSetLayoutCreationArgs& args);
|
|
~DescriptorSetLayout() noexcept override;
|
|
};
|
|
|
|
struct DescriptorPoolCreationArgs
|
|
{
|
|
vk::DescriptorPoolCreateFlags flags = {};
|
|
unsigned maxSets = 0;
|
|
std::vector<vk::DescriptorPoolSize> poolSizes;
|
|
};
|
|
|
|
struct DescriptorSetAllocateArgs
|
|
{
|
|
ObjectPtr<DescriptorSetLayout> layout;
|
|
std::uint32_t variableDescriptorCount = 0;
|
|
};
|
|
|
|
class DescriptorPool : public Object<DescriptorPool, BaseObject, class Device>, public MixinVulkanObject<vk::DescriptorPool>
|
|
{
|
|
private:
|
|
bool mCanFree = false;
|
|
public:
|
|
DescriptorPool(ObjectPtr<class Device> owner, const DescriptorPoolCreationArgs& args);
|
|
~DescriptorPool() noexcept override;
|
|
|
|
[[nodiscard]] ObjectPtr<class DescriptorSet> allocateDescriptorSet(const DescriptorSetAllocateArgs& args);
|
|
|
|
[[nodiscard]] bool getCanFree() const noexcept { return mCanFree; }
|
|
};
|
|
|
|
class DescriptorSet : public Object<DescriptorSet, BaseObject, DescriptorPool>, public MixinVulkanObject<vk::DescriptorSet>
|
|
{
|
|
public:
|
|
DescriptorSet(ObjectPtr<DescriptorPool> owner, vk::DescriptorSet handle);
|
|
~DescriptorSet() noexcept override;
|
|
};
|
|
} // namespace iwa
|
|
|
|
#endif // !defined(IWA_DESCRIPTOR_SET_HPP_INCLUDED)
|