3#include <litefx/rendering_api.hpp>
4#include <litefx/rendering_formatters.hpp>
14 template <
typename TBuffer,
typename TImage>
requires
15 std::derived_from<TBuffer, IBuffer> &&
16 std::derived_from<TImage, IImage>
32 constexpr ~
Barrier() noexcept override = default;
67 this->
transition(
dynamic_cast<const image_type&
>(image), accessBefore, accessAfter, fromLayout, toLayout);
71 this->
transition(
dynamic_cast<const image_type&
>(image), level, levels, layer, layers, plane, accessBefore, accessAfter, layout);
75 this->
transition(
dynamic_cast<const image_type&
>(image), level, levels, layer, layers, plane, accessBefore, accessAfter, fromLayout, toLayout);
145 template <
typename TBuffer,
typename TImage,
typename TSampler,
typename TAccelerationStructure>
requires
146 std::derived_from<TBuffer, IBuffer> &&
147 std::derived_from<TSampler, ISampler> &&
148 std::derived_from<TImage, IImage> &&
149 std::derived_from<TAccelerationStructure, IAccelerationStructure>
194 return this->
bindToHeap(bindingType, descriptor,
dynamic_cast<const buffer_type&
>(buffer), bufferElement, elements, texelFormat);
198 return this->
bindToHeap(bindingType, descriptor,
dynamic_cast<const image_type&
>(image), firstLevel, levels, firstLayer, layers);
206 this->
update(binding,
dynamic_cast<const buffer_type&
>(buffer), bufferElement, elements, firstDescriptor, texelFormat);
210 this->
update(binding,
dynamic_cast<const image_type&
>(texture), descriptor, firstLevel, levels, firstLayer, layers);
234 template <
typename TDescriptorLayout,
typename TDescriptorSet>
requires
235 meta::implements<TDescriptorLayout, IDescriptorLayout> &&
236 meta::implements<TDescriptorSet, DescriptorSet<typename TDescriptorSet::buffer_type, typename TDescriptorSet::image_type, typename TDescriptorSet::sampler_type, typename TDescriptorSet::acceleration_structure_type>>
273 return this->
allocate(0, std::move(bindings));
287 return this->
allocate(descriptorSets, 0, bindings);
290#ifdef __cpp_lib_mdspan
293 return this->
allocate(descriptorSets, 0, bindings);
299 return this->
allocate(descriptorSets, 0, std::move(bindings));
305#ifdef __cpp_lib_mdspan
322 return this->
allocate(descriptors, bindings);
326 return this->
allocate(descriptors, bindings);
330 return this->
allocate(descriptors, std::move(bindings));
337#ifdef __cpp_lib_mdspan
347 inline void releaseDescriptorSet(
const IDescriptorSet& descriptorSet)
const override {
375 template <
typename TPushConstantsRange>
requires
376 meta::implements<TPushConstantsRange, IPushConstantsRange>
406 template <
typename TShaderModule>
requires
428 return this->
modules() | std::views::transform([](
const auto& m) ->
const IShaderModule& {
return *m; });
437 template <
typename TDescriptorSetLayout,
typename TPushConstantsLayout>
requires
475 template <
typename TVertexBufferLayout>
requires
499 template <typename TIndexBufferLayout> requires
525 template <typename TVertexBufferLayout, typename TIndexBufferLayout> requires
555 return this->vertexBufferLayouts();
566 template <
typename TPipelineLayout,
typename TShaderProgram>
requires
593 return std::static_pointer_cast<const IShaderProgram>(this->program());
597 return std::static_pointer_cast<const IPipelineLayout>(this->layout());
613 template <
typename TCommandBuffer,
typename TBuffer,
typename TVertexBuffer,
typename TIndexBuffer,
typename TImage,
typename TBarrier,
typename TPipeline,
typename TBLAS,
typename TTLAS>
requires
614 meta::implements<TBarrier, Barrier<TBuffer, TImage>> &&
616 std::derived_from<TPipeline, Pipeline<typename TPipeline::pipeline_layout_type, typename TPipeline::shader_program_type>> &&
617 std::derived_from<TBLAS, IBottomLevelAccelerationStructure> &&
618 std::derived_from<TTLAS, ITopLevelAccelerationStructure>
677 virtual
void transfer(const
void* const data,
size_t size, const
buffer_type& target,
UInt32 targetElement = 0,
UInt32 elements = 1) const = 0;
680 virtual
void transfer(
Span<const
void* const> data,
size_t elementSize, const
buffer_type& target,
UInt32 firstElement = 0) const = 0;
686 virtual
void transfer(const
void* const data,
size_t size, const
image_type& target,
UInt32 subresource = 0) const = 0;
689 virtual
void transfer(
Span<const
void* const> data,
size_t elementSize, const
image_type& target,
UInt32 firstSubresource = 0,
UInt32 subresources = 1) const = 0;
756 this->bind(vertexBuffer);
757 this->draw(vertexBuffer.elements(), instances, firstVertex, firstInstance);
762 this->bind(indexBuffer);
763 this->drawIndexed(indexBuffer.elements(), instances, firstIndex, vertexOffset, firstInstance);
768 this->bind(vertexBuffer);
769 this->bind(indexBuffer);
770 this->drawIndexed(indexBuffer.elements(), instances, firstIndex, vertexOffset, firstInstance);
802 this->traceRays(dimensions.x(), dimensions.y(), dimensions.z(), offsets, rayGenerationShaderBindingTable, missShaderBindingTable, hitShaderBindingTable, callableShaderBindingTable);
807 return this->makeBarrier(syncBefore, syncAfter);
810 inline void cmdBarrier(
const IBarrier& barrier)
const noexcept override {
811 this->barrier(
dynamic_cast<const barrier_type&
>(barrier));
815 this->transfer(
dynamic_cast<const buffer_type&
>(source),
dynamic_cast<const buffer_type&
>(target), sourceElement, targetElement, elements);
819 this->transfer(
dynamic_cast<const buffer_type&
>(source),
dynamic_cast<const image_type&
>(target), sourceElement, firstSubresource, elements);
822 inline void cmdTransfer(
const IImage& source,
const IImage& target,
UInt32 sourceSubresource,
UInt32 targetSubresource,
UInt32 subresources)
const override {
823 this->transfer(
dynamic_cast<const image_type&
>(source),
dynamic_cast<const image_type&
>(target), sourceSubresource, targetSubresource, subresources);
826 inline void cmdTransfer(
const IImage& source,
const IBuffer& target,
UInt32 firstSubresource,
UInt32 targetElement,
UInt32 subresources)
const override {
827 this->transfer(
dynamic_cast<const image_type&
>(source),
dynamic_cast<const buffer_type&
>(target), firstSubresource, targetElement, subresources);
831 this->transfer(std::dynamic_pointer_cast<const buffer_type>(source),
dynamic_cast<const buffer_type&
>(target), sourceElement, targetElement, elements);
835 this->transfer(std::dynamic_pointer_cast<const buffer_type>(source),
dynamic_cast<const image_type&
>(target), sourceElement, firstSubresource, elements);
839 this->transfer(std::dynamic_pointer_cast<const image_type>(source),
dynamic_cast<const image_type&
>(target), sourceSubresource, targetSubresource, subresources);
843 this->transfer(std::dynamic_pointer_cast<const image_type>(source),
dynamic_cast<const buffer_type&
>(target), firstSubresource, targetElement, subresources);
846 inline void cmdTransfer(
const void*
const data,
size_t size,
const IBuffer& target,
UInt32 targetElement,
UInt32 elements)
const override {
847 this->transfer(data, size,
dynamic_cast<const buffer_type&
>(target), targetElement, elements);
851 this->transfer(data, elementSize,
dynamic_cast<const buffer_type&
>(target), targetElement);
854 inline void cmdTransfer(
const void*
const data,
size_t size,
const IImage& target,
UInt32 subresource)
const override {
855 this->transfer(data, size,
dynamic_cast<const image_type&
>(target), subresource);
859 this->transfer(data, elementSize,
dynamic_cast<const image_type&
>(target), firstSubresource, elements);
862 inline void cmdUse(
const IPipeline& pipeline)
const noexcept override {
863 this->use(
dynamic_cast<const pipeline_type&
>(pipeline));
866 inline void cmdBind(
const IDescriptorSet& descriptorSet)
const override {
867 this->bind(
dynamic_cast<const descriptor_set_type&
>(descriptorSet));
871 auto sets = descriptorSets | std::views::transform([](
auto set) {
return dynamic_cast<const descriptor_set_type*
>(set); }) | std::ranges::to<
Array<const descriptor_set_type*>>();
876 this->bind(
dynamic_cast<const descriptor_set_type&
>(descriptorSet),
dynamic_cast<const pipeline_type&
>(pipeline));
880 auto sets = descriptorSets | std::views::transform([](
auto set) {
return dynamic_cast<const descriptor_set_type*
>(set); }) | std::ranges::to<
Array<const descriptor_set_type*>>();
884 inline void cmdBind(
const IVertexBuffer& buffer)
const override {
885 this->bind(
dynamic_cast<const vertex_buffer_type&
>(buffer));
888 inline void cmdBind(
const IIndexBuffer& buffer)
const override {
889 this->bind(
dynamic_cast<const index_buffer_type&
>(buffer));
892 inline void cmdPushConstants(
const IPushConstantsLayout& layout,
const void*
const memory)
const override {
893 this->pushConstants(
dynamic_cast<const push_constants_layout_type&
>(layout), memory);
896 inline void cmdDispatchIndirect(
const IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset)
const noexcept override {
897 this->dispatchIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer), batchCount, offset);
900 inline void cmdDispatchMeshIndirect(
const IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset)
const noexcept override {
901 this->dispatchMeshIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer), batchCount, offset);
904 inline void cmdDispatchMeshIndirect(
const IBuffer& batchBuffer,
const IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches)
const noexcept override {
905 this->dispatchMeshIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer),
dynamic_cast<const buffer_type&
>(countBuffer), offset, countOffset, maxBatches);
909 this->draw(
dynamic_cast<const vertex_buffer_type&
>(vertexBuffer), instances, firstVertex, firstInstance);
912 inline void cmdDrawIndirect(
const IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset)
const noexcept override {
913 this->drawIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer), batchCount, offset);
916 inline void cmdDrawIndirect(
const IBuffer& batchBuffer,
const IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches)
const noexcept override {
917 this->drawIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer),
dynamic_cast<const buffer_type&
>(countBuffer), offset, countOffset, maxBatches);
921 this->drawIndexed(
dynamic_cast<const index_buffer_type&
>(indexBuffer), instances, firstIndex, vertexOffset, firstInstance);
925 this->drawIndexed(
dynamic_cast<const vertex_buffer_type&
>(vertexBuffer),
dynamic_cast<const index_buffer_type&
>(indexBuffer), instances, firstIndex, vertexOffset, firstInstance);
928 inline void cmdDrawIndexedIndirect(
const IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset)
const noexcept override {
929 this->drawIndexedIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer), batchCount, offset);
932 inline void cmdDrawIndexedIndirect(
const IBuffer& batchBuffer,
const IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches)
const noexcept override {
933 this->drawIndexedIndirect(
dynamic_cast<const buffer_type&
>(batchBuffer),
dynamic_cast<const buffer_type&
>(countBuffer), offset, countOffset, maxBatches);
937 this->execute(std::dynamic_pointer_cast<const command_buffer_type>(commandBuffer));
941 return this->execute(commandBuffers | std::views::transform([](
const SharedPtr<const ICommandBuffer>& buffer) {
return std::dynamic_pointer_cast<const command_buffer_type>(buffer); }));
945 this->buildAccelerationStructure(
dynamic_cast<bottom_level_acceleration_structure_type&
>(blas), std::dynamic_pointer_cast<const buffer_type>(scratchBuffer),
dynamic_cast<const buffer_type&
>(buffer), offset);
949 this->buildAccelerationStructure(
dynamic_cast<top_level_acceleration_structure_type&
>(tlas), std::dynamic_pointer_cast<const buffer_type>(scratchBuffer),
dynamic_cast<const buffer_type&
>(buffer), offset);
953 this->updateAccelerationStructure(
dynamic_cast<bottom_level_acceleration_structure_type&
>(blas), std::dynamic_pointer_cast<const buffer_type>(scratchBuffer),
dynamic_cast<const buffer_type&
>(buffer), offset);
957 this->updateAccelerationStructure(
dynamic_cast<top_level_acceleration_structure_type&
>(tlas), std::dynamic_pointer_cast<const buffer_type>(scratchBuffer),
dynamic_cast<const buffer_type&
>(buffer), offset);
961 this->copyAccelerationStructure(
dynamic_cast<const bottom_level_acceleration_structure_type&
>(from),
dynamic_cast<const bottom_level_acceleration_structure_type&
>(to), compress);
965 this->copyAccelerationStructure(
dynamic_cast<const top_level_acceleration_structure_type&
>(from),
dynamic_cast<const top_level_acceleration_structure_type&
>(to), compress);
969 this->traceRays(width, height, depth, offsets,
dynamic_cast<const buffer_type&
>(rayGenerationShaderBindingTable),
dynamic_cast<const buffer_type*
>(missShaderBindingTable),
dynamic_cast<const buffer_type*
>(hitShaderBindingTable),
dynamic_cast<const buffer_type*
>(callableShaderBindingTable));
981 template <
typename TPipelineLayout,
typename TShaderProgram,
typename TInputAssembler,
typename TRasterizer>
requires
982 meta::implements<TInputAssembler, InputAssembler<typename TInputAssembler::vertex_buffer_layout_type, typename TInputAssembler::index_buffer_layout_type>> &&
983 meta::implements<TRasterizer, Rasterizer>
1008 return this->inputAssembler();
1012 return this->rasterizer();
1022 template <
typename TPipelineLayout,
typename TShaderProgram>
1041 template <typename TPipelineLayout, typename TShaderProgram>
1068 return this->allocateShaderBindingTable(offsets, groups);
1077 template <
typename TImage>
requires
1078 std::derived_from<TImage, IImage>
1103 return this->images() | std::views::transform([](
auto& image) ->
const IImage& {
return *image; });
1111 template <
typename TCommandBuffer>
requires
1135 return this->submit(std::static_pointer_cast<const command_buffer_type>(commandBuffer));
1146 return this->createCommandBuffer(beginRecording, secondary);
1150 return this->submit(std::dynamic_pointer_cast<const command_buffer_type>(commandBuffer));
1155 commandBuffers | std::views::transform([](
const SharedPtr<const ICommandBuffer>& buffer) {
return std::dynamic_pointer_cast<const command_buffer_type>(buffer); })
1170 template <
typename TCommandQueue,
typename TFrameBuffer>
requires
1171 meta::implements<TCommandQueue, CommandQueue<typename TCommandQueue::command_buffer_type>> &&
1172 meta::implements<TFrameBuffer, FrameBuffer<typename TFrameBuffer::image_type>>
1207 return this->activeFrameBuffer();
1211 return this->commandBuffer(index);
1214 inline const ICommandQueue& getCommandQueue() const noexcept
override {
1215 return this->commandQueue();
1219 return this->commandBuffers();
1222 inline void beginRenderPass(
const IFrameBuffer& frameBuffer)
const override {
1223 this->begin(
dynamic_cast<const frame_buffer_type&
>(frameBuffer));
1231 template <
typename TImageInterface>
requires
1232 std::derived_from<TImageInterface, IImage>
1253 return this->images() | std::views::transform([](
auto& image) ->
IImage& {
return *image; });
1268 template <
typename TDescriptorLayout,
typename TBuffer,
typename TVertexBuffer,
typename TIndexBuffer,
typename TImage,
typename TSampler,
typename TBLAS,
typename TTLAS>
requires
1270 std::derived_from<TVertexBuffer, VertexBuffer<typename TVertexBuffer::vertex_buffer_layout_type>> &&
1271 std::derived_from<TIndexBuffer, IndexBuffer<typename TIndexBuffer::index_buffer_layout_type>> &&
1272 std::derived_from<TImage, IImage> &&
1273 std::derived_from<TBuffer, IBuffer> &&
1274 std::derived_from<TSampler, ISampler> &&
1275 std::derived_from<TBLAS, IBottomLevelAccelerationStructure> &&
1276 std::derived_from<TTLAS, ITopLevelAccelerationStructure>
1368 virtual
SharedPtr<TSampler> createSampler(const
String& name,
FilterMode magFilter =
FilterMode::
Nearest,
FilterMode minFilter =
FilterMode::
Nearest,
BorderMode borderU =
BorderMode::
Repeat,
BorderMode borderV =
BorderMode::
Repeat,
BorderMode borderW =
BorderMode::
Repeat,
MipMapMode mipMapMode =
MipMapMode::
Nearest,
Float mipMapBias = 0.f,
Float maxLod = std::numeric_limits<
Float>::max(),
Float minLod = 0.f,
Float anisotropy = 0.f) const = 0;
1375 return this->createBottomLevelAccelerationStructure(
"", flags);
1383 return this->createTopLevelAccelerationStructure(
"", flags);
1391 return this->createBuffer(type, heap, elementSize, elements, usage, allocationBehavior);
1395 return this->createBuffer(name, type, heap, elementSize, elements, usage, allocationBehavior);
1399 return this->createVertexBuffer(
dynamic_cast<const vertex_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1403 return this->createVertexBuffer(name,
dynamic_cast<const vertex_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1407 return this->createIndexBuffer(
dynamic_cast<const index_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1411 return this->createIndexBuffer(name,
dynamic_cast<const index_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1415 return this->createTexture(format, size, dimension, levels, layers, samples, usage, allocationBehavior);
1419 return this->createTexture(name, format, size, dimension, levels, layers, samples, usage, allocationBehavior);
1424 auto result = this->tryCreateBuffer(actualBuffer, type, heap, elementSize, elements, usage, allocationBehavior);
1425 buffer = actualBuffer;
1431 auto result = this->tryCreateBuffer(actualBuffer, name, type, heap, elementSize, elements, usage, allocationBehavior);
1432 buffer = actualBuffer;
1438 auto result = this->tryCreateVertexBuffer(actualBuffer,
dynamic_cast<const vertex_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1439 buffer = actualBuffer;
1445 auto result = this->tryCreateVertexBuffer(actualBuffer, name,
dynamic_cast<const vertex_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1446 buffer = actualBuffer;
1452 auto result = this->tryCreateIndexBuffer(actualBuffer,
dynamic_cast<const index_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1453 buffer = actualBuffer;
1459 auto result = this->tryCreateIndexBuffer(actualBuffer, name,
dynamic_cast<const index_buffer_layout_type&
>(layout), heap, elements, usage, allocationBehavior);
1460 buffer = actualBuffer;
1466 auto result = this->tryCreateTexture(actualImage, format, size, dimension, levels, layers, samples, usage, allocationBehavior);
1467 image = actualImage;
1473 auto result = this->tryCreateTexture(actualImage, name, format, size, dimension, levels, layers, samples, usage, allocationBehavior);
1474 image = actualImage;
1480 for (
auto texture : gen)
1481 co_yield std::move(texture);
1482 }(this->createTextures(format, size, dimension, layers, levels, samples, usage, allocationBehavior));
1486 return this->createSampler(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
1489 inline SharedPtr<ISampler> getSampler(
const String& name,
FilterMode magFilter,
FilterMode minFilter,
BorderMode borderU,
BorderMode borderV,
BorderMode borderW,
MipMapMode mipMapMode,
Float mipMapBias,
Float maxLod,
Float minLod,
Float anisotropy)
const override {
1490 return this->createSampler(name, magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
1495 for (
auto sampler : gen)
1496 co_yield std::move(sampler);
1497 }(this->createSamplers(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy));
1501 return this->createBottomLevelAccelerationStructure(name, flags);
1505 return this->createTopLevelAccelerationStructure(name, flags);
1527 template <
typename TFactory,
typename TSurface,
typename TGraphicsAdapter,
typename TSwapChain,
typename TCommandQueue,
typename TRenderPass,
typename TRenderPipeline,
typename TComputePipeline,
typename TRayTracingPipeline,
typename TBarrier>
requires
1528 meta::implements<TSurface, ISurface> &&
1529 meta::implements<TGraphicsAdapter, IGraphicsAdapter> &&
1530 meta::implements<TSwapChain, SwapChain<typename TFactory::image_type>> &&
1531 meta::implements<TCommandQueue, CommandQueue<typename TCommandQueue::command_buffer_type>> &&
1532 meta::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, typename TFactory::bottom_level_acceleration_structure_type, typename TFactory::top_level_acceleration_structure_type>> &&
1533 meta::implements<TRenderPass, RenderPass<TCommandQueue, typename TRenderPass::frame_buffer_type>> &&
1534 meta::implements<TRenderPipeline, RenderPipeline<typename TRenderPipeline::pipeline_layout_type, typename TRenderPipeline::shader_program_type, typename TRenderPipeline::input_assembler_type, typename TRenderPipeline::rasterizer_type>> &&
1535 meta::implements<TComputePipeline, ComputePipeline<typename TComputePipeline::pipeline_layout_type, typename TComputePipeline::shader_program_type>> &&
1536 meta::implements<TRayTracingPipeline, RayTracingPipeline<typename TRayTracingPipeline::pipeline_layout_type, typename TRayTracingPipeline::shader_program_type>> &&
1537 meta::implements<TBarrier, Barrier<typename TFactory::buffer_type, typename TFactory::image_type>>
1604 return this->makeFrameBuffer(
"", renderArea);
1610 return this->makeFrameBuffer(
"", renderArea, std::move(allocationCallback));
1622 return this->makeBarrier(syncBefore, syncAfter);
1626 return this->makeFrameBuffer(name, renderArea);
1630 return this->defaultQueue(type);
1634 return std::static_pointer_cast<const ICommandQueue>(this->createQueue(type, priority));
1665 this->computeAccelerationStructureSizes(
dynamic_cast<const top_level_acceleration_structure_type&
>(tlas), bufferSize, scratchSize, forUpdate);
1669 return this->allocateGlobalDescriptors(
dynamic_cast<const descriptor_set_type&
>(descriptorSet), heapType);
1672 inline void doReleaseGlobalDescriptors(
const IDescriptorSet& descriptorSet)
const override {
1673 this->releaseGlobalDescriptors(
dynamic_cast<const descriptor_set_type&
>(descriptorSet));
1677 this->updateGlobalDescriptors(
dynamic_cast<const descriptor_set_type&
>(descriptorSet), binding, offset, descriptors);
1681 this->bindDescriptorSet(
dynamic_cast<const command_buffer_type&
>(commandBuffer),
dynamic_cast<const descriptor_set_type&
>(descriptorSet),
dynamic_cast<const pipeline_type&
>(pipeline));
1684 inline void doBindGlobalDescriptorHeaps(
const ICommandBuffer& commandBuffer)
const noexcept override {
1685 this->bindGlobalDescriptorHeaps(
dynamic_cast<const command_buffer_type&
>(commandBuffer));
1688#if defined(LITEFX_BUILD_DEFINE_BUILDERS)
1690 using render_pass_builder_type = render_pass_type::builder_type;
1691 using render_pipeline_builder_type = render_pipeline_type::builder_type;
1692 using compute_pipeline_builder_type = compute_pipeline_type::builder_type;
1693 using ray_tracing_pipeline_builder_type = ray_tracing_pipeline_type::builder_type;
1694 using pipeline_layout_builder_type = pipeline_layout_type::builder_type;
1695 using input_assembler_builder_type = input_assembler_type::builder_type;
1696 using rasterizer_builder_type = rasterizer_type::builder_type;
1697 using shader_program_builder_type = shader_program_type::builder_type;
1698 using barrier_builder_Type = barrier_type::builder_type;
1705 [[nodiscard]]
virtual render_pass_builder_type buildRenderPass(
UInt32 commandBuffers = 1)
const = 0;
1713 [[nodiscard]]
virtual render_pass_builder_type buildRenderPass(
const String& name,
UInt32 commandBuffers = 1)
const = 0;
1720 [[nodiscard]]
virtual compute_pipeline_builder_type buildComputePipeline(
const String& name)
const = 0;
1735 [[nodiscard]]
virtual render_pipeline_builder_type buildRenderPipeline(
const render_pass_type& renderPass,
const String& name)
const = 0;
1745 [[nodiscard]]
virtual ray_tracing_pipeline_builder_type buildRayTracingPipeline(
ShaderRecordCollection&& shaderRecords)
const = 0;
1756 [[nodiscard]]
virtual ray_tracing_pipeline_builder_type buildRayTracingPipeline(
const String& name,
ShaderRecordCollection&& shaderRecords)
const = 0;
1762 [[nodiscard]]
virtual pipeline_layout_builder_type buildPipelineLayout()
const = 0;
1768 [[nodiscard]]
virtual input_assembler_builder_type buildInputAssembler()
const = 0;
1774 [[nodiscard]]
virtual rasterizer_builder_type buildRasterizer()
const = 0;
1780 [[nodiscard]]
virtual shader_program_builder_type buildShaderProgram()
const = 0;
1786 [[nodiscard]]
virtual barrier_builder_Type buildBarrier()
const = 0;
1794 template <
typename TGraphicsDevice>
requires
1795 meta::implements<TGraphicsDevice, GraphicsDevice<typename TGraphicsDevice::factory_type, typename TGraphicsDevice::surface_type, typename TGraphicsDevice::adapter_type, typename TGraphicsDevice::swap_chain_type, typename TGraphicsDevice::command_queue_type, typename TGraphicsDevice::render_pass_type, typename TGraphicsDevice::render_pipeline_type, typename TGraphicsDevice::compute_pipeline_type, typename TGraphicsDevice::ray_tracing_pipeline_type, typename TGraphicsDevice::barrier_type>>
1847 template <typename TSelf, typename ...TArgs>
1849 auto devicePtr = device_type::create(self, adapter, std::move(surface), std::forward<TArgs>(_args)...);
1850 auto& device = *devicePtr;
1851 self.registerDevice(name, std::move(devicePtr));
1869 return this->device(name);
1874 return this->device(name);
1880 return this->adapters();
A barrier used for GPU resource synchronization.
Definition rendering.hpp:17
TImage image_type
Definition rendering.hpp:22
virtual constexpr void transition(const buffer_type &buffer, ResourceAccess accessBefore, ResourceAccess accessAfter)=0
TBuffer buffer_type
Definition rendering.hpp:21
Barrier() noexcept=default
Represents a command buffer, that buffers commands that should be submitted to a CommandQueue.
Definition rendering.hpp:619
virtual void execute(const SharedPtr< const command_buffer_type > &commandBuffer) const =0
pipeline_type::pipeline_layout_type pipeline_layout_type
Definition rendering.hpp:649
virtual void buildAccelerationStructure(bottom_level_acceleration_structure_type &blas, const SharedPtr< const buffer_type > &scratchBuffer, const buffer_type &buffer, UInt64 offset=0) const =0
TBuffer buffer_type
Definition rendering.hpp:643
virtual void updateAccelerationStructure(bottom_level_acceleration_structure_type &blas, const SharedPtr< const buffer_type > &scratchBuffer, const buffer_type &buffer, UInt64 offset=0) const =0
TBLAS bottom_level_acceleration_structure_type
Definition rendering.hpp:653
pipeline_layout_type::push_constants_layout_type push_constants_layout_type
Definition rendering.hpp:651
TBarrier barrier_type
Definition rendering.hpp:647
virtual void drawIndexed(const vertex_buffer_type &vertexBuffer, const index_buffer_type &indexBuffer, UInt32 instances=1, UInt32 firstIndex=0, Int32 vertexOffset=0, UInt32 firstInstance=0) const
Definition rendering.hpp:767
virtual void execute(Enumerable< SharedPtr< const command_buffer_type > > commandBuffers) const =0
TVertexBuffer vertex_buffer_type
Definition rendering.hpp:644
TIndexBuffer index_buffer_type
Definition rendering.hpp:645
descriptor_set_layout_type::descriptor_set_type descriptor_set_type
Definition rendering.hpp:652
pipeline_layout_type::descriptor_set_layout_type descriptor_set_layout_type
Definition rendering.hpp:650
virtual void copyAccelerationStructure(const bottom_level_acceleration_structure_type &from, const bottom_level_acceleration_structure_type &to, bool compress=false) const noexcept=0
virtual void buildAccelerationStructure(top_level_acceleration_structure_type &tlas, const SharedPtr< const buffer_type > &scratchBuffer, const buffer_type &buffer, UInt64 offset=0) const =0
TCommandBuffer command_buffer_type
Definition rendering.hpp:642
TImage image_type
Definition rendering.hpp:646
TPipeline pipeline_type
Definition rendering.hpp:648
virtual void updateAccelerationStructure(top_level_acceleration_structure_type &tlas, const SharedPtr< const buffer_type > &scratchBuffer, const buffer_type &buffer, UInt64 offset=0) const =0
virtual void drawIndexed(const index_buffer_type &indexBuffer, UInt32 instances=1, UInt32 firstIndex=0, Int32 vertexOffset=0, UInt32 firstInstance=0) const
Definition rendering.hpp:761
TTLAS top_level_acceleration_structure_type
Definition rendering.hpp:654
friend TCommandBuffer
Definition rendering.hpp:639
Represents a command queue.
Definition rendering.hpp:1113
TCommandBuffer command_buffer_type
Definition rendering.hpp:1117
virtual UInt64 submit(const SharedPtr< const command_buffer_type > &commandBuffer) const =0
virtual UInt64 submit(Enumerable< SharedPtr< const command_buffer_type > > commandBuffers) const =0
CommandQueue() noexcept=default
Represents a compute Pipeline.
Definition rendering.hpp:1023
ComputePipeline() noexcept=default
Defines a set of descriptors.
Definition rendering.hpp:150
virtual void update(UInt32 binding, const buffer_type &buffer, UInt32 bufferElement=0, UInt32 elements=0, UInt32 firstDescriptor=0, Format texelFormat=Format::None) const =0
TSampler sampler_type
Definition rendering.hpp:156
virtual UInt32 bindToHeap(DescriptorType bindingType, UInt32 descriptor, const buffer_type &buffer, UInt32 bufferElement=0, UInt32 elements=0, Format texelFormat=Format::None) const =0
TAccelerationStructure acceleration_structure_type
Definition rendering.hpp:158
TImage image_type
Definition rendering.hpp:157
DescriptorSet() noexcept=default
TBuffer buffer_type
Definition rendering.hpp:155
Describes the layout of a descriptor set.
Definition rendering.hpp:237
virtual const Array< descriptor_layout_type > & descriptors() const noexcept=0
virtual UniquePtr< descriptor_set_type > allocate(UInt32 descriptors, Generator< DescriptorBinding > bindings) const =0
virtual UniquePtr< descriptor_set_type > allocate(Generator< DescriptorBinding > bindings) const
Definition rendering.hpp:272
virtual UniquePtr< descriptor_set_type > allocate(UInt32 descriptors, Span< DescriptorBinding > bindings) const =0
virtual Generator< UniquePtr< descriptor_set_type > > allocate(UInt32 descriptorSets, UInt32 descriptors, std::function< Generator< DescriptorBinding >(UInt32)> bindingFactory) const =0
virtual Generator< UniquePtr< descriptor_set_type > > allocate(UInt32 descriptorSets, std::function< Generator< DescriptorBinding >(UInt32)> bindings) const
Definition rendering.hpp:298
virtual Generator< UniquePtr< descriptor_set_type > > allocate(UInt32 descriptorSets, UInt32 descriptors, std::initializer_list< std::initializer_list< DescriptorBinding > > bindings={ }) const =0
virtual UniquePtr< descriptor_set_type > allocate(UInt32 descriptors, std::initializer_list< DescriptorBinding > bindings) const =0
const descriptor_layout_type & descriptor(UInt32 binding) const override=0
Returns the descriptor layout for the descriptor bound to the binding point provided with binding ....
virtual Generator< UniquePtr< descriptor_set_type > > allocate(UInt32 descriptorSets, std::initializer_list< std::initializer_list< DescriptorBinding > > bindings={ }) const
Definition rendering.hpp:286
DescriptorSetLayout() noexcept=default
TDescriptorSet descriptor_set_type
Definition rendering.hpp:242
virtual void free(const descriptor_set_type &descriptorSet) const =0
virtual UniquePtr< descriptor_set_type > allocate(Span< DescriptorBinding > bindings) const
Definition rendering.hpp:267
TDescriptorLayout descriptor_layout_type
Definition rendering.hpp:241
virtual UniquePtr< descriptor_set_type > allocate(std::initializer_list< DescriptorBinding > bindings={ }) const
Definition rendering.hpp:262
Stores the images used by a RenderPass to either read from using input attachments or write to using ...
Definition rendering.hpp:1079
TImage image_type
Definition rendering.hpp:1081
IFrameBuffer::allocation_callback_type< image_type > allocation_callback_type
Definition rendering.hpp:1082
FrameBuffer() noexcept=default
Represents the graphics device that a rendering back-end is doing work on.
Definition rendering.hpp:1538
command_buffer_type::pipeline_type pipeline_type
Definition rendering.hpp:1546
TFactory factory_type
Definition rendering.hpp:1547
factory_type::top_level_acceleration_structure_type top_level_acceleration_structure_type
Definition rendering.hpp:1556
TRayTracingPipeline ray_tracing_pipeline_type
Definition rendering.hpp:1561
factory_type::vertex_buffer_type vertex_buffer_type
Definition rendering.hpp:1550
virtual void computeAccelerationStructureSizes(const bottom_level_acceleration_structure_type &blas, UInt64 &bufferSize, UInt64 &scratchSize, bool forUpdate=false) const =0
render_pipeline_type::pipeline_layout_type pipeline_layout_type
Definition rendering.hpp:1562
TGraphicsAdapter adapter_type
Definition rendering.hpp:1541
SharedPtr< frame_buffer_type > makeFrameBuffer(const Size2d &renderArea, frame_buffer_type::allocation_callback_type allocationCallback) const
Definition rendering.hpp:1609
render_pipeline_type::shader_program_type shader_program_type
Definition rendering.hpp:1563
TComputePipeline compute_pipeline_type
Definition rendering.hpp:1560
virtual void updateGlobalDescriptors(const descriptor_set_type &descriptorSet, UInt32 binding, UInt32 offset, UInt32 descriptors) const =0
render_pipeline_type::input_assembler_type input_assembler_type
Definition rendering.hpp:1564
factory_type::bottom_level_acceleration_structure_type bottom_level_acceleration_structure_type
Definition rendering.hpp:1555
TBarrier barrier_type
Definition rendering.hpp:1548
TSwapChain swap_chain_type
Definition rendering.hpp:1542
virtual void releaseGlobalDescriptors(const descriptor_set_type &descriptorSet) const =0
virtual SharedPtr< frame_buffer_type > makeFrameBuffer(StringView name, const Size2d &renderArea) const =0
factory_type::buffer_type buffer_type
Definition rendering.hpp:1552
command_queue_type::command_buffer_type command_buffer_type
Definition rendering.hpp:1544
TRenderPass render_pass_type
Definition rendering.hpp:1557
TRenderPipeline render_pipeline_type
Definition rendering.hpp:1559
virtual void computeAccelerationStructureSizes(const top_level_acceleration_structure_type &tlas, UInt64 &bufferSize, UInt64 &scratchSize, bool forUpdate=false) const =0
factory_type::descriptor_layout_type descriptor_layout_type
Definition rendering.hpp:1549
render_pass_type::frame_buffer_type frame_buffer_type
Definition rendering.hpp:1558
GraphicsDevice() noexcept=default
factory_type::image_type image_type
Definition rendering.hpp:1553
TSurface surface_type
Definition rendering.hpp:1540
render_pipeline_type::rasterizer_type rasterizer_type
Definition rendering.hpp:1565
virtual void bindGlobalDescriptorHeaps(const command_buffer_type &commandBuffer) const noexcept=0
factory_type::sampler_type sampler_type
Definition rendering.hpp:1554
virtual VirtualAllocator::Allocation allocateGlobalDescriptors(const descriptor_set_type &descriptorSet, DescriptorHeapType heapType) const =0
virtual SharedPtr< frame_buffer_type > makeFrameBuffer(StringView name, const Size2d &renderArea, frame_buffer_type::allocation_callback_type allocationCallback) const =0
virtual void bindDescriptorSet(const command_buffer_type &commandBuffer, const descriptor_set_type &descriptorSet, const pipeline_type &pipeline) const noexcept=0
command_buffer_type::descriptor_set_type descriptor_set_type
Definition rendering.hpp:1545
TCommandQueue command_queue_type
Definition rendering.hpp:1543
factory_type::index_buffer_type index_buffer_type
Definition rendering.hpp:1551
Describes a factory that creates objects for a GraphicsDevice.
Definition rendering.hpp:1277
TVertexBuffer vertex_buffer_type
Definition rendering.hpp:1292
vertex_buffer_type::vertex_buffer_layout_type vertex_buffer_layout_type
Definition rendering.hpp:1293
virtual UniquePtr< TBLAS > createBottomLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags) const =0
TTLAS top_level_acceleration_structure_type
Definition rendering.hpp:1300
GraphicsFactory() noexcept=default
virtual UniquePtr< TTLAS > createTopLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags) const =0
TIndexBuffer index_buffer_type
Definition rendering.hpp:1294
TImage image_type
Definition rendering.hpp:1297
TSampler sampler_type
Definition rendering.hpp:1298
index_buffer_type::index_buffer_layout_type index_buffer_layout_type
Definition rendering.hpp:1295
TDescriptorLayout descriptor_layout_type
Definition rendering.hpp:1291
TBLAS bottom_level_acceleration_structure_type
Definition rendering.hpp:1299
TBuffer buffer_type
Definition rendering.hpp:1296
UniquePtr< TTLAS > createTopLevelAccelerationStructure(AccelerationStructureFlags flags) const
Definition rendering.hpp:1382
Base interface for a ray tracing acceleration structure.
Definition rendering_api.hpp:5260
The interface for a barrier.
Definition rendering_api.hpp:5921
constexpr void transition(const IBuffer &buffer, ResourceAccess accessBefore, ResourceAccess accessAfter)
Inserts a buffer barrier that blocks access to buffer of types contained in accessAfter for subsequ...
Definition rendering_api.hpp:5960
A structure that holds a singular entity of geometry for hardware ray-tracing.
Definition rendering_api.hpp:5399
Base interface for buffer objects.
Definition rendering_api.hpp:4997
The interface for a command buffer.
Definition rendering_api.hpp:7682
void barrier(const IBarrier &barrier) const noexcept
Executes the transitions that have been added to barrier .
Definition rendering_api.hpp:7791
void bind(const IDescriptorSet &descriptorSet) const
Binds the provided descriptor to the last pipeline that was used by the command buffer.
Definition rendering_api.hpp:8128
void pushConstants(const IPushConstantsLayout &layout, const void *const memory) const
Pushes a block of memory into the push constants backing memory.
Definition rendering_api.hpp:8488
void transfer(const IBuffer &source, const IBuffer &target, UInt32 sourceElement=0, UInt32 targetElement=0, UInt32 elements=1) const
Performs a buffer-to-buffer transfer from source to target .
Definition rendering_api.hpp:7809
virtual void drawIndexed(UInt32 indices, UInt32 instances=1, UInt32 firstIndex=0, Int32 vertexOffset=0, 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 dispatchMesh(const Vector3u &threadGroupCount) const noexcept=0
Executes a mesh shader pipeline.
void updateAccelerationStructure(IBottomLevelAccelerationStructure &blas, const SharedPtr< const IBuffer > &scratchBuffer, const IBuffer &buffer, UInt64 offset=0) const
Updates a bottom-level acceleration structure.
Definition rendering_api.hpp:8617
void use(const IPipeline &pipeline) const noexcept
Sets the active pipeline state.
Definition rendering_api.hpp:8118
SharedPtr< const ICommandQueue > queue() const noexcept
Gets a pointer to the command queue that this command buffer was allocated from or nullptr,...
Definition rendering_api.hpp:7768
void copyAccelerationStructure(const IBottomLevelAccelerationStructure &from, const IBottomLevelAccelerationStructure &to, bool compress=false) const noexcept
Copies the acceleration structure from into the acceleration structure to .
Definition rendering_api.hpp:8650
virtual void dispatch(const Vector3u &threadGroupCount) const noexcept=0
Executes a compute shader.
void drawIndexedIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect indexed draw calls.
Definition rendering_api.hpp:8466
void dispatchIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect dispatches.
Definition rendering_api.hpp:8285
void drawIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect non-indexed draw calls.
Definition rendering_api.hpp:8400
void buildAccelerationStructure(IBottomLevelAccelerationStructure &blas, const SharedPtr< const IBuffer > &scratchBuffer, const IBuffer &buffer, UInt64 offset=0) const
Builds a bottom-level acceleration structure.
Definition rendering_api.hpp:8585
virtual void draw(UInt32 vertices, UInt32 instances=1, UInt32 firstVertex=0, UInt32 firstInstance=0) const noexcept=0
Draws a number of vertices from the currently bound vertex buffer.
The interface for a command queue.
Definition rendering_api.hpp:9742
UInt64 submit(const SharedPtr< const ICommandBuffer > &commandBuffer) const
Submits a single command buffer with shared ownership and inserts a fence to wait for it.
Definition rendering_api.hpp:9896
The interface for a compute pipeline.
Definition rendering_api.hpp:8795
The interface for a descriptor set.
Definition rendering_api.hpp:6064
UInt32 bindToHeap(DescriptorType bindingType, UInt32 descriptor, const IBuffer &buffer, UInt32 bufferElement=0, UInt32 elements=0, Format texelFormat=Format::None) const
Binds a resource directly to a descriptor heap and returns the index that can be used to access it.
Definition rendering_api.hpp:6101
void update(UInt32 binding, const IBuffer &buffer, UInt32 bufferElement=0, UInt32 elements=0, UInt32 firstDescriptor=0, Format texelFormat=Format::None) const
Updates one or more buffer descriptors within the current descriptor set.
Definition rendering_api.hpp:6154
The interface for a descriptor set layout.
Definition rendering_api.hpp:6290
void free(const IDescriptorSet &descriptorSet) const
Marks a descriptor set as unused, so that it can be handed out again instead of allocating a new one.
Definition rendering_api.hpp:6541
The interface for a frame buffer.
Definition rendering_api.hpp:8903
std::function< SharedPtr< const TImage >(Optional< UInt64 >, Size2d, ResourceUsage, Format, MultiSamplingLevel, const String &)> allocation_callback_type
A function that gets invoked as a callback, if the frame buffer needs to allocate an image.
Definition rendering_api.hpp:8925
auto addImage(this TSelf &&self, Format format, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage) -> TSelf &&
Adds an image to the frame buffer.
Definition rendering_api.hpp:9180
The interface for a graphics device that.
Definition rendering_api.hpp:11050
The interface for a graphics factory.
Definition rendering_api.hpp:10120
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer of type type .
Definition rendering_api.hpp:10289
SharedPtr< IIndexBuffer > createIndexBuffer(const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates an index buffer, based on the layout .
Definition rendering_api.hpp:10664
SharedPtr< IVertexBuffer > createVertexBuffer(const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a vertex buffer, based on the layout .
Definition rendering_api.hpp:10598
SharedPtr< IBuffer > createBuffer(BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer of type type .
Definition rendering_api.hpp:10274
bool tryCreateTexture(SharedPtr< IImage > &image, Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a texture.
Definition rendering_api.hpp:10750
SharedPtr< IImage > createTexture(Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a texture.
Definition rendering_api.hpp:10733
Generator< SharedPtr< ISampler > > createSamplers(FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
Creates a series of texture samplers.
Definition rendering_api.hpp:10864
SharedPtr< ISampler > createSampler(FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
Creates a texture sampler.
Definition rendering_api.hpp:10825
bool tryCreateVertexBuffer(SharedPtr< IVertexBuffer > &buffer, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a vertex buffer, based on the layout .
Definition rendering_api.hpp:10612
Generator< SharedPtr< IImage > > createTextures(Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 layers=1, UInt32 levels=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a series of textures.
Definition rendering_api.hpp:10806
bool tryCreateIndexBuffer(SharedPtr< IIndexBuffer > &buffer, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create an index buffer, based on the layout .
Definition rendering_api.hpp:10678
Describes a generic image.
Definition rendering_api.hpp:5019
The interface for an index buffer.
Definition rendering_api.hpp:5236
Describes a index buffer layout.
Definition rendering_api.hpp:4603
The interface for a pipeline.
Definition rendering_api.hpp:7646
The interface for a pipeline layout.
Definition rendering_api.hpp:7538
The interface for a push constants layout.
Definition rendering_api.hpp:6609
Describes a range within a IPushConstantsLayout.
Definition rendering_api.hpp:6561
The interface for a ray tracing pipeline.
Definition rendering_api.hpp:8810
The interface to access a render backend.
Definition rendering_api.hpp:11305
The interface for a render pass.
Definition rendering_api.hpp:9292
The interface for a render pipeline.
Definition rendering_api.hpp:8725
Describes a texture sampler.
Definition rendering_api.hpp:5135
Represents a single shader module, i.e. a part of a IShaderProgram.
Definition rendering_api.hpp:3363
The interface for a shader program.
Definition rendering_api.hpp:7437
Interface for a swap chain.
Definition rendering_api.hpp:9484
A structure that stores the instance data for a IBottomLevelAccelerationStructure.
Definition rendering_api.hpp:5681
The interface for a vertex buffer.
Definition rendering_api.hpp:5214
Describes a vertex buffer layout.
Definition rendering_api.hpp:4574
Describes an index buffer.
Definition rendering.hpp:501
IndexBuffer() noexcept=default
TIndexBufferLayout index_buffer_layout_type
Definition rendering.hpp:503
Represents a pipeline state.
Definition rendering.hpp:569
Pipeline() noexcept=default
TShaderProgram shader_program_type
Definition rendering.hpp:571
TPipelineLayout pipeline_layout_type
Definition rendering.hpp:572
Represents a the layout of a RenderPipeline, ComputePipeline or RayTracingPipeline.
Definition rendering.hpp:440
PipelineLayout() noexcept=default
TPushConstantsLayout push_constants_layout_type
Definition rendering.hpp:443
const push_constants_layout_type * pushConstants() const noexcept override=0
Returns the push constants layout, or nullptr, if the pipeline does not use any push constants....
virtual const Array< SharedPtr< const descriptor_set_layout_type > > & descriptorSets() const =0
const descriptor_set_layout_type & descriptorSet(UInt32 space) const override=0
Returns the descriptor set layout for the descriptor set that is bound to the space provided by space...
TDescriptorSetLayout descriptor_set_layout_type
Definition rendering.hpp:442
Describes the layout of the pipelines push constant ranges.
Definition rendering.hpp:377
virtual const Array< UniquePtr< push_constants_range_type > > & ranges() const =0
TPushConstantsRange push_constants_range_type
Definition rendering.hpp:379
PushConstantsLayout() noexcept=default
Represents a ray-tracing Pipeline.
Definition rendering.hpp:1042
descriptor_set_layout_type::descriptor_layout_type descriptor_layout_type
Definition rendering.hpp:1047
RayTracingPipeline() noexcept=default
base_type::pipeline_layout_type::descriptor_set_layout_type descriptor_set_layout_type
Definition rendering.hpp:1045
descriptor_set_type::image_type image_type
Definition rendering.hpp:1049
descriptor_set_type::sampler_type sampler_type
Definition rendering.hpp:1050
descriptor_set_layout_type::descriptor_set_type descriptor_set_type
Definition rendering.hpp:1046
descriptor_set_type::buffer_type buffer_type
Definition rendering.hpp:1048
Defines a back-end, that provides a device instance for a certain surface and graphics adapter.
Definition rendering.hpp:1796
device_type::render_pipeline_type render_pipeline_type
Definition rendering.hpp:1815
factory_type::sampler_type sampler_type
Definition rendering.hpp:1811
const device_type * operator[](const String &name) const noexcept override
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
Definition rendering.hpp:1868
device_type::surface_type surface_type
Definition rendering.hpp:1799
factory_type::index_buffer_type index_buffer_type
Definition rendering.hpp:1808
device_type::barrier_type barrier_type
Definition rendering.hpp:1805
const device_type * device(const String &name) const noexcept override=0
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
TGraphicsDevice device_type
Definition rendering.hpp:1798
device_type::input_assembler_type input_assembler_type
Definition rendering.hpp:1819
device_type::command_queue_type command_queue_type
Definition rendering.hpp:1802
device_type::factory_type factory_type
Definition rendering.hpp:1804
device_type * device(const String &name) noexcept override=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:1809
device_type::compute_pipeline_type compute_pipeline_type
Definition rendering.hpp:1816
device_type::frame_buffer_type frame_buffer_type
Definition rendering.hpp:1812
virtual void releaseDevice(const String &name)=0
Destroys and removes a device from the backend.
factory_type::image_type image_type
Definition rendering.hpp:1810
device_type * operator[](const String &name) noexcept override
Looks up a device and returns a pointer to it, or nullptr, if no device with the provided name could...
Definition rendering.hpp:1873
device_type::render_pass_type render_pass_type
Definition rendering.hpp:1813
device_type::pipeline_layout_type pipeline_layout_type
Definition rendering.hpp:1814
device_type::swap_chain_type swap_chain_type
Definition rendering.hpp:1801
device_type::rasterizer_type rasterizer_type
Definition rendering.hpp:1820
RenderBackend() noexcept=default
device_type::shader_program_type shader_program_type
Definition rendering.hpp:1818
device_type::adapter_type adapter_type
Definition rendering.hpp:1800
factory_type::vertex_buffer_type vertex_buffer_type
Definition rendering.hpp:1807
factory_type::descriptor_layout_type descriptor_layout_type
Definition rendering.hpp:1806
device_type::command_buffer_type command_buffer_type
Definition rendering.hpp:1803
device_type::ray_tracing_pipeline_type ray_tracing_pipeline_type
Definition rendering.hpp:1817
Represents a render pass.
Definition rendering.hpp:1173
TCommandQueue command_queue_type
Definition rendering.hpp:1175
TCommandQueue::command_buffer_type command_buffer_type
Definition rendering.hpp:1176
RenderPass() noexcept=default
TFrameBuffer frame_buffer_type
Definition rendering.hpp:1177
Represents a graphics Pipeline.
Definition rendering.hpp:984
TInputAssembler input_assembler_type
Definition rendering.hpp:986
RenderPipeline() noexcept=default
TRasterizer rasterizer_type
Definition rendering.hpp:987
Represents a shader program, consisting of multiple IShaderModules.
Definition rendering.hpp:408
ShaderProgram() noexcept=default
TShaderModule shader_module_type
Definition rendering.hpp:410
virtual const Array< UniquePtr< const shader_module_type > > & modules() const noexcept=0
Stores a set of IShaderRecords in that later form a shader binding table used for ray-tracing.
Definition rendering_api.hpp:6923
Base class for a resource that can be identified by a name string within a DeviceState.
Definition rendering_api.hpp:2650
Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurfa...
Definition rendering.hpp:1233
SwapChain() noexcept=default
TImageInterface image_interface_type
Definition rendering.hpp:1235
Describes a vertex buffer.
Definition rendering.hpp:477
const vertex_buffer_layout_type & layout() const noexcept override=0
Gets the layout of the vertex buffer.The layout of the vertex buffer.
VertexBuffer() noexcept=default
TVertexBufferLayout vertex_buffer_layout_type
Definition rendering.hpp:479
uint64_t UInt64
A type for an unsigned 64 bit integer.
Definition math.hpp:71
float_t Float
A type for a floating point value with single precision.
Definition math.hpp:76
uint32_t UInt32
A type for an unsigned 32 bit integer.
Definition math.hpp:61
int32_t Int32
A type for a signed 32 bit integer.
Definition math.hpp:56
BorderMode
Describes how to treat texture coordinates that are outside the domain [0..1].
Definition rendering_api.hpp:1356
@ Repeat
Repeat the texture.
DescriptorHeapType
The target heap type for a descriptor.
Definition rendering_api.hpp:580
ImageLayout
Specifies the layout of an IImage resource.
Definition rendering_api.hpp:1858
MipMapMode
Describes the filter operation between two mip-map levels.
Definition rendering_api.hpp:1341
ShaderBindingGroup
Describes a group or combination of groups of a shader binding table.
Definition rendering_api.hpp:1111
@ All
Refers to a combination of all possible groups that can be stored in a shader binding table.
BufferType
Describes the type of a IBuffer.
Definition rendering_api.hpp:601
ResourceUsage
Describes the intended usage for a resource.
Definition rendering_api.hpp:761
@ Default
Shortcut for commonly used TransferSource | TransferDestination combination.
ImageDimensions
Describes the dimensions of a image resource, i.e. the dimensions that are required to access a texel...
Definition rendering_api.hpp:1258
@ DIM_2
Represents a 2D image.
DescriptorType
Describes the type of a IDescriptor.
Definition rendering_api.hpp:442
QueuePriority
Specifies the priority with which a queue is scheduled on the GPU.
Definition rendering_api.hpp:160
@ Normal
The default queue priority.
QueueType
Represents the type of a CommandQueue.
Definition rendering_api.hpp:114
ResourceHeap
Defines where a resource (buffer or image) memory is located and from where it can be accessed.
Definition rendering_api.hpp:710
AccelerationStructureFlags
Controls how an acceleration structure should be built.
Definition rendering_api.hpp:1988
FilterMode
Describes the filter operation when accessing a pixel from a texture coordinate.
Definition rendering_api.hpp:1324
@ Nearest
Take the nearest texel with respect to the texture coordinate.
AllocationBehavior
Controls the allocation behavior of IGraphicsFactory.
Definition rendering_api.hpp:830
PipelineStage
Defines pipeline stages as points where synchronization may occur.
Definition rendering_api.hpp:1545
ResourceAccess
Defines how a IBuffer or IImage resource is accessed.
Definition rendering_api.hpp:1709
Format
Describes a texel format.
Definition rendering_api.hpp:183
MultiSamplingLevel
Describes the number of samples with which a IImage is sampled.
Definition rendering_api.hpp:1283
@ x1
The default number of samples. Multi-sampling will be deactivated, if this sampling level is used.
std::generator< T, TVal > Generator
Describes an intermediate container for elements of type T .
Definition containers.hpp:206
std::vector< T > Array
Represents a dynamic array.
Definition containers.hpp:73
std::optional< T > Optional
Represents an optional value.
Definition containers.hpp:94
std::shared_ptr< T > SharedPtr
Represents a shared pointer, that expresses non-exclusive ownership.
Definition containers.hpp:109
std::unique_ptr< T, TDeleter > UniquePtr
Represents a unique pointer, that expresses exclusive ownership.
Definition containers.hpp:102
std::string String
Definition string.hpp:24
std::string_view StringView
Definition string.hpp:26
std::span< T > Span
Represents a view of an array.
Definition containers.hpp:87
An input range over another range, where the returned values of type T are covariants of the values ...
Definition containers.hpp:529
Describes a resource binding to a descriptor or descriptor set.
Definition rendering_api.hpp:6218
Describes the offsets and sizes of a shader group within a shader binding table buffer.
Definition rendering_api.hpp:4291
Represents an allocation within the memory managed by the virtual allocator.
Definition rendering_api.hpp:3037