Class DescriptorBuilder

Class Documentation

class inexor::vulkan_renderer::wrapper::DescriptorBuilder

Public Functions

DescriptorBuilder(const Device &device, std::uint32_t swapchain_image_count)

Constructs the descriptor builder.

Parameters
  • device – The const reference to a device RAII wrapper instance.

  • swapchain_image_count – The number of images in swapchain.

DescriptorBuilder(const DescriptorBuilder&) = delete
DescriptorBuilder(DescriptorBuilder&&) = delete
~DescriptorBuilder() = default
DescriptorBuilder &operator=(const DescriptorBuilder&) = delete
DescriptorBuilder &operator=(DescriptorBuilder&&) = delete
template<typename T>
DescriptorBuilder &add_uniform_buffer(VkBuffer uniform_buffer, std::uint32_t binding, VkShaderStageFlagBits shader_stage = VK_SHADER_STAGE_VERTEX_BIT)

Adds a uniform buffer to the descriptor container.

Template Parameters

T – The type of the uniform buffer.

Parameters
  • uniform_buffer – The uniform buffer which contains the data which will be accessed by the shader.

  • binding – The binding index which will be used in the SPIR-V shader.

  • shader_stage – The shader stage the uniform buffer will be used in, most likely the vertex shader.

Returns

A const reference to this DescriptorBuilder instance.

DescriptorBuilder &add_combined_image_sampler(VkSampler image_sampler, VkImageView image_view, std::uint32_t binding, VkShaderStageFlagBits shader_stage = VK_SHADER_STAGE_FRAGMENT_BIT)

Adds a combined image sampler to the descriptor container.

Parameters
  • image_sampler – The pointer to the combined image sampler.

  • image_view – The pointer to the image view.

  • binding – The binding index which will be used in the SPIR-V shader.

  • shader_stage – The shader stage the uniform buffer will be used in, most likely the fragment shader.

Returns

A const reference to this DescriptorBuilder instance.

ResourceDescriptor build(std::string name)

Builds the resource descriptor.

Parameters

name – The internal name of the resource descriptor.

Returns

The resource descriptor which was created by the builder.

Private Members

const Device &m_device
const std::uint32_t m_swapchain_image_count = {0}
std::vector<VkDescriptorSetLayoutBinding> m_layout_bindings
std::vector<VkWriteDescriptorSet> m_write_sets
std::vector<VkDescriptorBufferInfo> m_descriptor_buffer_infos
std::vector<VkDescriptorImageInfo> m_descriptor_image_infos