3#include <litefx/rendering_api.hpp>
4#include <litefx/rendering_formatters.hpp>
16 template <
typename TBuffer,
typename TImage>
requires
17 std::derived_from<TBuffer, IBuffer> &&
18 std::derived_from<TImage, IImage>
35 virtual
void transition(
buffer_type& buffer, const ResourceState& sourceState, const ResourceState& targetState) = 0;
47 virtual
void transition(
image_type& image, const ResourceState& sourceState, const ResourceState& targetState) = 0;
59 virtual
void doTransition(
IBuffer& buffer, const ResourceState& targetState)
override {
63 virtual void doTransition(
IBuffer& buffer,
const UInt32& element,
const ResourceState& targetState)
override {
67 virtual void doTransition(
IBuffer& buffer,
const ResourceState& sourceState,
const ResourceState& targetState)
override {
71 virtual void doTransition(
IBuffer& buffer,
const ResourceState& sourceState,
const UInt32& element,
const ResourceState& targetState)
override {
75 virtual void doTransition(
IImage& image,
const ResourceState& targetState)
override {
79 virtual void doTransition(
IImage& image,
const UInt32& level,
const UInt32& layer,
const UInt32& plane,
const ResourceState& targetState)
override {
83 virtual void doTransition(
IImage& image,
const ResourceState& sourceState,
const ResourceState& targetState)
override {
87 virtual void doTransition(
IImage& image,
const ResourceState& sourceState,
const UInt32& level,
const UInt32& layer,
const UInt32& plane,
const ResourceState& targetState)
override {
88 this->
transition(
dynamic_cast<image_type&
>(image), sourceState, level, layer, plane, targetState);
91 virtual void doWaitFor(
const IBuffer& buffer)
override {
95 virtual void doWaitFor(
const IImage& image)
override {
165 template <
typename TBuffer,
typename TImage,
typename TSampler>
requires
166 std::derived_from<TBuffer, IBuffer> &&
167 std::derived_from<TSampler, ISampler> &&
168 std::derived_from<TImage, IImage>
192 virtual
void doUpdate(const
UInt32& binding, const
IBuffer& buffer, const
UInt32& bufferElement, const
UInt32& elements, const
UInt32& firstDescriptor)
const override {
193 this->
update(binding,
dynamic_cast<const buffer_type&
>(buffer), bufferElement, elements, firstDescriptor);
196 virtual void doUpdate(
const UInt32& binding,
const IImage& texture,
const UInt32& descriptor,
const UInt32& firstLevel,
const UInt32& levels,
const UInt32& firstLayer,
const UInt32& layers)
const override {
197 this->
update(binding,
dynamic_cast<const image_type&
>(texture), descriptor, firstLevel, levels, firstLayer, layers);
200 virtual void doUpdate(
const UInt32& binding,
const ISampler& sampler,
const UInt32& descriptor)
const override {
204 virtual void doAttach(
const UInt32& binding,
const IImage& image)
const override {
221 template <
typename TDescriptorLayout,
typename TDescriptorSet>
requires
222 rtti::implements<TDescriptorLayout, IDescriptorLayout> &&
223 rtti::implements<TDescriptorSet, DescriptorSet<typename TDescriptorSet::buffer_type, typename TDescriptorSet::image_type, typename TDescriptorSet::sampler_type>>
261 results.reserve(sets.size());
262 std::move(sets.begin(), sets.end(), std::inserter(results, results.end()));
266 virtual void releaseDescriptorSet(
const IDescriptorSet& descriptorSet)
const noexcept override {
294 template <
typename TPushConstantsRange>
requires
295 rtti::implements<TPushConstantsRange, IPushConstantsRange>
319 template <
typename TShaderModule>
requires
344 template <
typename TDescriptorSetLayout,
typename TPushConstantsLayout>
requires
376 template <
typename TVertexBufferLayout>
requires
394 template <typename TIndexBufferLayout> requires
413 template <typename TVertexBufferLayout, typename TIndexBufferLayout> requires
436 auto layouts = this->vertexBufferLayouts();
448 template <
typename TPipelineLayout,
typename TShaderProgram>
requires
468 return std::static_pointer_cast<const IShaderProgram>(this->program());
472 return std::static_pointer_cast<const IPipelineLayout>(this->
layout());
485 template <
typename TBuffer,
typename TVertexBuffer,
typename TIndexBuffer,
typename TImage,
typename TBarrier,
typename TPipeline>
requires
486 rtti::implements<TBarrier, Barrier<TBuffer, TImage>> &&
487 std::derived_from<TPipeline, Pipeline<typename TPipeline::pipeline_layout_type, typename TPipeline::shader_program_type>>
512 virtual
void barrier(const
barrier_type& barrier, const
bool& invert = false) const noexcept = 0;
515 virtual
void generateMipMaps(
image_type& image) noexcept = 0;
546 this->bind(vertexBuffer);
547 this->draw(vertexBuffer.elements(), instances, firstVertex, firstInstance);
552 this->bind(indexBuffer);
553 this->drawIndexed(indexBuffer.elements(), instances, firstIndex, vertexOffset, firstInstance);
558 this->bind(vertexBuffer);
559 this->bind(indexBuffer);
560 this->drawIndexed(indexBuffer.elements(), instances, firstIndex, vertexOffset, firstInstance);
564 virtual void cmdBarrier(
const IBarrier& barrier,
const bool& invert)
const noexcept override {
565 this->barrier(
dynamic_cast<const barrier_type&
>(barrier), invert);
568 virtual void cmdGenerateMipMaps(
IImage& image)
noexcept override {
569 this->generateMipMaps(
dynamic_cast<image_type&
>(image));
573 this->transfer(
dynamic_cast<const buffer_type&
>(source),
dynamic_cast<const buffer_type&
>(target), sourceElement, targetElement,
elements);
577 this->transfer(
dynamic_cast<const buffer_type&
>(source),
dynamic_cast<const image_type&
>(target), sourceElement, firstSubresource,
elements);
580 virtual void cmdTransfer(
const IImage& source,
const IImage& target,
const UInt32& sourceSubresource,
const UInt32& targetSubresource,
const UInt32& subresources)
const override {
581 this->transfer(
dynamic_cast<const image_type&
>(source),
dynamic_cast<const image_type&
>(target), sourceSubresource, targetSubresource, subresources);
584 virtual void cmdTransfer(
const IImage& source,
const IBuffer& target,
const UInt32& firstSubresource,
const UInt32& targetElement,
const UInt32& subresources)
const override {
585 this->transfer(
dynamic_cast<const image_type&
>(source),
dynamic_cast<const buffer_type&
>(target), firstSubresource, targetElement, subresources);
588 virtual void cmdUse(
const IPipeline& pipeline)
const noexcept override {
589 this->use(
dynamic_cast<const pipeline_type&
>(pipeline));
593 this->bind(
dynamic_cast<const descriptor_set_type&
>(descriptorSet),
dynamic_cast<const pipeline_type&
>(pipeline));
596 virtual void cmdBind(
const IVertexBuffer& buffer)
const noexcept override {
597 this->bind(
dynamic_cast<const vertex_buffer_type&
>(buffer));
600 virtual void cmdBind(
const IIndexBuffer& buffer)
const noexcept override {
601 this->bind(
dynamic_cast<const index_buffer_type&
>(buffer));
605 this->pushConstants(
dynamic_cast<const push_constants_layout_type&
>(
layout), memory);
608 virtual void cmdDraw(
const IVertexBuffer& vertexBuffer,
const UInt32& instances,
const UInt32& firstVertex,
const UInt32& firstInstance)
const override {
609 this->draw(
dynamic_cast<const vertex_buffer_type&
>(vertexBuffer), instances, firstVertex, firstInstance);
612 virtual void cmdDrawIndexed(
const IIndexBuffer& indexBuffer,
const UInt32& instances,
const UInt32& firstIndex,
const Int32& vertexOffset,
const UInt32& firstInstance)
const override {
613 this->drawIndexed(
dynamic_cast<const index_buffer_type&
>(indexBuffer), instances, firstIndex, vertexOffset, firstInstance);
617 this->drawIndexed(
dynamic_cast<const vertex_buffer_type&
>(vertexBuffer),
dynamic_cast<const index_buffer_type&
>(indexBuffer), instances, firstIndex, vertexOffset, firstInstance);
629 template <
typename TPipelineLayout,
typename TShaderProgram,
typename TInputAssembler,
typename TRasterizer>
requires
630 rtti::implements<TInputAssembler, InputAssembler<typename TInputAssembler::vertex_buffer_layout_type, typename TInputAssembler::index_buffer_layout_type>> &&
631 rtti::implements<TRasterizer, Rasterizer>
649 return this->inputAssembler();
653 return this->rasterizer();
663 template <
typename TPipelineLayout,
typename TShaderProgram>
674 template <typename TCommandBuffer> requires
675 rtti::implements<TCommandBuffer,
CommandBuffer<typename TCommandBuffer::buffer_type, typename TCommandBuffer::vertex_buffer_type, typename TCommandBuffer::index_buffer_type, typename TCommandBuffer::image_type, typename TCommandBuffer::barrier_type, typename TCommandBuffer::pipeline_type>>
699 auto commandBuffers = this->commandBuffers();
704 auto images = this->images();
717 template <
typename TFrameBuffer>
requires
718 rtti::implements<TFrameBuffer, FrameBuffer<typename TFrameBuffer::command_buffer_type>>
740 template <typename TInputAttachmentMappingSource> requires
770 virtual const
UInt32& location() const noexcept = 0;
783 template <typename TRenderPipeline, typename TFrameBuffer, typename TInputAttachmentMapping> requires
784 rtti::implements<TFrameBuffer,
FrameBuffer<typename TFrameBuffer::command_buffer_type>> &&
785 rtti::implements<TRenderPipeline,
RenderPipeline<typename TRenderPipeline::pipeline_layout_type, typename TRenderPipeline::shader_program_type, typename TRenderPipeline::input_assembler_type, typename TRenderPipeline::rasterizer_type>>
817 auto frameBuffers = this->frameBuffers();
822 auto pipelines = this->pipelines();
826 virtual void setAttachments(
const IDescriptorSet& descriptorSet)
const override {
827 this->updateAttachments(
dynamic_cast<const descriptor_set_type&
>(descriptorSet));
835 template <
typename TImageInterface,
typename TFrameBuffer>
requires
836 rtti::implements<TFrameBuffer, FrameBuffer<typename TFrameBuffer::command_buffer_type>> &&
837 std::derived_from<TImageInterface, IImage>
863 auto images = this->images();
872 template <
typename TCommandBuffer>
requires
873 rtti::implements<TCommandBuffer, CommandBuffer<typename TCommandBuffer::buffer_type, typename TCommandBuffer::vertex_buffer_type, typename TCommandBuffer::index_buffer_type, typename TCommandBuffer::image_type, typename TCommandBuffer::barrier_type, typename TCommandBuffer::pipeline_type>>
893 return this->createCommandBuffer(beginRecording);
897 return this->submit(
dynamic_cast<const command_buffer_type&
>(commandBuffer));
902 buffers.reserve(commandBuffers.size());
903 std::transform(commandBuffers.begin(), commandBuffers.end(), buffers.begin(), [](
auto buffer) { return dynamic_cast<const command_buffer_type*>(buffer); });
904 return this->submit(buffers);
923 template <
typename TDescriptorLayout,
typename TBuffer,
typename TVertexBuffer,
typename TIndexBuffer,
typename TImage,
typename TSampler>
requires
924 rtti::implements<TDescriptorLayout, IDescriptorLayout> &&
925 std::derived_from<TVertexBuffer, VertexBuffer<typename TVertexBuffer::vertex_buffer_layout_type>> &&
926 std::derived_from<TIndexBuffer, IndexBuffer<typename TIndexBuffer::index_buffer_layout_type>> &&
927 std::derived_from<TImage, IImage> &&
928 std::derived_from<TBuffer, IBuffer> &&
929 std::derived_from<TSampler, ISampler>
964 virtual
UniquePtr<TImage> createAttachment(const Format& format, const
Size2d&
size, const MultiSamplingLevel& samples = MultiSamplingLevel::x1) const = 0;
967 virtual
UniquePtr<TImage> createAttachment(const
String&
name, const Format& format, const
Size2d&
size, const MultiSamplingLevel& samples = MultiSamplingLevel::x1) const = 0;
970 virtual
UniquePtr<TImage> createTexture(const Format& format, const
Size3d&
size, const ImageDimensions& dimension = ImageDimensions::DIM_2, const
UInt32& levels = 1, const
UInt32& layers = 1, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, const
bool& allowWrite = false) const = 0;
973 virtual
UniquePtr<TImage> createTexture(const
String&
name, const Format& format, const
Size3d&
size, const ImageDimensions& dimension = ImageDimensions::DIM_2, const
UInt32& levels = 1, const
UInt32& layers = 1, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, const
bool& allowWrite = false) const = 0;
976 virtual
Array<
UniquePtr<TImage>> createTextures(const
UInt32&
elements, const Format& format, const
Size3d&
size, const ImageDimensions& dimension = ImageDimensions::DIM_2, const
UInt32 & layers = 1, const
UInt32& levels = 1, const MultiSamplingLevel& samples = MultiSamplingLevel::x1, const
bool& allowWrite = false) const = 0;
979 virtual
UniquePtr<TSampler> createSampler(const FilterMode& magFilter = FilterMode::Nearest, const FilterMode& minFilter = FilterMode::Nearest, const BorderMode& borderU = BorderMode::Repeat, const BorderMode& borderV = BorderMode::Repeat, const BorderMode& borderW = BorderMode::Repeat, const MipMapMode& mipMapMode = MipMapMode::Nearest, const
Float& mipMapBias = 0.f, const
Float& maxLod = std::numeric_limits<
Float>::max(), const
Float& minLod = 0.f, const
Float& anisotropy = 0.f) const = 0;
982 virtual
UniquePtr<TSampler> createSampler(const
String&
name, const FilterMode& magFilter = FilterMode::Nearest, const FilterMode& minFilter = FilterMode::Nearest, const BorderMode& borderU = BorderMode::Repeat, const BorderMode& borderV = BorderMode::Repeat, const BorderMode& borderW = BorderMode::Repeat, const MipMapMode& mipMapMode = MipMapMode::Nearest, const
Float& mipMapBias = 0.f, const
Float& maxLod = std::numeric_limits<
Float>::max(), const
Float& minLod = 0.f, const
Float& anisotropy = 0.f) const = 0;
985 virtual
Array<
UniquePtr<TSampler>> createSamplers(const
UInt32&
elements, const FilterMode& magFilter = FilterMode::Nearest, const FilterMode& minFilter = FilterMode::Nearest, const BorderMode& borderU = BorderMode::Repeat, const BorderMode& borderV = BorderMode::Repeat, const BorderMode& borderW = BorderMode::Repeat, const MipMapMode& mipMapMode = MipMapMode::Nearest, const
Float& mipMapBias = 0.f, const
Float& maxLod = std::numeric_limits<
Float>::max(), const
Float& minLod = 0.f, const
Float& anisotropy = 0.f) const = 0;
1005 return this->createIndexBuffer(
dynamic_cast<const index_buffer_layout_type&
>(
layout), usage,
elements);
1009 return this->createIndexBuffer(
name,
dynamic_cast<const index_buffer_layout_type&
>(
layout), usage,
elements);
1012 virtual UniquePtr<IImage> getAttachment(
const Format& format,
const Size2d&
size,
const MultiSamplingLevel& samples)
const override {
1013 return this->createAttachment(format,
size, samples);
1017 return this->createAttachment(
name, format,
size, samples);
1020 virtual UniquePtr<IImage> getTexture(
const Format& format,
const Size3d&
size,
const ImageDimensions& dimension,
const UInt32& levels,
const UInt32& layers,
const MultiSamplingLevel& samples,
const bool& allowWrite)
const override {
1021 return this->createTexture(format,
size, dimension, levels, layers, samples, allowWrite);
1024 virtual UniquePtr<IImage> getTexture(
const String&
name,
const Format& format,
const Size3d&
size,
const ImageDimensions& dimension,
const UInt32& levels,
const UInt32& layers,
const MultiSamplingLevel& samples,
const bool& allowWrite)
const override {
1025 return this->createTexture(
name, format,
size, dimension, levels, layers, samples, allowWrite);
1029 auto textures = this->getTextures(
elements, format,
size, dimension, layers, levels, samples, allowWrite);
1031 results.reserve(textures.size());
1032 std::move(std::begin(textures), std::end(textures), std::inserter(results, std::end(results)));
1036 virtual UniquePtr<ISampler> getSampler(
const FilterMode& magFilter,
const FilterMode& minFilter,
const BorderMode& borderU,
const BorderMode& borderV,
const BorderMode& borderW,
const MipMapMode& mipMapMode,
const Float& mipMapBias,
const Float& maxLod,
const Float& minLod,
const Float& anisotropy)
const override {
1037 return this->createSampler(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
1040 virtual UniquePtr<ISampler> getSampler(
const String&
name,
const FilterMode& magFilter,
const FilterMode& minFilter,
const BorderMode& borderU,
const BorderMode& borderV,
const BorderMode& borderW,
const MipMapMode& mipMapMode,
const Float& mipMapBias,
const Float& maxLod,
const Float& minLod,
const Float& anisotropy)
const override {
1041 return this->createSampler(
name, magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
1044 virtual Array<UniquePtr<ISampler>> getSamplers(
const UInt32&
elements,
const FilterMode& magFilter,
const FilterMode& minFilter,
const BorderMode& borderU,
const BorderMode& borderV,
const BorderMode& borderW,
const MipMapMode& mipMapMode,
const Float& mipMapBias,
const Float& maxLod,
const Float& minLod,
const Float& anisotropy)
const override {
1045 auto samplers = this->createSamplers(
elements, magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
1047 results.reserve(samplers.size());
1048 std::move(std::begin(samplers), std::end(samplers), std::inserter(results, std::end(results)));
1069 template <
typename TFactory,
typename TSurface,
typename TGraphicsAdapter,
typename TSwapChain,
typename TCommandQueue,
typename TRenderPass,
typename TComputePipeline,
typename TBarrier>
requires
1070 rtti::implements<TSurface, ISurface> &&
1071 rtti::implements<TGraphicsAdapter, IGraphicsAdapter> &&
1072 rtti::implements<TSwapChain, SwapChain<typename TFactory::image_type, typename TRenderPass::frame_buffer_type>> &&
1073 rtti::implements<TCommandQueue, CommandQueue<typename TCommandQueue::command_buffer_type>> &&
1074 rtti::implements<TFactory, GraphicsFactory<typename TFactory::descriptor_layout_type, typename TFactory::buffer_type, typename TFactory::vertex_buffer_type, typename TFactory::index_buffer_type, typename TFactory::image_type, typename TFactory::sampler_type>> &&
1075 rtti::implements<TRenderPass, RenderPass<typename TRenderPass::render_pipeline_type, typename TRenderPass::frame_buffer_type, typename TRenderPass::input_attachment_mapping_type>> &&
1076 rtti::implements<TComputePipeline, ComputePipeline<typename TComputePipeline::pipeline_layout_type, typename TComputePipeline::shader_program_type>> &&
1077 rtti::implements<TBarrier, Barrier<typename TFactory::buffer_type, typename TFactory::image_type>>
1139 return this->makeBarrier();
1142#if defined(BUILD_DEFINE_BUILDERS)
1144 using render_pass_builder_type = render_pass_type::builder_type;
1145 using render_pipeline_builder_type = render_pipeline_type::builder_type;
1146 using compute_pipeline_builder_type = compute_pipeline_type::builder_type;
1147 using pipeline_layout_builder_type = pipeline_layout_type::builder_type;
1148 using input_assembler_builder_type = input_assembler_type::builder_type;
1149 using rasterizer_builder_type = rasterizer_type::builder_type;
1150 using shader_program_builder_type = shader_program_type::builder_type;
1158 [[nodiscard]]
virtual render_pass_builder_type buildRenderPass(
const MultiSamplingLevel& samples = MultiSamplingLevel::x1,
const UInt32& commandBuffers = 1)
const = 0;
1167 [[nodiscard]]
virtual render_pass_builder_type buildRenderPass(
const String&
name,
const MultiSamplingLevel& samples = MultiSamplingLevel::x1,
const UInt32& commandBuffers = 1)
const = 0;
1174 [[nodiscard]]
virtual compute_pipeline_builder_type buildComputePipeline(
const String&
name)
const = 0;
1189 [[nodiscard]]
virtual render_pipeline_builder_type buildRenderPipeline(
const render_pass_type& renderPass,
const String&
name)
const = 0;
1195 [[nodiscard]]
virtual pipeline_layout_builder_type buildPipelineLayout()
const = 0;
1201 [[nodiscard]]
virtual input_assembler_builder_type buildInputAssembler()
const = 0;
1207 [[nodiscard]]
virtual rasterizer_builder_type buildRasterizer()
const = 0;
1213 [[nodiscard]]
virtual shader_program_builder_type buildShaderProgram()
const = 0;
1222 template <
typename TBackend,
typename TGraphicsDevice>
requires
1267 template <typename ...TArgs>
1269 auto device = makeUnique<device_type>(
static_cast<const TBackend&
>(*
this), adapter, std::move(surface), std::forward<TArgs>(_args)...);
1270 auto devicePointer = device.get();
1271 this->registerDevice(
name, std::move(device));
1272 return devicePointer;
1289 return this->device(
name);
1294 return this->device(
name);
1300 auto adapters = this->listAdapters();
A barrier that transitions a set of resources backed by IDeviceMemory into different ResourceState.
Definition: rendering.hpp:19
virtual void waitFor(const buffer_type &buffer)=0
TImage image_type
Definition: rendering.hpp:22
virtual ~Barrier() noexcept=default
virtual void transition(buffer_type &buffer, const ResourceState &targetState)=0
TBuffer buffer_type
Definition: rendering.hpp:21
Represents a command buffer, that buffers commands that should be submitted to a CommandQueue.
Definition: rendering.hpp:488
virtual void drawIndexed(const vertex_buffer_type &vertexBuffer, const index_buffer_type &indexBuffer, const UInt32 &instances=1, const UInt32 &firstIndex=0, const Int32 &vertexOffset=0, const UInt32 &firstInstance=0) const
Definition: rendering.hpp:557
TBuffer buffer_type
Definition: rendering.hpp:496
virtual ~CommandBuffer() noexcept=default
pipeline_type::pipeline_layout_type pipeline_layout_type
Definition: rendering.hpp:502
TIndexBuffer index_buffer_type
Definition: rendering.hpp:498
virtual void drawIndexed(const index_buffer_type &indexBuffer, const UInt32 &instances=1, const UInt32 &firstIndex=0, const Int32 &vertexOffset=0, const UInt32 &firstInstance=0) const
Definition: rendering.hpp:551
descriptor_set_layout_type::descriptor_set_type descriptor_set_type
Definition: rendering.hpp:505
TVertexBuffer vertex_buffer_type
Definition: rendering.hpp:497
TImage image_type
Definition: rendering.hpp:499
TPipeline pipeline_type
Definition: rendering.hpp:501
pipeline_layout_type::push_constants_layout_type push_constants_layout_type
Definition: rendering.hpp:504
TBarrier barrier_type
Definition: rendering.hpp:500
pipeline_layout_type::descriptor_set_layout_type descriptor_set_layout_type
Definition: rendering.hpp:503
Represents a command queue.
Definition: rendering.hpp:874
TCommandBuffer command_buffer_type
Definition: rendering.hpp:876
virtual ~CommandQueue() noexcept=default
Represents a compute Pipeline.
Definition: rendering.hpp:664
virtual ~ComputePipeline() noexcept=default
Defines a set of descriptors.
Definition: rendering.hpp:169
virtual void update(const UInt32 &binding, const buffer_type &buffer, const UInt32 &bufferElement=0, const UInt32 &elements=1, const UInt32 &firstDescriptor=0) const =0
TBuffer buffer_type
Definition: rendering.hpp:171
virtual ~DescriptorSet() noexcept=default
TSampler sampler_type
Definition: rendering.hpp:172
virtual void attach(const UInt32 &binding, const image_type &image) const =0
TImage image_type
Definition: rendering.hpp:173
Describes the layout of a descriptor set.
Definition: rendering.hpp:224
virtual Array< const descriptor_layout_type * > descriptors() const noexcept=0
virtual Array< UniquePtr< descriptor_set_type > > allocateMultiple(const UInt32 &descriptorSets, const UInt32 &descriptors=0) const =0
virtual ~DescriptorSetLayout() noexcept=default
virtual const descriptor_layout_type & descriptor(const UInt32 &binding) const =0
Returns the descriptor layout for the descriptor bound to the binding point provided with binding .
TDescriptorSet descriptor_set_type
Definition: rendering.hpp:227
TDescriptorLayout descriptor_layout_type
Definition: rendering.hpp:226
virtual void free(const descriptor_set_type &descriptorSet) const noexcept=0
virtual UniquePtr< descriptor_set_type > allocate(const UInt32 &descriptors=0) const =0
Stores the images for the output attachments for a back buffer of a RenderPass, as well as a CommandB...
Definition: rendering.hpp:676
TCommandBuffer command_buffer_type
Definition: rendering.hpp:678
command_buffer_type::image_type image_type
Definition: rendering.hpp:679
virtual ~FrameBuffer() noexcept=default
Represents the graphics device that a rendering back-end is doing work on.
Definition: rendering.hpp:1078
render_pass_type::render_pipeline_type render_pipeline_type
Definition: rendering.hpp:1095
render_pipeline_type::pipeline_layout_type pipeline_layout_type
Definition: rendering.hpp:1097
render_pipeline_type::rasterizer_type rasterizer_type
Definition: rendering.hpp:1100
TComputePipeline compute_pipeline_type
Definition: rendering.hpp:1096
command_queue_type::command_buffer_type command_buffer_type
Definition: rendering.hpp:1084
TFactory factory_type
Definition: rendering.hpp:1085
TSwapChain swap_chain_type
Definition: rendering.hpp:1082
factory_type::buffer_type buffer_type
Definition: rendering.hpp:1090
factory_type::image_type image_type
Definition: rendering.hpp:1091
TCommandQueue command_queue_type
Definition: rendering.hpp:1083
factory_type::index_buffer_type index_buffer_type
Definition: rendering.hpp:1089
factory_type::sampler_type sampler_type
Definition: rendering.hpp:1092
factory_type::descriptor_layout_type descriptor_layout_type
Definition: rendering.hpp:1087
render_pipeline_type::input_assembler_type input_assembler_type
Definition: rendering.hpp:1099
factory_type::vertex_buffer_type vertex_buffer_type
Definition: rendering.hpp:1088
TSurface surface_type
Definition: rendering.hpp:1080
render_pass_type::frame_buffer_type frame_buffer_type
Definition: rendering.hpp:1094
TRenderPass render_pass_type
Definition: rendering.hpp:1093
render_pipeline_type::shader_program_type shader_program_type
Definition: rendering.hpp:1098
TBarrier barrier_type
Definition: rendering.hpp:1086
virtual ~GraphicsDevice() noexcept=default
TGraphicsAdapter adapter_type
Definition: rendering.hpp:1081
Describes a factory that creates objects for a GraphicsDevice.
Definition: rendering.hpp:930
TBuffer buffer_type
Definition: rendering.hpp:937
TIndexBuffer index_buffer_type
Definition: rendering.hpp:935
vertex_buffer_type::vertex_buffer_layout_type vertex_buffer_layout_type
Definition: rendering.hpp:934
TDescriptorLayout descriptor_layout_type
Definition: rendering.hpp:932
TVertexBuffer vertex_buffer_type
Definition: rendering.hpp:933
TImage image_type
Definition: rendering.hpp:938
TSampler sampler_type
Definition: rendering.hpp:939
index_buffer_type::index_buffer_layout_type index_buffer_layout_type
Definition: rendering.hpp:936
virtual ~GraphicsFactory() noexcept=default
The interface for a memory barrier.
Definition: rendering_api.hpp:2944
Base interface for buffer objects.
Definition: rendering_api.hpp:2774
virtual const BufferType & type() const noexcept=0
Returns the type of the buffer.
The interface for a command buffer.
Definition: rendering_api.hpp:3541
virtual void drawIndexed(const UInt32 &indices, const UInt32 &instances=1, const UInt32 &firstIndex=0, const Int32 &vertexOffset=0, const UInt32 &firstInstance=0) const noexcept=0
Draws the currently bound vertex buffer with a set of indices from the currently bound index buffer.
virtual void end() const =0
Ends recording commands on the command buffer.
virtual void dispatch(const Vector3u &threadCount) const noexcept=0
Executes a compute shader.
virtual void draw(const UInt32 &vertices, const UInt32 &instances=1, const UInt32 &firstVertex=0, const UInt32 &firstInstance=0) const noexcept=0
Draws a number of vertices from the currently bound vertex buffer.
virtual void begin() const =0
Sets the command buffer into recording state, so that it can receive command that should be submitted...
The interface for a command queue.
Definition: rendering_api.hpp:4215
The interface for a compute pipeline.
Definition: rendering_api.hpp:3916
Describes a the layout of a single descriptor within a DescriptorSet.
Definition: rendering_api.hpp:2613
The interface for a descriptor set.
Definition: rendering_api.hpp:3072
The interface for a descriptor set layout.
Definition: rendering_api.hpp:3143
virtual size_t elementSize() const noexcept=0
Returns the size of a single element within the buffer. If there is only one element,...
virtual size_t size() const noexcept=0
Gets the size (in bytes) of the aligned memory chunk.
virtual const UInt32 & elements() const noexcept=0
Gets the number of sub-resources inside the memory chunk.
The interface for a frame buffer.
Definition: rendering_api.hpp:3924
The interface for a graphics device that.
Definition: rendering_api.hpp:4582
The interface for a graphics factory.
Definition: rendering_api.hpp:4324
Describes a generic image.
Definition: rendering_api.hpp:2789
The interface for an index buffer.
Definition: rendering_api.hpp:3458
Describes a index buffer layout.
Definition: rendering_api.hpp:2579
The interface for a pipeline.
Definition: rendering_api.hpp:3512
The interface for a pipeline layout.
Definition: rendering_api.hpp:3410
The interface for a push constants layout.
Definition: rendering_api.hpp:3323
Describes a range within a IPushConstantsLayout.
Definition: rendering_api.hpp:3282
The interface to access a render backend.
Definition: rendering_api.hpp:4692
The interface for a render pass.
Definition: rendering_api.hpp:4019
The interface for a render pipeline.
Definition: rendering_api.hpp:3840
Describes a texture sampler.
Definition: rendering_api.hpp:2872
Represents a single shader module, i.e. a part of a IShaderProgram.
Definition: rendering_api.hpp:1827
The interface for a shader program.
Definition: rendering_api.hpp:3361
virtual const String & name() const noexcept=0
Returns the name of the resource.
Interface for a swap chain.
Definition: rendering_api.hpp:4140
The interface for a vertex buffer.
Definition: rendering_api.hpp:3443
Describes a vertex buffer layout.
Definition: rendering_api.hpp:2563
Describes an index buffer.
Definition: rendering.hpp:396
TIndexBufferLayout index_buffer_layout_type
Definition: rendering.hpp:398
virtual ~IndexBuffer() noexcept=default
Represents a pipeline state.
Definition: rendering.hpp:451
virtual ~Pipeline() noexcept=default
TShaderProgram shader_program_type
Definition: rendering.hpp:453
TPipelineLayout pipeline_layout_type
Definition: rendering.hpp:454
Represents a the layout of a RenderPipeline or a ComputePipeline.
Definition: rendering.hpp:347
virtual const descriptor_set_layout_type & descriptorSet(const UInt32 &space) const =0
Returns the descriptor set layout for the descriptor set that is bound to the space provided by space...
virtual const push_constants_layout_type * pushConstants() const noexcept=0
Returns the push constants layout, or nullptr, if the pipeline does not use any push constants.
virtual ~PipelineLayout() noexcept=default
TPushConstantsLayout push_constants_layout_type
Definition: rendering.hpp:350
TDescriptorSetLayout descriptor_set_layout_type
Definition: rendering.hpp:349
virtual Array< const descriptor_set_layout_type * > descriptorSets() const noexcept=0
Describes the layout of the pipelines push constant ranges.
Definition: rendering.hpp:296
virtual ~PushConstantsLayout() noexcept=default
virtual Array< const push_constants_range_type * > ranges() const noexcept=0
TPushConstantsRange push_constants_range_type
Definition: rendering.hpp:298
Defines a back-end, that provides a device instance for a certain surface and graphics adapter.
Definition: rendering.hpp:1224
TGraphicsDevice device_type
Definition: rendering.hpp:1226
device_type::rasterizer_type rasterizer_type
Definition: rendering.hpp:1247
device_type::frame_buffer_type frame_buffer_type
Definition: rendering.hpp:1240
factory_type::vertex_buffer_type vertex_buffer_type
Definition: rendering.hpp:1235
virtual device_type * device(const String &name) noexcept=0
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
virtual const device_type * operator[](const String &name) const noexcept
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
Definition: rendering.hpp:1288
device_type::factory_type factory_type
Definition: rendering.hpp:1232
virtual void releaseDevice(const String &name)=0
Destroys and removes a device from the backend.
device_type::compute_pipeline_type compute_pipeline_type
Definition: rendering.hpp:1244
factory_type::descriptor_layout_type descriptor_layout_type
Definition: rendering.hpp:1234
device_type::swap_chain_type swap_chain_type
Definition: rendering.hpp:1229
virtual ~RenderBackend() noexcept=default
device_type::shader_program_type shader_program_type
Definition: rendering.hpp:1245
device_type::surface_type surface_type
Definition: rendering.hpp:1227
virtual const device_type * device(const String &name) const noexcept=0
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
factory_type::buffer_type buffer_type
Definition: rendering.hpp:1237
device_type::pipeline_layout_type pipeline_layout_type
Definition: rendering.hpp:1242
device_type::command_buffer_type command_buffer_type
Definition: rendering.hpp:1231
device_type::command_queue_type command_queue_type
Definition: rendering.hpp:1230
factory_type::sampler_type sampler_type
Definition: rendering.hpp:1239
device_type::render_pipeline_type render_pipeline_type
Definition: rendering.hpp:1243
virtual device_type * operator[](const String &name) noexcept
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
Definition: rendering.hpp:1293
device_type::adapter_type adapter_type
Definition: rendering.hpp:1228
device_type::barrier_type barrier_type
Definition: rendering.hpp:1233
device_type::input_assembler_type input_assembler_type
Definition: rendering.hpp:1246
device_type::render_pass_type render_pass_type
Definition: rendering.hpp:1241
factory_type::image_type image_type
Definition: rendering.hpp:1238
factory_type::index_buffer_type index_buffer_type
Definition: rendering.hpp:1236
Represents a render pass.
Definition: rendering.hpp:787
render_pipeline_type::pipeline_layout_type pipeline_layout_type
Definition: rendering.hpp:792
virtual ~RenderPass() noexcept=default
TRenderPipeline render_pipeline_type
Definition: rendering.hpp:790
pipeline_layout_type::descriptor_set_layout_type descriptor_set_layout_type
Definition: rendering.hpp:793
TInputAttachmentMapping input_attachment_mapping_type
Definition: rendering.hpp:791
descriptor_set_layout_type::descriptor_set_type descriptor_set_type
Definition: rendering.hpp:794
Represents a graphics Pipeline.
Definition: rendering.hpp:632
TInputAssembler input_assembler_type
Definition: rendering.hpp:634
TRasterizer rasterizer_type
Definition: rendering.hpp:635
virtual ~RenderPipeline() noexcept=default
Implements a render target.
Definition: rendering_api.hpp:1994
Represents a shader program, consisting of multiple IShaderModules.
Definition: rendering.hpp:321
virtual Array< const shader_module_type * > modules() const noexcept=0
TShaderModule shader_module_type
Definition: rendering.hpp:323
virtual ~ShaderProgram() noexcept=default
Base class for a resource that can be identified by a name string within a DeviceState.
Definition: rendering_api.hpp:1453
Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurfa...
Definition: rendering.hpp:838
virtual ~SwapChain() noexcept=default
TFrameBuffer frame_buffer_type
Definition: rendering.hpp:841
TImageInterface image_interface_type
Definition: rendering.hpp:840
Describes a vertex buffer.
Definition: rendering.hpp:378
virtual const vertex_buffer_layout_type & layout() const noexcept=0
Gets the layout of the vertex buffer.
virtual ~VertexBuffer() noexcept=default
TVertexBufferLayout vertex_buffer_layout_type
Definition: rendering.hpp:380
Definition: traits.hpp:95
uint32_t UInt32
Definition: math.hpp:37
float_t Float
Definition: math.hpp:40
uint64_t UInt64
Definition: math.hpp:39
int32_t Int32
Definition: math.hpp:36
std::string String
Definition: string.hpp:19
std::vector< T > Array
Represents a dynamic array.
Definition: containers.hpp:58
std::span< T > Span
Represents a view of an array.
Definition: containers.hpp:72
std::shared_ptr< T > SharedPtr
Represents a shared pointer, that expresses non-exclusive ownership.
Definition: containers.hpp:94
std::unique_ptr< T, TDeleter > UniquePtr
Represents a unique pointer, that expresses exclusive ownership.
Definition: containers.hpp:87
std::optional< T > Optional
Represents an optional value.
Definition: containers.hpp:79