3#include "spark/render/DescriptorSet.h"
4#include "spark/render/Export.h"
5#include "spark/render/PushConstantsLayout.h"
6#include "spark/render/StateResource.h"
31 [[nodiscard]] std::vector<const IDescriptorSetLayout*>
descriptorSets() const noexcept {
return genericDescriptorSets(); }
41 [[nodiscard]] virtual std::vector<const
IDescriptorSetLayout*> genericDescriptorSets() const noexcept = 0;
49 template <typename DescriptorSetLayoutType, typename PushConstantsLayoutType>
53 using descriptor_set_layout_type = DescriptorSetLayoutType;
54 using push_constants_layout_type = PushConstantsLayoutType;
58 [[nodiscard]]
const descriptor_set_layout_type&
descriptorSet(
unsigned int space)
const override = 0;
61 [[nodiscard]]
virtual std::vector<const descriptor_set_layout_type*>
descriptorSets() const noexcept = 0;
64 [[nodiscard]] const push_constants_layout_type* pushConstants() const noexcept override = 0;
67 [[nodiscard]] std::vector<const
IDescriptorSetLayout*> genericDescriptorSets() const noexcept
override
69 std::vector<const IDescriptorSetLayout*> descriptor_sets_vector;
70 descriptor_sets_vector.reserve(descriptorSets().size());
71 std::ranges::transform(descriptorSets(),
72 std::back_inserter(descriptor_sets_vector),
73 [](
const auto& descriptor_set) {
return static_cast<const IDescriptorSetLayout*
>(descriptor_set); });
74 return descriptor_sets_vector;
90 [[nodiscard]] std::shared_ptr<const IShaderProgram>
program() const noexcept {
return genericProgram(); }
96 [[nodiscard]] std::shared_ptr<IPipelineLayout>
layout() const noexcept {
return genericLayout(); }
101 [[nodiscard]]
virtual std::shared_ptr<const IShaderProgram> genericProgram() const noexcept = 0;
102 [[nodiscard]] virtual std::shared_ptr<
IPipelineLayout> genericLayout() const noexcept = 0;
111 template <typename PipelineLayoutType, typename ShaderProgramType>
115 using shader_program_type = ShaderProgramType;
116 using pipeline_layout_type = PipelineLayoutType;
120 [[nodiscard]]
virtual std::shared_ptr<const shader_program_type>
program() const noexcept = 0;
123 [[nodiscard]] virtual std::shared_ptr<pipeline_layout_type> layout() const noexcept = 0;
126 [[nodiscard]] std::shared_ptr<
IPipelineLayout> genericLayout() const noexcept final {
return std::static_pointer_cast<IPipelineLayout>(layout()); }
127 [[nodiscard]] std::shared_ptr<const IShaderProgram> genericProgram() const noexcept final {
return std::static_pointer_cast<const IShaderProgram>(program()); }
Interface for a descriptor set layout.
Definition DescriptorSet.h:262
Interface for pipeline layouts.
Definition Pipeline.h:16
virtual const IDescriptorSetLayout & descriptorSet(unsigned int space) const =0
Gets the descriptor set layout bound to the given space.
std::vector< const IDescriptorSetLayout * > descriptorSets() const noexcept
Gets all descriptor set layouts the pipeline has been initialized with.
Definition Pipeline.h:31
virtual const IPushConstantsLayout * pushConstants() const noexcept=0
Gets the push constants layout, or nullptr, if the pipeline does not use any push constants.
Interface representing a pipeline.
Definition Pipeline.h:82
std::shared_ptr< IPipelineLayout > layout() const noexcept
Gets the pipeline layout.
Definition Pipeline.h:96
std::shared_ptr< const IShaderProgram > program() const noexcept
Gets the shader program used by the pipeline.
Definition Pipeline.h:90
Interface for a push constants layout.
Definition PushConstantsLayout.h:15
Interface for a state resource.
Definition StateResource.h:14
Represents a the layout of a RenderPipeline.
Definition Pipeline.h:51
virtual std::vector< const descriptor_set_layout_type * > descriptorSets() const noexcept=0
Gets all descriptor set layouts the pipeline has been initialized with.
const descriptor_set_layout_type & descriptorSet(unsigned int space) const override=0
Gets the descriptor set layout bound to the given space.
Represents a pipeline state.
Definition Pipeline.h:113
virtual std::shared_ptr< const shader_program_type > program() const noexcept=0
Gets the shader program used by the pipeline.