Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
|
Helps with the creation of a VkDescriptorSetLayout and VkDescriptorSet. More...
#include <foray_descriptorset.hpp>
Classes | |
struct | DescriptorInfo |
Public Member Functions | |
void | Create (Context *context, std::string debugName, VkDescriptorSetLayout predefinedLayout=VK_NULL_HANDLE, VkDescriptorSetLayoutCreateFlags descriptorSetLayoutCreateFlags=0) |
Creates the VkDescriptorSet. | |
void | Update () |
Rather than reallocating the descriptorset, rewrites all bindings to the descriptor set. | |
virtual void | Destroy () override |
Destroys descriptorset and layout (latter only if also allocated by this object) | |
~DescriptorSet () | |
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 ManagedBuffer &buffer, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (buffer) | |
void | SetDescriptorAt (uint32_t binding, const ManagedBuffer *buffer, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (buffer) | |
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 ManagedImage *image, VkImageLayout layout, VkSampler sampler, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (image) | |
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 std::vector< VkDescriptorImageInfo > &imageInfos, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (image info array) | |
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 VkDescriptorImageInfo &imageInfo, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (image info) | |
void | SetDescriptorAt (uint32_t binding, const VkDescriptorBufferInfo &bufferInfo, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (buffer info) | |
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 CombinedImageSampler &sampledImage, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (CombinedImageSampler) | |
void | SetDescriptorAt (uint32_t binding, const CombinedImageSampler *sampledImage, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (CombinedImageSampler) | |
void | SetDescriptorAt (uint32_t binding, const std::vector< const CombinedImageSampler * > &sampledImages, VkImageLayout layout, VkDescriptorType descriptorType, VkShaderStageFlags shaderStageFlags) |
Set a binding (CombinedImageSampler) | |
bool | Exists () const override |
Return true, if the managed resource is allocated. | |
![]() | |
VulkanResource () | |
VulkanResource (std::string_view name) | |
virtual std::string_view | GetTypeName () const |
Returns <OBJECT_TYPE> stringified. | |
![]() | |
ManagedResource () | |
Default constructor registers the resource. | |
ManagedResource (std::string_view name) | |
Registers the resource and sets its name. | |
virtual | ~ManagedResource () |
Unregisters the resource. | |
std::string_view | GetName () const |
Return a custom name for the object. | |
virtual void | SetName (std::string_view name) |
Set a custom name for the object. | |
std::string | Print () const |
Print name and type in one string. | |
![]() | |
NoMoveDefaults ()=default | |
NoMoveDefaults (const NoMoveDefaults &other)=delete | |
NoMoveDefaults (NoMoveDefaults &&other)=default | |
NoMoveDefaults & | operator= (const NoMoveDefaults &other)=delete |
Protected Member Functions | |
void | CreateDescriptorSet () |
void | CreateDescriptorSetLayout (VkDescriptorSetLayoutCreateFlags descriptorSetLayoutCreateFlags) |
void | AssertBindingInUse (uint32_t binding) |
void | AssertHandleNotNull (void *handle, uint32_t binding) |
![]() | |
virtual void | SetObjectName (core::Context *context, const void *handle, std::string_view name, bool updateResourceName=true) |
Set the object name. Sets both ManagedResource::mName aswell as vulkan debug object name. | |
Protected Attributes | |
std::unordered_map< uint32_t, DescriptorInfo > | mMapBindingToDescriptorInfo |
Context * | mContext {} |
VkDescriptorPool | mDescriptorPool {} |
VkDescriptorSetLayout | mDescriptorSetLayout {} |
bool | mExternalLayout = false |
VkDescriptorSet | mDescriptorSet {} |
![]() | |
std::string | mName |
This objects custom name. | |
Additional Inherited Members | |
![]() | |
static void | sPrintAllocatedResources (bool printAsWarning) |
Print a list of all registered existing resources. | |
static const std::unordered_set< ManagedResource * > * | GetTotalAllocatedResources () |
Helps with the creation of a VkDescriptorSetLayout and VkDescriptorSet.
Not supported:
|
inline |
|
protected |
|
protected |
void foray::core::DescriptorSet::Create | ( | Context * | context, |
std::string | debugName, | ||
VkDescriptorSetLayout | predefinedLayout = VK_NULL_HANDLE , |
||
VkDescriptorSetLayoutCreateFlags | descriptorSetLayoutCreateFlags = 0 |
||
) |
Creates the VkDescriptorSet.
context | Requires Device, DispatchTable |
debugName | Debug object name |
predefinedLayout | Allows reusing an already defined layout |
descriptorSetLayoutCreateFlags | flags |
|
protected |
|
protected |
|
overridevirtual |
Destroys descriptorset and layout (latter only if also allocated by this object)
Implements foray::core::ManagedResource.
|
inlineoverridevirtual |
Return true, if the managed resource is allocated.
Example: Vulkan object stored could be nullptr or instantiated
Implements foray::core::ManagedResource.
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const CombinedImageSampler & | sampledImage, | ||
VkImageLayout | layout, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (CombinedImageSampler)
binding | binding index |
sampledImage | Image + Sampler combo |
layout | ImageLayout |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const CombinedImageSampler * | sampledImage, | ||
VkImageLayout | layout, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (CombinedImageSampler)
binding | binding index |
sampledImage | Image + Sampler combo |
layout | ImageLayout |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const ManagedBuffer & | buffer, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (buffer)
binding | binding index |
buffer | buffer. Is converted to a VkDescriptorBufferInfo object. |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const ManagedBuffer * | buffer, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (buffer)
binding | binding index |
buffer | buffer. Is converted to a VkDescriptorBufferInfo object. |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const ManagedImage & | image, | ||
VkImageLayout | layout, | ||
VkSampler | sampler, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (image)
binding | binding index |
images | image. Is converted to a VkDescriptorImageInfo object (with layout and sampler). |
layout | image layout as accessed from shader |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const ManagedImage * | image, | ||
VkImageLayout | layout, | ||
VkSampler | sampler, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (image)
binding | binding index |
images | image. Is converted to a VkDescriptorImageInfo object (with layout and sampler). |
layout | image layout as accessed from shader |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const std::vector< const CombinedImageSampler * > & | sampledImages, | ||
VkImageLayout | layout, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (CombinedImageSampler)
binding | binding index |
sampledImage | Image + Sampler vector (shared layout) |
layout | ImageLayout |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const std::vector< const ManagedBuffer * > & | buffers, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (buffer array)
binding | binding index |
buffers | vector of buffers. Is converted to a VkDescriptorBufferInfos vector. |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const std::vector< const ManagedImage * > & | images, | ||
VkImageLayout | layout, | ||
VkSampler | sampler, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (image array)
binding | binding index |
images | image array. Is converted to a VkDescriptorImageInfo vector (shared layout and sampler). |
layout | image layout as accessed from shader |
sampler | shared sampler |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const std::vector< VkDescriptorBufferInfo > & | bufferInfos, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (buffer info array)
binding | binding index |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const std::vector< VkDescriptorImageInfo > & | imageInfos, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (image info array)
binding | binding index |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const VkDescriptorBufferInfo & | bufferInfo, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (buffer info)
binding | binding index |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
const VkDescriptorImageInfo & | imageInfo, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (image info)
binding | binding index |
void foray::core::DescriptorSet::SetDescriptorAt | ( | uint32_t | binding, |
void * | pNext, | ||
uint32_t | DescriptorCount, | ||
VkDescriptorType | descriptorType, | ||
VkShaderStageFlags | shaderStageFlags | ||
) |
Set a binding (custom / .pNext)
binding | binding index |
pNext | address assigned to VkDescriptorWrite::pNext |
void foray::core::DescriptorSet::Update | ( | ) |
Rather than reallocating the descriptorset, rewrites all bindings to the descriptor set.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |