SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::IDescriptorLayout Class Referenceabstract

Describes a the layout of a single descriptor within a DescriptorSet. More...

#include <DescriptorSet.h>

Inheritance diagram for spark::render::IDescriptorLayout:
spark::render::IBufferLayout spark::render::vk::VulkanDescriptorLayout

Public Member Functions

virtual DescriptorType descriptorType () const noexcept=0
 Gets the type of the descriptor.
 
virtual unsigned int descriptors () const noexcept=0
 Gets the number of descriptors in the descriptor array, or 0xFFFFFFFF if the descriptor is unbounded.
 
virtual const ISamplerstaticSampler () const noexcept=0
 Gets the state of the sampler if it is a static sampler.
 
- Public Member Functions inherited from spark::render::IBufferLayout
virtual std::size_t elementSize () const noexcept=0
 Gets the size of a single element in the buffer.
 
virtual unsigned int binding () const noexcept=0
 Gets the binding point the buffer will be bound to.
 
virtual BufferType type () const noexcept=0
 Gets the type of the buffer.
 

Detailed Description

Describes a the layout of a single descriptor within a DescriptorSet.

A common metaphor for a descriptor to think of it as a "pointer for the GPU". Basically, a descriptor points to a buffer in a shader. A descriptor can have different types and sizes. The types a descriptor can have are described by the DescriptorType.

If the descriptor is a sampler, it can either be a dynamic or static sampler. A dynamic sampler needs to be bound during runtime just like any other descriptor by calling IDescriptorSet::update(). A static sampler is defined alongside the descriptor layout and is automatically set when the pipeline that uses the descriptor layout gets bound. In this case, the descriptor must not be updated with another sampler. If a descriptor layout describes a static sampler, the IDescriptorLayout::staticSampler() returns a pointer to the static sampler state.

Member Function Documentation

◆ descriptors()

virtual unsigned int spark::render::IDescriptorLayout::descriptors ( ) const
nodiscardpure virtualnoexcept

Gets the number of descriptors in the descriptor array, or 0xFFFFFFFF if the descriptor is unbounded.

Returns
The number of descriptors in the descriptor array, or 0xFFFFFFFF if the descriptor is unbounded.
Note
If the descriptor is unbounded, the size of the array must be specified when allocating a IDescriptorSet using the descriptors parameter.

Implemented in spark::render::vk::VulkanDescriptorLayout.

◆ descriptorType()

virtual DescriptorType spark::render::IDescriptorLayout::descriptorType ( ) const
nodiscardpure virtualnoexcept

Gets the type of the descriptor.

Returns
A DescriptorType representing the type of the descriptor.

Implemented in spark::render::vk::VulkanDescriptorLayout.

◆ staticSampler()

virtual const ISampler * spark::render::IDescriptorLayout::staticSampler ( ) const
nodiscardpure virtualnoexcept

Gets the state of the sampler if it is a static sampler.

Returns
A pointer to ISampler containing the state of the sampler if the descriptor is a static sampler, or nullptr if the descriptor is not a static sampler.

Implemented in spark::render::vk::VulkanDescriptorLayout.