5#include <unordered_map>
23 std::string debugName,
24 VkDescriptorSetLayout predefinedLayout = VK_NULL_HANDLE,
25 VkDescriptorSetLayoutCreateFlags descriptorSetLayoutCreateFlags = 0);
35 void SetDescriptorAt(uint32_t binding,
const std::vector<const ManagedBuffer*>& buffers, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
51 const std::vector<const ManagedImage*>& images,
54 VkDescriptorType descriptorType,
55 VkShaderStageFlags shaderStageFlags);
61 uint32_t binding,
const ManagedImage* image, VkImageLayout layout, VkSampler sampler, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
67 uint32_t binding,
const ManagedImage& image, VkImageLayout layout, VkSampler sampler, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
71 void SetDescriptorAt(uint32_t binding,
const std::vector<VkDescriptorImageInfo>& imageInfos, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
74 void SetDescriptorAt(uint32_t binding,
const std::vector<VkDescriptorBufferInfo>& bufferInfos, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
77 void SetDescriptorAt(uint32_t binding,
const VkDescriptorImageInfo& imageInfo, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
80 void SetDescriptorAt(uint32_t binding,
const VkDescriptorBufferInfo& bufferInfo, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
84 void SetDescriptorAt(uint32_t binding,
void* pNext, uint32_t DescriptorCount, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
99 void SetDescriptorAt(uint32_t binding,
const std::vector<const CombinedImageSampler*>& sampledImages, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags);
Wraps an image + sampler combination.
Definition foray_samplercollection.hpp:61
Helps with the creation of a VkDescriptorSetLayout and VkDescriptorSet.
Definition foray_descriptorset.hpp:15
void SetDescriptorAt(uint32_t binding, const std::vector< VkDescriptorBufferInfo > &bufferInfos, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (buffer info array)
void SetDescriptorAt(uint32_t binding, const CombinedImageSampler &sampledImage, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (CombinedImageSampler)
bool mExternalLayout
Definition foray_descriptorset.hpp:121
void SetDescriptorAt(uint32_t binding, const ManagedBuffer &buffer, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (buffer)
VkDescriptorPool mDescriptorPool
Definition foray_descriptorset.hpp:119
void SetDescriptorAt(uint32_t binding, const VkDescriptorImageInfo &imageInfo, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (image info)
Context * mContext
Definition foray_descriptorset.hpp:118
bool Exists() const override
Return true, if the managed resource is allocated.
Definition foray_descriptorset.hpp:101
void CreateDescriptorSetLayout(VkDescriptorSetLayoutCreateFlags descriptorSetLayoutCreateFlags)
void Create(Context *context, std::string debugName, VkDescriptorSetLayout predefinedLayout=VK_NULL_HANDLE, VkDescriptorSetLayoutCreateFlags descriptorSetLayoutCreateFlags=0)
Creates the VkDescriptorSet.
void AssertHandleNotNull(void *handle, uint32_t binding)
void SetDescriptorAt(uint32_t binding, const std::vector< const ManagedImage * > &images, VkImageLayout layout, VkSampler sampler, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (image array)
void SetDescriptorAt(uint32_t binding, const std::vector< const ManagedBuffer * > &buffers, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (buffer array)
void SetDescriptorAt(uint32_t binding, const VkDescriptorBufferInfo &bufferInfo, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (buffer info)
void SetDescriptorAt(uint32_t binding, const ManagedImage &image, VkImageLayout layout, VkSampler sampler, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (image)
virtual void Destroy() override
Destroys descriptorset and layout (latter only if also allocated by this object)
void SetDescriptorAt(uint32_t binding, void *pNext, uint32_t DescriptorCount, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (custom / .pNext)
void SetDescriptorAt(uint32_t binding, const std::vector< VkDescriptorImageInfo > &imageInfos, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (image info array)
void SetDescriptorAt(uint32_t binding, const std::vector< const CombinedImageSampler * > &sampledImages, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (CombinedImageSampler)
void Update()
Rather than reallocating the descriptorset, rewrites all bindings to the descriptor set.
VkDescriptorSetLayout mDescriptorSetLayout
Definition foray_descriptorset.hpp:120
void SetDescriptorAt(uint32_t binding, const ManagedImage *image, VkImageLayout layout, VkSampler sampler, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (image)
void SetDescriptorAt(uint32_t binding, const CombinedImageSampler *sampledImage, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (CombinedImageSampler)
void CreateDescriptorSet()
VkDescriptorSet mDescriptorSet
Definition foray_descriptorset.hpp:122
void SetDescriptorAt(uint32_t binding, const ManagedBuffer *buffer, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags)
Set a binding (buffer)
void AssertBindingInUse(uint32_t binding)
std::unordered_map< uint32_t, DescriptorInfo > mMapBindingToDescriptorInfo
Definition foray_descriptorset.hpp:117
~DescriptorSet()
Definition foray_descriptorset.hpp:30
Wraps allocation and lifetime functionality of a VkBuffer.
Definition foray_managedbuffer.hpp:12
Wraps allocation and lifetime functionality of VkImage.
Definition foray_managedimage.hpp:13
ManagedResource variant which automates GetTypeName() overloading by returning a stringified version ...
Definition foray_managedresource.hpp:59
#define FORAY_GETTER_V(member)
Return value.
Definition foray_basics.hpp:39
Definition foray_commandbuffer.hpp:6
Non owning context object.
Definition foray_context.hpp:16
Definition foray_descriptorset.hpp:108
std::vector< VkDescriptorImageInfo > ImageInfos
Definition foray_descriptorset.hpp:110
void * pNext
Definition foray_descriptorset.hpp:111
uint32_t DescriptorCount
Definition foray_descriptorset.hpp:113
VkShaderStageFlags ShaderStageFlags
Definition foray_descriptorset.hpp:114
std::vector< VkDescriptorBufferInfo > BufferInfos
Definition foray_descriptorset.hpp:109
VkDescriptorType DescriptorType
Definition foray_descriptorset.hpp:112