3#include <litefx/config.h>
5#if !defined (LITEFX_RENDERING_API)
6# if defined(LiteFX_Rendering_EXPORTS) && (defined _WIN32 || defined WINCE)
7# define LITEFX_RENDERING_API __declspec(dllexport)
8# elif (defined(LiteFX_Rendering_EXPORTS) || defined(__APPLE__)) && defined __GNUC__ && __GNUC__ >= 4
9# define LITEFX_RENDERING_API __attribute__ ((visibility ("default")))
10# elif !defined(LiteFX_Rendering_EXPORTS) && (defined _WIN32 || defined WINCE)
11# define LITEFX_RENDERING_API __declspec(dllimport)
15#ifndef LITEFX_RENDERING_API
16# define LITEFX_RENDERING_API
19#include <litefx/app.hpp>
20#include <litefx/math.hpp>
68#pragma region "Enumerations"
1896#pragma region "Flags"
1913#pragma region "Helper Functions"
1920 return static_cast<UInt32>(format) & 0x000000FF;
1928 return (
static_cast<UInt32>(format) & 0xFF000000) >> 24;
1936 return (
static_cast<UInt32>(format) & 0x0000FF00) >> 8;
2113 constexpr std::array<Format, 6> depthFormats {
2122 return std::any_of(std::begin(depthFormats), std::end(depthFormats), [&](
Format f) {
return f == format; });
2130 constexpr std::array<Format, 4> stencilFormats {
2137 return std::any_of(std::begin(stencilFormats), std::end(stencilFormats), [&](
Format f) {
return f == format; });
2142#pragma region "Data Types"
2149 struct LITEFX_RENDERING_API
alignas(16) IndirectBatch {
2175#pragma warning(push)
2176#pragma warning(disable: 4324)
2182 struct LITEFX_RENDERING_API alignas(16) IndirectIndexedBatch {
2187 UInt32 IndexCount{ };
2204 Int32 VertexOffset{ };
2218 struct LITEFX_RENDERING_API
alignas(16) IndirectDispatchBatch {
2259 virtual const
String& name() const noexcept = 0;
2298 const
String& name() const noexcept override;
2596 bool release(const
IPipeline& pipeline);
2603 bool release(const
IBuffer& buffer);
2624 bool release(const
IImage& image);
2631 bool release(const
ISampler& sampler);
2670 virtual
UInt64 uniqueId() const noexcept = 0;
2676 virtual
UInt32 vendorId() const noexcept = 0;
2682 virtual
UInt32 deviceId() const noexcept = 0;
2698 virtual
UInt64 driverVersion() const noexcept = 0;
2704 virtual
UInt32 apiVersion() const noexcept = 0;
2710 virtual
UInt64 dedicatedMemory() const noexcept = 0;
2777 virtual const
String& fileName() const noexcept = 0;
2783 virtual const
String& entryPoint() const noexcept = 0;
2829 bool Enable{
false };
2864 WriteMask ChannelWriteMask{ WriteMask::R | WriteMask::G | WriteMask::B | WriteMask::A };
2882 virtual
UInt64 identifier() const noexcept = 0;
2888 virtual const
String& name() const noexcept = 0;
2898 virtual
UInt32 location() const noexcept = 0;
2927 virtual
bool clearBuffer() const noexcept = 0;
2938 virtual
bool clearStencil() const noexcept = 0;
2949 virtual const
Vector4f& clearValues() const noexcept = 0;
2963 virtual
bool isVolatile() const noexcept = 0;
3040 UInt64 identifier() const noexcept override;
3043 const
String& name() const noexcept override;
3046 UInt32 location() const noexcept override;
3052 Format format() const noexcept override;
3058 bool clearBuffer() const noexcept override;
3061 bool clearStencil() const noexcept override;
3064 const
Vector4f& clearValues() const noexcept override;
3067 bool isVolatile() const noexcept override;
3070 const
BlendState& blendState() const noexcept override;
3155 bool Enable{
true };
3182 bool Enable{
false };
3234 bool Enable{
false };
3264 explicit DepthStencilState(
const DepthState& depthState,
const DepthBias& depthBias,
const StencilState& stencilState)
noexcept;
3303 virtual
DepthState& depthState() const noexcept;
3309 virtual
DepthBias& depthBias() const noexcept;
3359 virtual
Float lineWidth() const noexcept = 0;
3419 PolygonMode polygonMode() const noexcept override;
3422 CullMode cullMode() const noexcept override;
3425 CullOrder cullOrder() const noexcept override;
3428 Float lineWidth() const noexcept override;
3435 virtual
CullMode& cullMode() noexcept;
3436 virtual
CullOrder& cullOrder() noexcept;
3437 virtual
Float& lineWidth() noexcept;
3460 virtual
RectF getRectangle() const noexcept = 0;
3466 virtual
void setRectangle(const
RectF& rectangle) noexcept = 0;
3472 virtual
float getMinDepth() const noexcept = 0;
3478 virtual
void setMinDepth(
Float depth) const noexcept = 0;
3484 virtual
float getMaxDepth() const noexcept = 0;
3490 virtual
void setMaxDepth(
Float depth) const noexcept = 0;
3541 RectF getRectangle() const noexcept override;
3544 void setRectangle(const
RectF& rectangle) noexcept override;
3547 Float getMinDepth() const noexcept override;
3550 void setMinDepth(
Float depth) const noexcept override;
3553 Float getMaxDepth() const noexcept override;
3556 void setMaxDepth(
Float depth) const noexcept override;
3578 virtual
RectF getRectangle() const noexcept = 0;
3584 virtual
void setRectangle(const
RectF& rectangle) noexcept = 0;
3598 explicit Scissor(
const RectF& scissorRect = { })
noexcept;
3633 RectF getRectangle() const noexcept override;
3636 void setRectangle(const
RectF& rectangle) noexcept override;
3650 UInt64 RayGenerationGroupOffset { std::numeric_limits<UInt64>::max() };
3665 UInt64 HitGroupOffset { std::numeric_limits<UInt64>::max() };
3680 UInt64 MissGroupOffset{ std::numeric_limits<UInt64>::max() };
3695 UInt64 CallableGroupOffset { std::numeric_limits<UInt64>::max() };
3758 return SharedObject::create<TimingEvent>(swapChain, name);
3778 UInt64 readTimestamp() const;
3850 virtual
UInt32 location() const noexcept;
3862 virtual
UInt32 offset() const noexcept;
3882 virtual
UInt32 semanticIndex() const noexcept;
3907 virtual
size_t elementSize() const noexcept = 0;
4021 virtual
UInt32 descriptors() const noexcept = 0;
4032 virtual const
ISampler* staticSampler() const noexcept = 0;
4056 virtual
void map(const
void* const data,
size_t size,
UInt32 element = 0) = 0;
4064 virtual
void map(
Span<const
void* const> data,
size_t elementSize,
UInt32 firstElement = 0) = 0;
4073 virtual
void map(
void* data,
size_t size,
UInt32 element = 0,
bool write = true) = 0;
4082 virtual
void map(
Span<
void*> data,
size_t elementSize,
UInt32 firstElement = 0,
bool write = true) = 0;
4109 virtual
UInt32 elements() const noexcept = 0;
4124 virtual
size_t size() const noexcept = 0;
4135 virtual
size_t elementSize() const noexcept = 0;
4143 virtual
size_t elementAlignment() const noexcept = 0;
4154 virtual
size_t alignedElementSize() const noexcept = 0;
4169 inline
bool writable() const noexcept {
4170 return LITEFX_FLAG_IS_SET(this->usage(), ResourceUsage::AllowWrite);
4210 using IDeviceMemory::size;
4232 virtual
size_t size(
UInt32 level) const noexcept = 0;
4301 return level + (layer * this->levels()) + (plane * this->levels() * this->layers());
4313 const auto levels = this->levels();
4314 const UInt32 resourcesPerPlane = levels * this->layers();
4315 plane = subresource / resourcesPerPlane;
4316 layer = (subresource % resourcesPerPlane) / levels;
4317 level = subresource % levels;
4373 virtual
Float getAnisotropy() const noexcept = 0;
4385 virtual
Float getMipMapBias() const noexcept = 0;
4391 virtual
Float getMaxLOD() const noexcept = 0;
4397 virtual
Float getMinLOD() const noexcept = 0;
4495 this->doBuild(commandBuffer, scratchBuffer, buffer, offset, maxSize);
4531 this->doUpdate(commandBuffer, scratchBuffer, buffer, offset, maxSize);
4541 return this->getBuffer();
4604 if (vertexBuffer ==
nullptr) [[unlikely]]
4728 this->addTriangleMesh(
TriangleMesh(vertexBuffer, indexBuffer, transformBuffer, flags));
4751 this->addBoundingBox(
BoundingBoxes { .Buffer = buffer, .Flags = flags });
4808 this->doCopy(commandBuffer, destination, compress, buffer, offset, copyBuildInfo);
4818 template <
typename TSelf>
4820 self.addTriangleMesh(mesh);
4821 return std::forward<TSelf>(self);
4833 template <
typename TSelf>
4835 return std::forward<TSelf>(self).withTriangleMesh(
TriangleMesh(vertexBuffer, indexBuffer, transformBuffer, flags));
4844 template <
typename TSelf>
4846 self.addBoundingBox(aabb);
4847 return std::forward<TSelf>(self);
4857 template <
typename TSelf>
4859 return std::forward<TSelf>(self).withBoundingBox(
BoundingBoxes { .Buffer = buffer, .Flags = flags });
4872#pragma warning(push)
4873#pragma warning(disable: 4324)
4877 struct alignas(16) Instance final {
4881 SharedPtr<const IBottomLevelAccelerationStructure> BottomLevelAccelerationStructure;
4943 virtual
void addInstance(const
Instance& instance) = 0;
4954 this->addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
4967 this->addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Transform = transform, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
4980 virtual
bool remove(const
Instance& instance) noexcept = 0;
5017 this->doCopy(commandBuffer, destination, compress, buffer, offset, copyBuildInfo);
5026 template<
typename TSelf>
5028 self.addInstance(instance);
5029 return std::forward<TSelf>(self);
5041 template<
typename TSelf>
5043 self.addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
5044 return std::forward<TSelf>(self);
5057 template<
typename TSelf>
5059 self.addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Transform = transform, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
5060 return std::forward<TSelf>(self);
5150 this->doTransition(buffer, accessBefore, accessAfter);
5166 this->doTransition(buffer, element, accessBefore, accessAfter);
5179 this->doTransition(image, accessBefore, accessAfter, layout);
5197 this->doTransition(image, level, levels, layer, layers, plane, accessBefore, accessAfter, layout);
5215 this->doTransition(image, accessBefore, accessAfter, fromLayout, toLayout);
5238 this->doTransition(image, level, levels, layer, layers, plane, accessBefore, accessAfter, fromLayout, toLayout);
5274 this->doUpdate(binding, buffer, bufferElement, elements, firstDescriptor);
5299 this->doUpdate(binding, texture, descriptor, firstLevel, levels, firstLayer, layers);
5309 this->doUpdate(binding, sampler, descriptor);
5319 this->doUpdate(binding, accelerationStructure, descriptor);
5423 return this->getDescriptors();
5452 virtual
UInt32 uniforms() const noexcept = 0;
5458 virtual
UInt32 storages() const noexcept = 0;
5477 virtual
UInt32 samplers() const noexcept = 0;
5484 virtual
UInt32 staticSamplers() const noexcept = 0;
5490 virtual
UInt32 inputAttachments() const noexcept = 0;
5520 return this->getDescriptorSet(0, bindings);
5525 return this->getDescriptorSet(0, bindings);
5530 return this->getDescriptorSet(0, std::move(bindings));
5542 return this->getDescriptorSet(descriptors, bindings);
5547 return this->getDescriptorSet(descriptors, bindings);
5558 return this->getDescriptorSet(descriptors, std::move(bindings));
5569 return this->getDescriptorSets(descriptorSets, 0, bindings);
5572#ifdef __cpp_lib_mdspan
5575 return this->getDescriptorSets(descriptorSets, 0, bindings);
5587 return this->getDescriptorSets(descriptorSets, 0, std::move(bindingFactory));
5599 return this->getDescriptorSets(descriptorSets, descriptors, bindings);
5602#ifdef __cpp_lib_mdspan
5605 return this->getDescriptorSets(descriptorSets, descriptors, bindings);
5618 return this->getDescriptorSets(descriptorSets, descriptors, std::move(bindingFactory));
5626 this->releaseDescriptorSet(descriptorSet);
5635#ifdef __cpp_lib_mdspan
5639 virtual void releaseDescriptorSet(
const IDescriptorSet& descriptorSet)
const = 0;
5727 return this->getRanges();
5789 const auto& group = this->shaderGroup();
5791 if (std::holds_alternative<MeshGeometryHitGroup>(group))
5793 return ShaderRecordType::HitGroup;
5795 else if (std::holds_alternative<const IShaderModule*>(group))
5797 switch (std::get<const IShaderModule*>(group)->type())
5799 case ShaderStage::RayGeneration:
return ShaderRecordType::RayGeneration;
5800 case ShaderStage::Miss:
return ShaderRecordType::Miss;
5801 case ShaderStage::Callable:
return ShaderRecordType::Callable;
5802 case ShaderStage::Intersection:
return ShaderRecordType::Intersection;
5803 default:
return ShaderRecordType::Invalid;
5826 constexpr virtual const
void* localData() const noexcept = 0;
5833 constexpr virtual
UInt64 localDataSize() const noexcept = 0;
5841 template <typename... TLocalData>
5847 const
size_t SHADER_RECORD_LOCAL_DATA_ALIGNMENT { 8 };
5859 template <
typename TLocalData>
requires
5860 (std::alignment_of_v<TLocalData> == SHADER_RECORD_LOCAL_DATA_ALIGNMENT) &&
5861 std::is_standard_layout_v<TLocalData>
5870 TLocalData m_payload;
5880 return m_shaderGroup;
5885 return static_cast<const void*
>(&m_payload);
5890 return sizeof(TLocalData);
5905 m_payload(payload), m_shaderGroup(group) { }
5951 return m_shaderGroup;
5975 m_shaderGroup(group) { }
6019 m_program(std::move(shaderProgram))
6076 auto shaderModule = this->findShaderModule(shaderName);
6078 if (shaderModule ==
nullptr) [[unlikely]]
6079 throw InvalidArgumentException(
"shaderName",
"The parent shader program does not contain a shader named \"{}\".", shaderName);
6081 if (shaderModule->type() == ShaderStage::AnyHit)
6083 else if (shaderModule->type() == ShaderStage::ClosestHit)
6102 auto shaderModule = this->findShaderModule(shaderName);
6104 if (shaderModule ==
nullptr) [[unlikely]]
6105 throw InvalidArgumentException(
"shaderName",
"The parent shader program does not contain a shader named \"{}\".", shaderName);
6107 if (shaderModule->type() == ShaderStage::AnyHit)
6109 else if (shaderModule->type() == ShaderStage::ClosestHit)
6123 .ClosestHitShader = closestHitShaderName.has_value() ? this->findShaderModule(closestHitShaderName.value()) :
nullptr,
6124 .AnyHitShader = anyHitShaderName.has_value() ? this->findShaderModule(anyHitShaderName.value()) :
nullptr
6141 .ClosestHitShader = closestHitShaderName.has_value() ? this->findShaderModule(closestHitShaderName.value()) :
nullptr,
6142 .AnyHitShader = anyHitShaderName.has_value() ? this->findShaderModule(anyHitShaderName.value()) :
nullptr
6177 this->addShaderRecord(shaderName);
6178 return std::forward<ShaderRecordCollection>(*
this);
6194 this->addShaderRecord(shaderName, payload);
6195 return std::forward<ShaderRecordCollection>(*
this);
6205 this->addMeshGeometryShaderHitGroupRecord(anyHitShaderName, closestHitShaderName);
6206 return std::forward<ShaderRecordCollection>(*
this);
6219 this->addMeshGeometryShaderHitGroupRecord(anyHitShaderName, closestHitShaderName, payload);
6220 return std::forward<ShaderRecordCollection>(*
this);
6229 this->addShaderRecord(shaderGroup);
6230 return std::forward<ShaderRecordCollection>(*
this);
6242 this->addShaderRecord(shaderGroup, payload);
6243 return std::forward<ShaderRecordCollection>(*
this);
6305 auto modules = this->getModules();
6307 if (
auto match = std::ranges::find_if(modules, [name](
auto& module) {
return module.fileName().compare(name) == 0; }); match != modules.end())
6308 return std::addressof(*match);
6319 auto modules = this->getModules();
6320 return std::ranges::find_if(modules, [name](
const auto& module) {
return module.fileName().compare(name) == 0; }) != modules.end();
6329 auto modules = this->getModules();
6330 return std::ranges::find_if(modules, [&module](
const auto& m) {
return std::addressof(m) == std::addressof(module); }) != modules.end();
6338 return this->getModules();
6366 return this->parsePipelineLayout();
6374 return { this->shared_from_this() };
6415 return this->getDescriptorSets();
6448 return this->getVertexBufferLayouts();
6498 return this->getProgram();
6506 return this->getLayout();
6540 virtual
void begin() const = 0;
6549 virtual
void end() const = 0;
6555 virtual
bool isSecondary() const noexcept = 0;
6598 return this->getQueue();
6608 return this->getBarrier(syncBefore, syncAfter);
6621 this->cmdBarrier(barrier);
6639 this->cmdTransfer(source, target, sourceElement, targetElement, elements);
6663 this->cmdTransfer(source, target, sourceElement, targetElement, elements);
6680 this->cmdTransfer(data, size, target, targetElement, elements);
6696 this->cmdTransfer(data, elementSize, target, targetElement);
6735 this->cmdTransfer(source, target, sourceElement, firstSubresource, elements);
6781 this->cmdTransfer(source, target, sourceElement, firstSubresource, elements);
6798 this->cmdTransfer(data, size, target, subresource);
6815 this->cmdTransfer(data, elementSize, target, firstSubresource, elements);
6832 this->cmdTransfer(source, target, sourceSubresource, targetSubresource, subresources);
6856 this->cmdTransfer(source, target, sourceSubresource, targetSubresource, subresources);
6895 this->cmdTransfer(source, target, firstSubresource, targetElement, subresources);
6941 this->cmdTransfer(source, target, firstSubresource, targetElement, subresources);
6948 this->cmdUse(pipeline);
6958 this->cmdBind(descriptorSet);
6970 template <
typename TSelf,
typename T>
6971 inline void bind(
this const TSelf& self, std::initializer_list<const T*> descriptorSets)
requires
6972 std::derived_from<T, IDescriptorSet>
6987 template <
typename TSelf>
6988 inline void bind(
this const TSelf& self, std::ranges::input_range
auto&& descriptorSets)
requires
6989 std::derived_from<std::remove_cv_t<std::remove_pointer_t<std::iter_value_t<std::ranges::iterator_t<std::remove_cv_t<std::remove_reference_t<
decltype(descriptorSets)>>>>>>,
IDescriptorSet>
6991 using descriptor_set_type = std::remove_cv_t<std::remove_pointer_t<std::iter_value_t<std::ranges::iterator_t<std::remove_cv_t<std::remove_reference_t<
decltype(descriptorSets)>>>>>>;
6992 auto sets = descriptorSets | std::ranges::to<Array<const descriptor_set_type*>>();
7004 this->cmdBind(descriptorSets);
7013 this->cmdBind(descriptorSet, pipeline);
7026 template <
typename TSelf,
typename T>
7027 inline void bind(
this const TSelf& self, std::initializer_list<const T*> descriptorSets,
const typename TSelf::pipeline_type& pipeline)
7042 template <
typename TSelf>
7043 inline void bind(
this const TSelf& self, std::ranges::input_range
auto&& descriptorSets,
const typename TSelf::pipeline_type& pipeline)
requires
7044 std::derived_from<std::remove_cv_t<std::remove_pointer_t<std::iter_value_t<std::ranges::iterator_t<std::remove_cv_t<std::remove_reference_t<
decltype(descriptorSets)>>>>>>,
IDescriptorSet>
7046 using descriptor_set_type = std::remove_cv_t<std::remove_pointer_t<std::iter_value_t<std::ranges::iterator_t<std::remove_cv_t<std::remove_reference_t<
decltype(descriptorSets)>>>>>>;
7047 auto sets = descriptorSets | std::ranges::to<Array<const descriptor_set_type*>>();
7060 this->cmdBind(descriptorSets, pipeline);
7074 this->cmdBind(buffer);
7087 this->cmdBind(buffer);
7104 this->dispatch({ x, y, z });
7115 this->cmdDispatchIndirect(batchBuffer, batchCount, offset);
7137 this->dispatchMesh({ x, y, z });
7148 this->cmdDispatchMeshIndirect(batchBuffer, batchCount, offset);
7161 this->cmdDispatchMeshIndirect(batchBuffer, countBuffer, offset, countOffset, maxBatches);
7179 this->cmdTraceRays(width, height, depth, offsets, rayGenerationShaderBindingTable, missShaderBindingTable, hitShaderBindingTable, callableShaderBindingTable);
7195 this->traceRays(dimensions.
x(), dimensions.
y(), dimensions.
z(), offsets, rayGenerationShaderBindingTable, missShaderBindingTable, hitShaderBindingTable, callableShaderBindingTable);
7219 this->cmdDraw(vertexBuffer, instances, firstVertex, firstInstance);
7230 this->cmdDrawIndirect(batchBuffer, batchCount, offset);
7243 this->cmdDrawIndirect(batchBuffer, countBuffer, offset, countOffset, maxBatches);
7269 this->cmdDrawIndexed(indexBuffer, instances, firstIndex, vertexOffset, firstInstance);
7285 this->cmdDrawIndexed(vertexBuffer, indexBuffer, instances, firstIndex, vertexOffset, firstInstance);
7296 this->cmdDrawIndexedIndirect(batchBuffer, batchCount, offset);
7309 this->cmdDrawIndexedIndirect(batchBuffer, countBuffer, offset, countOffset, maxBatches);
7318 this->cmdPushConstants(layout, memory);
7378 this->cmdExecute(commandBuffer);
7386 this->cmdExecute(std::move(commandBuffers));
7402 this->cmdBuildAccelerationStructure(blas, scratchBuffer, buffer, offset);
7418 this->cmdBuildAccelerationStructure(tlas, scratchBuffer, buffer, offset);
7434 this->cmdUpdateAccelerationStructure(blas, scratchBuffer, buffer, offset);
7450 this->cmdUpdateAccelerationStructure(tlas, scratchBuffer, buffer, offset);
7467 this->cmdCopyAccelerationStructure(from, to, compress);
7484 this->cmdCopyAccelerationStructure(from, to, compress);
7496 virtual
void cmdBarrier(const
IBarrier& barrier) const noexcept = 0;
7499 virtual
void cmdTransfer(const
IImage& source, const
IImage& target,
UInt32 sourceSubresource,
UInt32 targetSubresource,
UInt32 subresources) const = 0;
7505 virtual
void cmdTransfer(const
void* const data,
size_t size, const
IBuffer& target,
UInt32 targetElement,
UInt32 elements) const = 0;
7506 virtual
void cmdTransfer(
Span<const
void* const> data,
size_t elementSize, const
IBuffer& target,
UInt32 targetElement) const = 0;
7507 virtual
void cmdTransfer(const
void* const data,
size_t size, const
IImage& target,
UInt32 subresource) const = 0;
7508 virtual
void cmdTransfer(
Span<const
void* const> data,
size_t elementSize, const
IImage& target,
UInt32 firstSubresource,
UInt32 elements) const = 0;
7509 virtual
void cmdUse(const
IPipeline& pipeline) const noexcept = 0;
7510 virtual
void cmdBind(const
IDescriptorSet& descriptorSet) const = 0;
7514 virtual
void cmdBind(const
IVertexBuffer& buffer) const = 0;
7515 virtual
void cmdBind(const
IIndexBuffer& buffer) const = 0;
7516 virtual
void cmdPushConstants(const
IPushConstantsLayout& layout, const
void* const memory) const = 0;
7517 virtual
void cmdDispatchIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
7518 virtual
void cmdDispatchMeshIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
7519 virtual
void cmdDispatchMeshIndirect(const
IBuffer& batchBuffer, const
IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches) const noexcept = 0;
7521 virtual
void cmdDrawIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
7522 virtual
void cmdDrawIndirect(const
IBuffer& batchBuffer, const
IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches) const noexcept = 0;
7525 virtual
void cmdDrawIndexedIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
7526 virtual
void cmdDrawIndexedIndirect(const
IBuffer& batchBuffer, const
IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches) const noexcept = 0;
7558 return this->getInputAssembler();
7566 return this->getRasterizer();
7648 virtual
UInt32 maxRecursionDepth() const noexcept = 0;
7661 virtual
UInt32 maxPayloadSize() const noexcept = 0;
7672 virtual
UInt32 maxAttributeSize() const noexcept = 0;
7690 return this->getShaderBindingTable(offsets, groups);
7722 EventArgs(), m_newSize(std::move(newSize)) { }
7734 inline const
Size2d& newSize() const noexcept {
7767 released.invoke(
this, { });
7805 virtual
size_t getWidth() const noexcept = 0;
7814 virtual
size_t getHeight() const noexcept = 0;
7859 this->mapRenderTarget(renderTarget, renderTarget.name());
7870 std::ranges::for_each(renderTargets, [
this](
auto& renderTarget) { this->mapRenderTarget(renderTarget); });
7888 return this->getImages();
7954 template <
typename TSelf>
7956 self.addImage(format, samples, usage);
7957 return std::forward<TSelf>(self);
7967 this->addImage(
"", format, samples, usage);
7977 template <
typename TSelf>
7979 self.addImage(name, format, samples, usage);
7980 return std::forward<TSelf>(self);
7999 template <
typename TSelf>
8001 self.addImage(renderTarget, samples, usage);
8002 return std::forward<TSelf>(self);
8012 this->addImage(renderTarget.
name(), renderTarget, samples, usage);
8022 template <
typename TSelf>
8024 self.addImage(name, renderTarget, samples, usage);
8025 return std::forward<TSelf>(self);
8046 template <
typename TSelf>
8048 std::ranges::for_each(renderTargets, [&](
auto& renderTarget) { self.addImage(renderTarget.
name(), renderTarget, samples, usage); });
8049 return std::forward<TSelf>(self);
8077 EventArgs(), m_frameBuffer(&frameBuffer) { }
8090 return *m_frameBuffer;
8135 return this->getActiveFrameBuffer();
8143 return this->getCommandQueue();
8155 return this->getCommandBuffers();
8167 return this->getCommandBuffer(index);
8198 virtual
bool hasPresentTarget() const noexcept = 0;
8227 this->beginRenderPass(frameBuffer);
8241 virtual
void beginRenderPass(const
IFrameBuffer& frameBuffer) const = 0;
8242 virtual const
ICommandQueue& getCommandQueue() const noexcept = 0;
8264 EventArgs(), m_surfaceFormat(surfaceFormat), m_renderArea(std::move(renderArea)), m_buffers(buffers), m_vsync(enableVsync) { }
8276 inline
Format surfaceFormat() const noexcept {
8277 return m_surfaceFormat;
8285 return m_renderArea;
8326 auto timingEvent = TimingEvent::create(*
this, name);
8327 this->addTimingEvent(timingEvent);
8388 virtual const
Size2d& renderArea() const noexcept = 0;
8394 virtual
bool verticalSynchronization() const noexcept = 0;
8407 virtual const
IImage& image() const noexcept = 0;
8414 return this->getImages();
8492 EventArgs(), m_commandBuffers(std::move(commandBuffers)) { }
8506 return m_commandBuffers;
8565 static constexpr Vectors::ByteVector3 DEFAULT_DEBUG_COLOR = { 128_b, 128_b, 128_b };
8620 return this->getCommandBuffer(beginRecording, secondary);
8636 return this->submitCommandBuffer(commandBuffer);
8652 return this->submitCommandBuffer(commandBuffer);
8668 return this->submitCommandBuffers(std::move(commandBuffers));
8691 this->waitForQueue(queue, fence);
8738 return this->getBuffer(type, heap, elementSize, elements, usage);
8751 auto& descriptor = descriptorSet.
descriptor(binding);
8752 return this->createBuffer(descriptor.type(), heap, descriptor.elementSize(), elements, usage);
8765 auto& descriptor = descriptorSet.
descriptor(binding);
8766 return this->createBuffer(descriptor.type(), heap, elementSize, elements, usage);
8780 return this->createBuffer(pipeline.
layout()->descriptorSet(space), binding, heap, elementSize, elements, usage);
8794 return this->createBuffer(pipeline.
layout()->descriptorSet(space), binding, heap, elements, usage);
8808 return this->getBuffer(name, type, heap, elementSize, elements, usage);
8822 auto& descriptor = descriptorSet.
descriptor(binding);
8823 return this->createBuffer(name, descriptor.type(), heap, descriptor.elementSize(), elements, usage);
8838 auto& descriptor = descriptorSet.
descriptor(binding);
8839 return this->createBuffer(name, descriptor.type(), heap, elementSize, elements, usage);
8854 return this->createBuffer(name, pipeline.
layout()->descriptorSet(space), binding, heap, elements, usage);
8870 return this->createBuffer(name, pipeline.
layout()->descriptorSet(space), binding, heap, elementSize, elements, usage);
8887 return this->getVertexBuffer(layout, heap, elements, usage);
8905 return this->getVertexBuffer(name, layout, heap, elements, usage);
8922 return this->getIndexBuffer(layout, heap, elements, usage);
8940 return this->getIndexBuffer(name, layout, heap, elements, usage);
8960 return this->getTexture(format, size, dimension, levels, layers, samples, usage);
8981 return this->getTexture(name, format, size, dimension, levels, layers, samples, usage);
8996 return this->getTextures(format, size, dimension, layers, levels, samples, usage);
9015 return this->getSampler(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
9034 inline SharedPtr<ISampler> 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 {
9035 return this->getSampler(name, magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
9054 return this->getSamplers(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
9067 return this->createBottomLevelAccelerationStructure(
"", flags);
9081 return this->getBlas(name, flags);
9094 return this->createTopLevelAccelerationStructure(
"", flags);
9108 return this->getTlas(name, flags);
9122 virtual 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 = 0;
9143 bool MeshShaders {
false };
9148 bool RayTracing {
false };
9153 bool RayQueries {
false };
9158 bool DrawIndirect {
false };
9226 return this->getDefaultQueue(type);
9248 return this->getNewQueue(type, priority);
9258 return this->getNewBarrier(syncBefore, syncAfter);
9267 return this->makeFrameBuffer(
"", renderArea);
9277 return this->getNewFrameBuffer(name, renderArea);
9313 this->getAccelerationStructureSizes(blas, bufferSize, scratchSize, forUpdate);
9331 this->getAccelerationStructureSizes(tlas, bufferSize, scratchSize, forUpdate);
9375 return this->getAdapters();
9411 return this->device(name);
9420 return this->device(name);
9430 template <
typename T>
Definition buffer_attribute.cpp:9
Definition depth_stencil_state.cpp:9
Definition device_state.cpp:9
An exception that is thrown, if a provided non-optional argument was not initialized.
Definition exceptions.hpp:185
Base class for additional event arguments.
Definition app.hpp:86
A class that is used to declare an event, which a number of listeners can subscribe to.
Definition app.hpp:168
The base class for an app backend.
Definition app.hpp:18
An exception that is thrown, if a provided argument is not valid.
Definition exceptions.hpp:60
Stores meta data about a buffer attribute, i.e. a member or field of a descriptor or buffer.
Definition rendering_api.hpp:3792
virtual ~BufferAttribute() noexcept
Releases the buffer attribute instance.
BufferAttribute & operator=(const BufferAttribute &_other)
Assigns a buffer attribute by copying it.
BufferAttribute(const BufferAttribute &_other)
Creates a copy of a buffer attribute.
BufferAttribute(BufferAttribute &&_other) noexcept
Takes over another instance of a buffer attribute.
BufferAttribute & operator=(BufferAttribute &&_other) noexcept
Assigns a buffer attribute by taking it over.
Stores the depth/stencil state of a see IRasterizer.
Definition rendering_api.hpp:3143
DepthStencilState() noexcept
Initializes a new rasterizer depth/stencil state.
A class that can be used to manage the state of a IGraphicsDevice.
Definition rendering_api.hpp:2312
DeviceState(DeviceState &&_other) noexcept
Takes over another instance of a device state.
DeviceState()
Creates a new device state instance.
DeviceState & operator=(DeviceState &&_other) noexcept
Assigns a device state by taking it over.
Base interface for a ray tracing acceleration structure.
Definition rendering_api.hpp:4449
void update(const ICommandBuffer &commandBuffer, const SharedPtr< const IBuffer > &scratchBuffer=nullptr, const SharedPtr< const IBuffer > &buffer=nullptr, UInt64 offset=0, UInt64 maxSize=0)
Performs an update on the acceleration structure.
Definition rendering_api.hpp:4530
SharedPtr< const IBuffer > buffer() const noexcept
Returns the acceleration structure backing buffer, that stores its last build.
Definition rendering_api.hpp:4540
IAccelerationStructure() noexcept=default
virtual UInt64 offset() const noexcept=0
Returns the offset into buffer at which the acceleration structure is stored.
The interface for a barrier.
Definition rendering_api.hpp:5110
constexpr void transition(const IImage &image, UInt32 level, UInt32 levels, UInt32 layer, UInt32 layers, UInt32 plane, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout layout)
Inserts an image barrier that blocks access to a sub-resource range of image of the types contained ...
Definition rendering_api.hpp:5196
constexpr void transition(const IImage &image, UInt32 level, UInt32 levels, UInt32 layer, UInt32 layers, UInt32 plane, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout fromLayout, ImageLayout toLayout)
Inserts an image barrier that blocks access to a sub-resource range of image of the types contained ...
Definition rendering_api.hpp:5237
constexpr void transition(const IImage &image, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout layout)
Inserts an image barrier that blocks access to all sub-resources of image of the types contained in ...
Definition rendering_api.hpp:5178
IBarrier() noexcept=default
constexpr void transition(const IBuffer &buffer, UInt32 element, ResourceAccess accessBefore, ResourceAccess accessAfter)
Inserts a buffer barrier that blocks access to a buffer s element of types contained in accessAfter ...
Definition rendering_api.hpp:5165
constexpr void transition(const IImage &image, ResourceAccess accessBefore, ResourceAccess accessAfter, ImageLayout fromLayout, ImageLayout toLayout)
Inserts an image barrier that blocks access to all sub-resources of image of the types contained in ...
Definition rendering_api.hpp:5214
A structure that holds a singular entity of geometry for hardware ray-tracing.
Definition rendering_api.hpp:4588
virtual void clear() noexcept=0
Clears all bounding boxes and triangle meshes from the acceleration structure.
auto withBoundingBox(this TSelf &&self, const SharedPtr< const IBuffer > &buffer, GeometryFlags flags=GeometryFlags::None) -> TSelf &&
Adds a buffer containing axis-aligned bounding boxes to the BLAS.
Definition rendering_api.hpp:4858
IBottomLevelAccelerationStructure() noexcept=default
auto withTriangleMesh(this TSelf &&self, const TriangleMesh &mesh) -> TSelf &&
Adds a triangle mesh to the BLAS.
Definition rendering_api.hpp:4819
auto withTriangleMesh(this TSelf &&self, const SharedPtr< const IVertexBuffer > &vertexBuffer, const SharedPtr< const IIndexBuffer > &indexBuffer=nullptr, const SharedPtr< const IBuffer > &transformBuffer=nullptr, GeometryFlags flags=GeometryFlags::None) -> TSelf &&
Adds a triangle mesh to the BLAS.
Definition rendering_api.hpp:4834
auto withBoundingBox(this TSelf &&self, const BoundingBoxes &aabb) -> TSelf &&
Adds a buffer containing axis-aligned bounding boxes to the BLAS.
Definition rendering_api.hpp:4845
virtual const Array< BoundingBoxes > & boundingBoxes() const noexcept=0
Returns an array of buffers, each containing axis-aligned bounding boxes stored in the BLAS.
Base interface for buffer objects.
Definition rendering_api.hpp:4186
IBuffer() noexcept=default
Describes a buffer layout.
Definition rendering_api.hpp:3891
IBufferLayout() noexcept=default
The interface for a command buffer.
Definition rendering_api.hpp:6517
virtual UInt64 submit() const =0
Submits the command buffer to parent command.
void traceRays(UInt32 width, UInt32 height, UInt32 depth, const ShaderBindingTableOffsets &offsets, const IBuffer &rayGenerationShaderBindingTable, const IBuffer *missShaderBindingTable=nullptr, const IBuffer *hitShaderBindingTable=nullptr, const IBuffer *callableShaderBindingTable=nullptr) const noexcept
Executes a query on a ray-tracing pipeline.
Definition rendering_api.hpp:7178
virtual void setBlendFactors(const Vector4f &blendFactors) const noexcept=0
Sets the blend factors for the subsequent draw calls.
void updateAccelerationStructure(ITopLevelAccelerationStructure &tlas, const SharedPtr< const IBuffer > &scratchBuffer, const IBuffer &buffer, UInt64 offset=0) const
Updates a top-level acceleration structure.
Definition rendering_api.hpp:7449
void drawIndirect(const IBuffer &batchBuffer, const IBuffer &countBuffer, UInt64 offset=0, UInt64 countOffset=0, UInt32 maxBatches=std::numeric_limits< UInt32 >::max()) const noexcept
Executes a set of indirect non-indexed draw calls.
Definition rendering_api.hpp:7242
void barrier(const IBarrier &barrier) const noexcept
Executes the transitions that have been added to barrier .
Definition rendering_api.hpp:6620
ICommandBuffer() noexcept=default
virtual void setViewports(const IViewport *viewport) const =0
Sets the viewport used for the subsequent draw calls.
void transfer(Span< const void *const > data, size_t elementSize, const IImage &target, UInt32 firstSubresource=0, UInt32 elements=1) const
Performs a buffer-to-buffer transfer from a temporary buffer into target .
Definition rendering_api.hpp:6814
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:6957
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:7317
void bind(this const TSelf &self, std::ranges::input_range auto &&descriptorSets, const typename TSelf::pipeline_type &pipeline)
Binds an arbitrary input range of descriptor sets to the provided pipeline.
Definition rendering_api.hpp:7043
void buildAccelerationStructure(ITopLevelAccelerationStructure &tlas, const SharedPtr< const IBuffer > &scratchBuffer, const IBuffer &buffer, UInt64 offset=0) const
Builds a top-level acceleration structure.
Definition rendering_api.hpp:7417
void transfer(const void *const data, size_t size, const IImage &target, UInt32 subresource=0) const
Performs a buffer-to-buffer transfer from a temporary buffer into target .
Definition rendering_api.hpp:6797
void dispatchMesh(UInt32 x, UInt32 y, UInt32 z) const noexcept
Executes a mesh shader pipeline.
Definition rendering_api.hpp:7136
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:6638
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.
void copyAccelerationStructure(const ITopLevelAccelerationStructure &from, const ITopLevelAccelerationStructure &to, bool compress=false) const noexcept
Copies the acceleration structure from into the acceleration structure to .
Definition rendering_api.hpp:7483
virtual void dispatchMesh(const Vector3u &threadGroupCount) const noexcept=0
Executes a mesh shader pipeline.
virtual void writeTimingEvent(const SharedPtr< const TimingEvent > &timingEvent) const =0
Writes the current GPU time stamp value for the timing event.
void bind(const IVertexBuffer &buffer) const
Binds a vertex buffer to the pipeline.
Definition rendering_api.hpp:7073
void execute(const SharedPtr< const ICommandBuffer > &commandBuffer) const
Executes a secondary command buffer/bundle.
Definition rendering_api.hpp:7377
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:7433
void transfer(const SharedPtr< const IImage > &source, const IBuffer &target, UInt32 firstSubresource=0, UInt32 targetElement=0, UInt32 subresources=1) const
Performs an image-to-buffer transfer from source to target .
Definition rendering_api.hpp:6940
void drawIndexed(const IVertexBuffer &vertexBuffer, const IIndexBuffer &indexBuffer, UInt32 instances=1, UInt32 firstIndex=0, Int32 vertexOffset=0, UInt32 firstInstance=0) const
Draws the vertex buffer provided by vertexBuffer using the index buffer, provided by indexBuffer .
Definition rendering_api.hpp:7284
virtual void releaseSharedState() const =0
Called by the parent command queue to signal that the command buffer should release it's shared state...
virtual void setScissors(const IScissor *scissor) const =0
Sets the scissor rectangle used for the subsequent draw calls.
void bind(this const TSelf &self, std::ranges::input_range auto &&descriptorSets)
Binds an arbitrary input range of descriptor sets to the last pipeline that was used by the command b...
Definition rendering_api.hpp:6988
void transfer(const IImage &source, const IImage &target, UInt32 sourceSubresource=0, UInt32 targetSubresource=0, UInt32 subresources=1) const
Performs an image-to-image transfer from source to target .
Definition rendering_api.hpp:6831
void bind(Span< const IDescriptorSet * > descriptorSets) const
Binds an arbitrary input range of descriptor sets to the last pipeline that was used by the command b...
Definition rendering_api.hpp:7003
void transfer(const SharedPtr< const IImage > &source, const IImage &target, UInt32 sourceSubresource=0, UInt32 targetSubresource=0, UInt32 subresources=1) const
Performs an image-to-image transfer from source to target .
Definition rendering_api.hpp:6855
void transfer(const IBuffer &source, const IImage &target, UInt32 sourceElement=0, UInt32 firstSubresource=0, UInt32 elements=1) const
Performs a buffer-to-image transfer from source to target .
Definition rendering_api.hpp:6734
void execute(Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers) const
Executes a series of secondary command buffers/bundles.
Definition rendering_api.hpp:7385
void use(const IPipeline &pipeline) const noexcept
Sets the active pipeline state.
Definition rendering_api.hpp:6947
void transfer(const SharedPtr< 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:6662
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:7466
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:7295
void transfer(const void *const data, size_t size, const IBuffer &target, UInt32 targetElement=0, UInt32 elements=1) const
Performs a buffer-to-buffer transfer from a temporary buffer into target .
Definition rendering_api.hpp:6679
void transfer(const SharedPtr< const IBuffer > &source, const IImage &target, UInt32 sourceElement=0, UInt32 firstSubresource=0, UInt32 elements=1) const
Performs a buffer-to-image transfer from source to target .
Definition rendering_api.hpp:6780
virtual void setScissors(Span< const IScissor * > scissors) const =0
Sets the scissor rectangles used for the subsequent draw calls.
void dispatch(UInt32 x, UInt32 y, UInt32 z) const noexcept
Executes a compute shader.
Definition rendering_api.hpp:7103
void dispatchIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect dispatches.
Definition rendering_api.hpp:7114
void traceRays(const Vector3u &dimensions, const ShaderBindingTableOffsets &offsets, const IBuffer &rayGenerationShaderBindingTable, const IBuffer *missShaderBindingTable=nullptr, const IBuffer *hitShaderBindingTable=nullptr, const IBuffer *callableShaderBindingTable=nullptr) const noexcept
Executes a query on a ray-tracing pipeline.
Definition rendering_api.hpp:7194
virtual void setViewports(Span< const IViewport * > viewports) const =0
Sets the viewports used for the subsequent draw calls.
void dispatchMeshIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect mesh shader dispatches.
Definition rendering_api.hpp:7147
void transfer(Span< const void *const > data, size_t elementSize, const IBuffer &target, UInt32 targetElement=0) const
Performs a buffer-to-buffer transfer from a temporary buffer into target .
Definition rendering_api.hpp:6695
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:7229
UniquePtr< IBarrier > makeBarrier(PipelineStage syncBefore, PipelineStage syncAfter) const
Creates a new barrier instance.
Definition rendering_api.hpp:6607
void bind(this const TSelf &self, std::initializer_list< const T * > descriptorSets, const typename TSelf::pipeline_type &pipeline)
Binds an arbitrary input range of descriptor sets to the last pipeline that was used by the command b...
Definition rendering_api.hpp:7027
void bind(Span< const IDescriptorSet * > descriptorSets, const IPipeline &pipeline) const
Binds an arbitrary input range of descriptor sets to the provided pipeline.
Definition rendering_api.hpp:7059
virtual void setStencilRef(UInt32 stencilRef) const noexcept=0
Sets the stencil reference for the subsequent draw calls.
void bind(const IDescriptorSet &descriptorSet, const IPipeline &pipeline) const
Binds the provided descriptor set to the provided pipeline.
Definition rendering_api.hpp:7012
void bind(this const TSelf &self, std::initializer_list< const T * > descriptorSets)
Binds an arbitrary input range of descriptor sets to the last pipeline that was used by the command b...
Definition rendering_api.hpp:6971
void bind(const IIndexBuffer &buffer) const
Binds a index buffer to the pipeline.
Definition rendering_api.hpp:7086
void transfer(const IImage &source, const IBuffer &target, UInt32 firstSubresource=0, UInt32 targetElement=0, UInt32 subresources=1) const
Performs an image-to-buffer transfer from source to target .
Definition rendering_api.hpp:6894
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:7401
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.
void drawIndexedIndirect(const IBuffer &batchBuffer, const IBuffer &countBuffer, UInt64 offset=0, UInt64 countOffset=0, UInt32 maxBatches=std::numeric_limits< UInt32 >::max()) const noexcept
Executes a set of indirect indexed draw calls.
Definition rendering_api.hpp:7308
void dispatchMeshIndirect(const IBuffer &batchBuffer, const IBuffer &countBuffer, UInt64 offset=0, UInt64 countOffset=0, UInt32 maxBatches=std::numeric_limits< UInt32 >::max()) const noexcept
Executes a set of indirect mesh shader dispatches.
Definition rendering_api.hpp:7160
The interface for a command queue.
Definition rendering_api.hpp:8481
ICommandQueue() noexcept=default
Event< QueueSubmittingEventArgs > submitting
Invoked, when one or more command buffers are submitted to the queue.
Definition rendering_api.hpp:8599
Event< QueueSubmittedEventArgs > submitted
Invoked, after one or more command buffers have been submitted to the queue.
Definition rendering_api.hpp:8604
virtual UInt64 currentFence() const noexcept=0
Returns the value of the latest fence inserted into the queue.
virtual void waitFor(UInt64 fence) const =0
Lets the CPU wait for a certain fence value to complete on the command queue.
virtual void beginDebugRegion(const String &label, const Vectors::ByteVector3 &color=DEFAULT_DEBUG_COLOR) const noexcept
Starts a new debug region.
Definition rendering_api.hpp:8575
SharedPtr< ICommandBuffer > createCommandBuffer(bool beginRecording=false, bool secondary=false) const
Creates a command buffer that can be used to allocate commands on the queue.
Definition rendering_api.hpp:8619
virtual void setDebugMarker(const String &label, const Vectors::ByteVector3 &color=DEFAULT_DEBUG_COLOR) const noexcept
Inserts a debug marker.
Definition rendering_api.hpp:8593
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:8635
UInt64 submit(Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers) const
Submits a set of command buffers with shared ownership and inserts a fence to wait for them.
Definition rendering_api.hpp:8667
virtual void endDebugRegion() const noexcept
Ends the current debug region.
Definition rendering_api.hpp:8583
void waitFor(const ICommandQueue &queue, UInt64 fence) const
Lets the command queue wait for a certain fence value to complete on another queue.
Definition rendering_api.hpp:8690
UInt64 submit(const SharedPtr< ICommandBuffer > &commandBuffer) const
Submits a single command buffer with shared ownership and inserts a fence to wait for it.
Definition rendering_api.hpp:8651
The interface for a compute pipeline.
Definition rendering_api.hpp:7611
IComputePipeline() noexcept=default
Describes a the layout of a single descriptor within a DescriptorSet.
Definition rendering_api.hpp:3993
IDescriptorLayout() noexcept=default
The interface for a descriptor set.
Definition rendering_api.hpp:5253
IDescriptorSet() noexcept=default
void update(UInt32 binding, const IImage &texture, UInt32 descriptor=0, UInt32 firstLevel=0, UInt32 levels=0, UInt32 firstLayer=0, UInt32 layers=0) const
Updates one or more texture descriptors within the current descriptor set.
Definition rendering_api.hpp:5298
void update(UInt32 binding, const IAccelerationStructure &accelerationStructure, UInt32 descriptor=0) const
Updates an acceleration structure within the current descriptor set.
Definition rendering_api.hpp:5318
void update(UInt32 binding, const ISampler &sampler, UInt32 descriptor=0) const
Updates one or more sampler descriptors within the current descriptor set.
Definition rendering_api.hpp:5308
The interface for a descriptor set layout.
Definition rendering_api.hpp:5406
virtual UInt32 space() const noexcept=0
Returns the space index of the descriptor set.
UniquePtr< IDescriptorSet > allocate(Generator< DescriptorBinding > bindings) const
Definition rendering_api.hpp:5529
UniquePtr< IDescriptorSet > allocate(UInt32 descriptors, Generator< DescriptorBinding > bindings) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:5557
IDescriptorSetLayout() noexcept=default
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:5625
Generator< UniquePtr< IDescriptorSet > > allocate(UInt32 descriptorSets, UInt32 descriptors, std::initializer_list< std::initializer_list< DescriptorBinding > > bindings={ }) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:5598
Generator< UniquePtr< IDescriptorSet > > allocate(UInt32 descriptorSets, std::function< Generator< DescriptorBinding >(UInt32)> bindingFactory) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:5586
UniquePtr< IDescriptorSet > allocate(Span< DescriptorBinding > bindings) const
Definition rendering_api.hpp:5524
virtual const IDescriptorLayout & descriptor(UInt32 binding) const =0
Returns the descriptor layout for the descriptor bound to the binding point provided with binding .
Generator< UniquePtr< IDescriptorSet > > allocate(UInt32 descriptorSets, std::initializer_list< std::initializer_list< DescriptorBinding > > bindings={ }) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:5568
Generator< UniquePtr< IDescriptorSet > > allocate(UInt32 descriptorSets, UInt32 descriptors, std::function< Generator< DescriptorBinding >(UInt32)> bindingFactory) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:5617
UniquePtr< IDescriptorSet > allocate(UInt32 descriptors, std::initializer_list< DescriptorBinding > bindings) const
Allocates a new descriptor set or returns an instance of an unused descriptor set.
Definition rendering_api.hpp:5541
UniquePtr< IDescriptorSet > allocate(UInt32 descriptors, Span< DescriptorBinding > bindings) const
Definition rendering_api.hpp:5546
Describes a chunk of device memory.
Definition rendering_api.hpp:4088
virtual UInt64 virtualAddress() const noexcept=0
Gets the address of the resource in GPU memory.
IDeviceMemory() noexcept=default
The interface for a frame buffer.
Definition rendering_api.hpp:7709
Event< ResizeEventArgs > resized
Invoked when the frame buffer gets resized.
Definition rendering_api.hpp:7775
void mapRenderTargets(Span< const RenderTarget > renderTargets)
Maps a set of render targets to the frame buffer images, using the names of the render targets to loo...
Definition rendering_api.hpp:7869
virtual void addImage(const String &name, Format format, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage)=0
Adds an image to the frame buffer.
void addImage(const RenderTarget &renderTarget, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage)
Adds an image for a render target to the frame buffer.
Definition rendering_api.hpp:8011
auto addImage(this TSelf &&self, StringView name, Format format, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage) -> TSelf &&
Adds an image to the frame buffer.
Definition rendering_api.hpp:7978
virtual void resize(const Size2d &renderArea)=0
Causes the frame buffer to be invalidated and recreated with a new size.
auto addImages(this TSelf &&self, Span< const RenderTarget > renderTargets, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage) -> TSelf &&
Adds multiple images for a set of render targets to the frame buffer.
Definition rendering_api.hpp:8047
virtual const Size2d & size() const noexcept=0
Returns the current size of the frame buffer.
virtual const IImage & operator[](StringView renderTargetName) const =0
Resolves a render target name and returns the image mapped to it.
void addImage(Format format, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage)
Adds an image to the frame buffer.
Definition rendering_api.hpp:7966
virtual const IImage & resolveImage(UInt64 hash) const =0
Resolves a render target name hash and returns the image mapped to it.
virtual const IImage & operator[](UInt32 index) const =0
Returns an image from the frame buffer.
virtual const IImage & image(const RenderTarget &renderTarget) const =0
Resolves a render target and returns the image mapped to it.
virtual const IImage & image(UInt32 index) const =0
Returns an image from the frame buffer.
virtual void unmapRenderTarget(const RenderTarget &renderTarget) noexcept=0
Removes a mapping between a render target and an image in the frame buffer.
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:7955
virtual const IImage & image(StringView renderTargetName) const =0
Resolves a render target name and returns the image mapped to it.
auto addImage(this TSelf &&self, StringView name, const RenderTarget &renderTarget, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage) -> TSelf &&
Adds an image for a render target to the frame buffer.
Definition rendering_api.hpp:8023
Enumerable< const IImage & > images() const
Returns all images contained by the frame buffer.
Definition rendering_api.hpp:7887
virtual void addImage(const String &name, const RenderTarget &renderTarget, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage)=0
Adds an image for a render target to the frame buffer.
Event< ReleasedEventArgs > released
Invoked when the frame buffer gets released.
Definition rendering_api.hpp:7786
auto addImage(this TSelf &&self, const RenderTarget &renderTarget, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::FrameBufferImage) -> TSelf &&
Adds an image for a render target to the frame buffer.
Definition rendering_api.hpp:8000
virtual const IImage & operator[](const RenderTarget &renderTarget) const =0
Resolves a render target and returns the image mapped to it.
Represents a physical graphics adapter.
Definition rendering_api.hpp:2648
IGraphicsAdapter() noexcept=default
The interface for a graphics device that.
Definition rendering_api.hpp:9164
SharedPtr< IFrameBuffer > makeFrameBuffer(const Size2d &renderArea) const
Creates a new frame buffer instance.
Definition rendering_api.hpp:9266
virtual double ticksPerMillisecond() const noexcept=0
Returns the number of GPU ticks per milliseconds.
IGraphicsDevice() noexcept=default
virtual MultiSamplingLevel maximumMultiSamplingLevel(Format format) const noexcept=0
Queries the device for the maximum supported number of multi-sampling levels.
SharedPtr< const ICommandQueue > createQueue(QueueType type, QueuePriority priority=QueuePriority::Normal)
Attempts to create a new queue that supports the combination of queue types specified by the type pa...
Definition rendering_api.hpp:9247
UniquePtr< IBarrier > makeBarrier(PipelineStage syncBefore, PipelineStage syncAfter) const
Creates a memory barrier instance.
Definition rendering_api.hpp:9257
virtual void wait() const =0
Waits until all queues allocated from the device have finished the work issued prior to this point.
void computeAccelerationStructureSizes(const ITopLevelAccelerationStructure &tlas, UInt64 &bufferSize, UInt64 &scratchSize, bool forUpdate=false) const
Computes the required amount of device memory for an ITopLevelAccelerationStructure.
Definition rendering_api.hpp:9330
SharedPtr< IFrameBuffer > makeFrameBuffer(StringView name, const Size2d &renderArea) const
Creates a new frame buffer instance.
Definition rendering_api.hpp:9276
The interface for a graphics factory.
Definition rendering_api.hpp:8716
SharedPtr< IVertexBuffer > createVertexBuffer(const String &name, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a vertex buffer, based on the layout
Definition rendering_api.hpp:8904
UniquePtr< IBottomLevelAccelerationStructure > createBottomLevelAccelerationStructure(AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a bottom-level acceleration structure.
Definition rendering_api.hpp:9066
SharedPtr< ISampler > 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
Creates a texture sampler.
Definition rendering_api.hpp:9034
SharedPtr< IIndexBuffer > createIndexBuffer(const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default) const
Creates an index buffer, based on the layout .
Definition rendering_api.hpp:8921
SharedPtr< IImage > createTexture(const String &name, Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default) const
Creates a texture.
Definition rendering_api.hpp:8980
SharedPtr< IBuffer > createBuffer(const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:8837
UniquePtr< ITopLevelAccelerationStructure > createTopLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a top-level acceleration structure.
Definition rendering_api.hpp:9107
SharedPtr< IBuffer > createBuffer(const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:8779
SharedPtr< IBuffer > createBuffer(const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:8853
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) const
Creates a series of textures.
Definition rendering_api.hpp:8995
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) const
Creates a texture.
Definition rendering_api.hpp:8959
SharedPtr< IBuffer > createBuffer(const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:8821
SharedPtr< IVertexBuffer > createVertexBuffer(const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a vertex buffer, based on the layout
Definition rendering_api.hpp:8886
SharedPtr< IBuffer > createBuffer(const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:8750
IGraphicsFactory() noexcept=default
SharedPtr< IIndexBuffer > createIndexBuffer(const String &name, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default) const
Creates an index buffer, based on the layout .
Definition rendering_api.hpp:8939
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:9053
SharedPtr< IBuffer > createBuffer(const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:8869
SharedPtr< IBuffer > createBuffer(const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:8793
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:9014
SharedPtr< IBuffer > createBuffer(const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer of type type .
Definition rendering_api.hpp:8807
SharedPtr< IBuffer > createBuffer(const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:8764
UniquePtr< IBottomLevelAccelerationStructure > createBottomLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a bottom-level acceleration structure.
Definition rendering_api.hpp:9080
UniquePtr< ITopLevelAccelerationStructure > createTopLevelAccelerationStructure(AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a top-level acceleration structure.
Definition rendering_api.hpp:9093
Describes a generic image.
Definition rendering_api.hpp:4208
virtual void resolveSubresource(UInt32 subresource, UInt32 &plane, UInt32 &layer, UInt32 &level) const noexcept
Returns the plane , layer and level for the provided subresource .
Definition rendering_api.hpp:4312
IImage() noexcept=default
The interface for an index buffer.
Definition rendering_api.hpp:4425
IIndexBuffer() noexcept=default
Describes a index buffer layout.
Definition rendering_api.hpp:3952
IIndexBufferLayout() noexcept=default
Allows for data to be mapped into the object.
Definition rendering_api.hpp:4038
IMappable() noexcept=default
The interface for a pipeline.
Definition rendering_api.hpp:6481
IPipeline() noexcept=default
SharedPtr< const IPipelineLayout > layout() const noexcept
Returns the layout of the render pipeline.
Definition rendering_api.hpp:6505
The interface for a pipeline layout.
Definition rendering_api.hpp:6385
IPipelineLayout() noexcept=default
virtual const IPushConstantsLayout * pushConstants() const noexcept=0
Returns the push constants layout, or nullptr, if the pipeline does not use any push constants.
The interface for a push constants layout.
Definition rendering_api.hpp:5693
IPushConstantsLayout() noexcept=default
Describes a range within a IPushConstantsLayout.
Definition rendering_api.hpp:5645
IPushConstantsRange() noexcept=default
Represents the rasterizer state of a RenderPipeline.
Definition rendering_api.hpp:3321
IRasterizer() noexcept=default
The interface for a ray tracing pipeline.
Definition rendering_api.hpp:7626
IRayTracingPipeline() noexcept=default
The interface to access a render backend.
Definition rendering_api.hpp:9358
virtual const IGraphicsDevice * 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_api.hpp:9410
virtual IGraphicsDevice * 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 IGraphicsAdapter * findAdapter(const Optional< UInt64 > &adapterId=std::nullopt) const noexcept=0
Finds an adapter using its unique ID.
virtual IGraphicsDevice * 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_api.hpp:9419
virtual const IGraphicsDevice * 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...
IRenderBackend() noexcept=default
The interface for a render pass.
Definition rendering_api.hpp:8065
SharedPtr< const ICommandBuffer > commandBuffer(UInt32 index) const
Returns a command buffer that can be currently used for recording multi-threaded commands in the rend...
Definition rendering_api.hpp:8166
const ICommandQueue & commandQueue() const noexcept
Returns the command queue, the render pass is executing on or nullptr, if the queue has already been ...
Definition rendering_api.hpp:8142
Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers() const
Returns all command buffers, that can be currently used for recording multi-threaded commands in the ...
Definition rendering_api.hpp:8154
IRenderPass() noexcept=default
virtual UInt64 end() const =0
Ends the render pass.
virtual UInt32 secondaryCommandBuffers() const noexcept=0
Returns the number of secondary command buffers the render pass stores for multi-threaded command rec...
The interface for a render pipeline.
Definition rendering_api.hpp:7541
SharedPtr< IRasterizer > rasterizer() const noexcept
Returns the rasterizer state used by the render pipeline.
Definition rendering_api.hpp:7565
IRenderPipeline() noexcept=default
virtual bool alphaToCoverage() const noexcept=0
Returns true, if the pipeline uses Alpha-to-Coverage multi-sampling.
Represents a render target, i.e. an abstract view of the output of an RenderPass.
Definition rendering_api.hpp:2819
IRenderTarget() noexcept=default
Describes a texture sampler.
Definition rendering_api.hpp:4324
ISampler() noexcept=default
The interface of a scissor.
Definition rendering_api.hpp:3562
IScissor() noexcept=default
Represents a single shader module, i.e. a part of a IShaderProgram.
Definition rendering_api.hpp:2755
IShaderModule() noexcept=default
The interface for a shader program.
Definition rendering_api.hpp:6286
Enumerable< const IShaderModule & > modules() const
Returns the modules, the shader program is build from.
Definition rendering_api.hpp:6337
ShaderRecordCollection buildShaderRecordCollection() const noexcept
Builds a shader record collection based on the current shader program.
Definition rendering_api.hpp:6373
IShaderProgram() noexcept=default
SharedPtr< IPipelineLayout > reflectPipelineLayout() const
Uses shader reflection to extract the pipeline layout of a shader. May not be available in all backen...
Definition rendering_api.hpp:6365
bool contains(StringView name) const
Returns true, if the program contains a shader module with the provided name or file name and false o...
Definition rendering_api.hpp:6318
bool contains(const IShaderModule &module) const
Returns true, if the program contains the provided shader module and false otherwise.
Definition rendering_api.hpp:6328
The interface for a state resource.
Definition rendering_api.hpp:2240
IStateResource() noexcept=default
Represents a surface to render to.
Definition rendering_api.hpp:2720
ISurface() noexcept=default
Interface for a swap chain.
Definition rendering_api.hpp:8250
virtual SharedPtr< const TimingEvent > timingEvent(UInt32 queryId) const =0
Returns the timing event registered for queryId .
virtual const IGraphicsDevice & device() const =0
Returns the swap chain's parent device instance.
virtual UInt32 swapBackBuffer() const =0
Swaps the front buffer with the next back buffer in order.
virtual UInt32 resolveQueryId(SharedPtr< const TimingEvent > timingEvent) const =0
Returns the query ID for the timing event.
virtual void reset(Format surfaceFormat, const Size2d &renderArea, UInt32 buffers, bool enableVsync=false)=0
Causes the swap chain to be re-created. All frame and command buffers will be invalidated and rebuilt...
Event< ResetEventArgs > reseted
Invoked, after the swap chain has been reseted.
Definition rendering_api.hpp:8440
virtual Enumerable< Format > getSurfaceFormats() const =0
Returns an array of supported formats, that can be drawn to the surface.
ISwapChain() noexcept=default
virtual Format surfaceFormat() const noexcept=0
Returns the swap chain image format.
Event< EventArgs > swapped
Invoked, when the swap chain has swapped the back buffers.
Definition rendering_api.hpp:8434
virtual void present(UInt64 fence) const =0
Queues a present that gets executed after fence has been signaled on the default graphics queue.
virtual const Array< SharedPtr< const TimingEvent > > & timingEvents() const =0
Returns all registered timing events.
virtual UInt64 readTimingEvent(SharedPtr< const TimingEvent > timingEvent) const =0
Reads the current time stamp value (in ticks) of a timing event.
A structure that stores the instance data for a IBottomLevelAccelerationStructure.
Definition rendering_api.hpp:4870
void addInstance(const SharedPtr< const IBottomLevelAccelerationStructure > &blas, const TMatrix3x4< Float > &transform, UInt32 id, UInt32 hitGroupOffset=0, Byte mask=0xFF, InstanceFlags flags=InstanceFlags::None) noexcept
Adds an instance to the TLAS.
Definition rendering_api.hpp:4966
auto withInstance(this TSelf &&self, const SharedPtr< const IBottomLevelAccelerationStructure > &blas, const TMatrix3x4< Float > &transform, UInt32 id, UInt32 hitGroupOffset=0, Byte mask=0xFF, InstanceFlags flags=InstanceFlags::None) noexcept -> TSelf &&
Adds an instance to the current TLAS.
Definition rendering_api.hpp:5058
ITopLevelAccelerationStructure() noexcept=default
auto withInstance(this TSelf &&self, const Instance &instance) noexcept -> TSelf &&
Adds an instance to the current TLAS.
Definition rendering_api.hpp:5027
auto withInstance(this TSelf &&self, const SharedPtr< const IBottomLevelAccelerationStructure > &blas, UInt32 id, UInt32 hitGroupOffset=0, Byte mask=0xFF, InstanceFlags flags=InstanceFlags::None) noexcept -> TSelf &&
Adds an instance to the current TLAS.
Definition rendering_api.hpp:5042
virtual void clear() noexcept=0
Clears all instances from the acceleration structure.
The interface for a vertex buffer.
Definition rendering_api.hpp:4403
IVertexBuffer() noexcept=default
Describes a vertex buffer layout.
Definition rendering_api.hpp:3929
IVertexBufferLayout() noexcept=default
Interface for a viewport.
Definition rendering_api.hpp:3444
IViewport() noexcept=default
Describes an index buffer.
Definition rendering.hpp:479
Implements a IRasterizer.
Definition rendering_api.hpp:3371
Rasterizer & operator=(const Rasterizer &_other)
Assigns a rasterizer by copying it.
Rasterizer(Rasterizer &&_other) noexcept
Takes over another instance of a rasterizer.
Rasterizer & operator=(Rasterizer &&_other) noexcept
Assigns a rasterizer by taking it over.
Rasterizer(const Rasterizer &_other)
Creates a copy of a rasterizer.
~Rasterizer() noexcept override
Releases the rasterizer instance.
Represents a ray-tracing Pipeline.
Definition rendering.hpp:1020
Represents a mapping between a set of RenderTarget instances and the input attachments of a IRenderPa...
Definition rendering_api.hpp:3076
RenderPassDependency & operator=(RenderPassDependency &&_other) noexcept
Assigns another render pass dependency by taking it over.
RenderPassDependency(RenderPassDependency &&_other) noexcept
Takes over another render pass dependency instance.
RenderPassDependency & operator=(const RenderPassDependency &_other)
Assigns another render pass dependency instance by copying it.
~RenderPassDependency() noexcept
Releases the current render pass dependency instance.
RenderPassDependency(const RenderPassDependency &_other)
Creates a copy of another render pass dependency.
Implements a render target.
Definition rendering_api.hpp:2976
RenderTarget & operator=(RenderTarget &&_other) noexcept
Assigns a render target by taking it over.
RenderTarget(const RenderTarget &_other)
Creates a copy of a render target.
RenderTarget(RenderTarget &&_other) noexcept
Takes over another instance of a render target.
~RenderTarget() noexcept override
Releases the render target instance.
const String & name() const noexcept override
Returns the name of the render target.The name of the render target.
Definition render_target.cpp:55
RenderTarget & operator=(const RenderTarget &_other)
Assigns a render target by copying it.
Implements a scissor.
Definition rendering_api.hpp:3590
Scissor(const Scissor &_other)
Creates a copy of a scissor.
~Scissor() noexcept override
Releases the scissor instance.
Scissor & operator=(const Scissor &_other)
Assigns a scissor by copying it.
Scissor & operator=(Scissor &&_other) noexcept
Assigns a scissor by taking it over.
Scissor(Scissor &&_other) noexcept
Takes over another instance of a scissor.
Stores a set of IShaderRecords in that later form a shader binding table used for ray-tracing.
Definition rendering_api.hpp:6007
void addShaderRecord(const ShaderRecord<>::shader_group_type &shaderGroup)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:6152
void addShaderRecord(StringView shaderName, TLocalData payload)
Adds a new shader record based on the name of a shader module in the parent shader program.
Definition rendering_api.hpp:6101
ShaderRecordCollection && withShaderRecord(StringView shaderName)
Adds a new shader record based on the name of a shader module in the parent shader program.
Definition rendering_api.hpp:6176
void addMeshGeometryShaderHitGroupRecord(std::optional< StringView > anyHitShaderName, std::optional< StringView > closestHitShaderName, TLocalData payload)
Adds a new mesh geometry hit group record based on names of the shader modules.
Definition rendering_api.hpp:6139
void addMeshGeometryShaderHitGroupRecord(std::optional< StringView > anyHitShaderName, std::optional< StringView > closestHitShaderName)
Adds a new mesh geometry hit group record based on names of the shader modules.
Definition rendering_api.hpp:6121
ShaderRecordCollection && withShaderRecord(StringView shaderName, TLocalData payload)
Adds a new shader record based on the name of a shader module in the parent shader program.
Definition rendering_api.hpp:6193
ShaderRecordCollection && withMeshGeometryHitGroupRecord(std::optional< StringView > anyHitShaderName, std::optional< StringView > closestHitShaderName, TLocalData payload)
Adds a new mesh geometry hit group record based on names of the shader modules.
Definition rendering_api.hpp:6218
ShaderRecordCollection(ShaderRecordCollection &&) noexcept=default
ShaderRecordCollection && withMeshGeometryHitGroupRecord(std::optional< StringView > anyHitShaderName, std::optional< StringView > closestHitShaderName)
Adds a new mesh geometry hit group record based on names of the shader modules.
Definition rendering_api.hpp:6204
void addShaderRecord(ShaderRecord< TLocalData >::shader_group_type shaderGroup, TLocalData payload)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:6163
ShaderRecordCollection && withShaderRecord(ShaderRecord< TLocalData >::shader_group_type shaderGroup, TLocalData payload)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:6241
ShaderRecordCollection()=delete
ShaderRecordCollection && withShaderRecord(ShaderRecord<>::shader_group_type shaderGroup)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:6228
Base class for a resource that can be identified by a name string within a DeviceState.
Definition rendering_api.hpp:2265
StateResource(StateResource &&) noexcept
An event that is used to measure timestamps in a command queue.
Definition rendering_api.hpp:3726
~TimingEvent() noexcept override
Releases the render target instance.
Describes a vertex buffer.
Definition rendering.hpp:455
Implements a viewport.
Definition rendering_api.hpp:3496
Viewport & operator=(const Viewport &_other)
Assigns a viewport by copying it.
Viewport(Viewport &&_other) noexcept
Takes over another instance of a viewport.
Viewport & operator=(Viewport &&_other) noexcept
Assigns a viewport by taking it over.
Viewport(const Viewport &_other)
Creates a copy of a viewport.
~Viewport() noexcept override
Releases the render target instance.
Implements the IResource interface.
Definition containers.hpp:823
Base class for an object that can be shared.
Definition containers.hpp:1075
Definition rasterizer.cpp:9
Definition render_pass_dependency.cpp:9
Definition render_target.cpp:9
Definition state_resource.cpp:9
Definition timing_event.cpp:9
Definition viewport.cpp:9
Concept that can be used to refer to render backend implementations.
Definition rendering_api.hpp:9431
uint16_t UInt16
A type for an unsigned 16 bit integer.
Definition math.hpp:46
uint64_t UInt64
A type for an unsigned 64 bit integer.
Definition math.hpp:66
float_t Float
A type for a floating point value with single precision.
Definition math.hpp:71
uint32_t UInt32
A type for an unsigned 32 bit integer.
Definition math.hpp:56
uint8_t Byte
A type for an unsigned 8 bit integer.
Definition math.hpp:36
int32_t Int32
A type for a signed 32 bit integer.
Definition math.hpp:51
BorderMode
Describes how to treat texture coordinates that are outside the domain [0..1].
Definition rendering_api.hpp:1184
@ RepeatMirrored
Mirror the texture.
@ Repeat
Repeat the texture.
@ ClampToEdge
Take the closest edge texel.
@ ClampToEdgeMirrored
Take the closest edge texel from the opposite site.
@ ClampToBorder
Return a pre-specified border color.
CullOrder
Describes the order or vertex winding, that is used to determine, whether a polygon is facing towards...
Definition rendering_api.hpp:1018
@ CounterClockWise
Vertices are evaluated in a counter clock-wise manner.
@ ClockWise
Vertices are evaluated in a clock-wise manner.
RenderTargetFlags
Describes the behavior of render targets.
Definition rendering_api.hpp:1056
@ Volatile
If enabled, the render target is discarded after ending the render pass.
@ ClearStencil
If enabled and the render target format supports stencil storage, the stencil part is cleared when th...
@ Clear
If enabled, color or depth (depending on the render target type) are cleared when starting a render p...
ImageLayout
Specifies the layout of an IImage resource.
Definition rendering_api.hpp:1686
@ ResolveSource
Indicates that the image is resolved from a multi-sampled image.
@ ResolveDestination
Indicates that the image is a render-target that a multi-sampled image is resolved into.
@ CopyDestination
Allows the image to be used as a destination for transfer operations.
@ DepthRead
Indicates that image is used as a read-only depth/stencil target.
@ ReadWrite
Indicates that the image is used as a read-write storage or texel buffer.
@ DepthWrite
Indicates that the image is used as a write-only depth/stencil target.
@ ShaderResource
Indicates that the image is used as a read-only storage or texel buffer.
@ Undefined
The layout of the image is not known by the engine.
@ CopySource
Allows the image to be used as a source for transfer operations.
MipMapMode
Describes the filter operation between two mip-map levels.
Definition rendering_api.hpp:1169
BlendFactor
Specifies a blend factor.
Definition rendering_api.hpp:1307
@ OneMinusDestinationColor
@ OneMinusDestinationAlpha
CullMode
Describes which faces are culled by the Rasterizer stage.
Definition rendering_api.hpp:991
@ FrontFaces
The rasterizer will discard front-facing polygons.
@ Both
The rasterizer will discard front and back-facing polygons.
@ Disabled
The rasterizer will not discard any polygons.
@ BackFaces
The rasterizer will discard back-facing polygons.
ShaderStage
Describes the valid shader stages of a graphics pipeline.
Definition rendering_api.hpp:799
@ Fragment
Represents the fragment or pixel shader stage.
@ MeshPipeline
Represents the complete mesh shading pipeline.
@ Mesh
Represents the mesh shader stage.
@ Callable
Represents the callable shader stage.
@ TessellationEvaluation
Represents the tessellation evaluation or domain shader stage.
@ TessellationControl
Represents the tessellation control or hull shader stage.
@ Intersection
Represents the intersection shader stage.
@ RasterizationPipeline
Represents the complete rasterization pipeline.
@ RayGeneration
Represents the ray generation shader stage.
@ ClosestHit
Represents the closest-hit shader stage.
@ Geometry
Represents the geometry shader stage.
@ Miss
Represents the miss shader stage.
@ Task
Represents the task or amplification shader stage.
@ Any
Enables all supported shader stages.
@ AnyHit
Represents the any-hit shader stage.
RenderTargetType
Describes the type of a render target.
Definition rendering_api.hpp:1033
@ DepthStencil
Represents a depth/stencil target.
@ Present
Represents a color target that should be presented.
constexpr UInt32 getBufferFormatChannelSize(BufferFormat format)
Returns the number of bytes used by a channel of a buffer format.
Definition rendering_api.hpp:1927
GraphicsAdapterType
Defines different types of graphics adapters.
Definition rendering_api.hpp:75
@ CPU
The adapter is a software driver.
@ GPU
The adapter is a dedicated GPU or integrated CPU adapter.
CompareOperation
Describes the operation used to compare depth or stencil values during depth/stencil tests.
Definition rendering_api.hpp:1215
@ NotEqual
The test succeeds, if the current value is not equal to the stencil ref or previous depth value.
@ Less
The test succeeds, if the current value is less than the stencil ref or previous depth value.
@ Always
The test always succeeds.
@ Never
The test always fails.
@ GreaterEqual
The test succeeds, if the current value is greater or equal to the stencil ref or previous depth valu...
@ Greater
The test succeeds, if the current value is greater than the stencil ref or previous depth value.
@ LessEqual
The test succeeds, if the current value is less or equal to the stencil ref or previous depth value.
@ Equal
The test succeeds, if the current value is equal to the stencil ref or previous depth value.
BlendOperation
Specifies a blend operation.
Definition rendering_api.hpp:1359
IndexType
Describes the element type of an index buffer.
Definition rendering_api.hpp:750
PrimitiveTopology
Describes the topology of a mesh primitive.
Definition rendering_api.hpp:765
@ PointList
A list of points where each vertex refers to an individual point.
@ TriangleStrip
A strip of triangles, where each vertex (except the first two) refers to the third vertex of the next...
@ LineList
A list of lines where each vertex pair refers to the start and end points of a line.
@ LineStrip
A strip of lines where each vertex (except the first one) refers to the end point for the next line s...
@ TriangleList
A list of triangles, where each triplet of vertices refers to a whole triangle.
ShaderBindingGroup
Describes a group or combination of groups of a shader binding table.
Definition rendering_api.hpp:939
@ All
Refers to a combination of all possible groups that can be stored in a shader binding table.
PolygonMode
Describes the draw mode for polygons.
Definition rendering_api.hpp:970
@ Point
Polygons are drawn as points at the vertex positions.
@ Wireframe
Polygons are only drawn as wire-frames.
@ Solid
Polygons are drawn as solid surfaces.
BufferType
Describes the type of a IBuffer.
Definition rendering_api.hpp:540
@ Indirect
Describes a buffer that stores data to generate indirect draw calls.
@ ShaderBindingTable
Describes a shader binding table for ray-tracing.
@ Index
Describes an index buffer.
@ Storage
Describes a shader storage buffer object (Vulkan) or unordered access view (DirectX).
@ Texel
Describes a shader texel storage buffer object (Vulkan) or unordered access view (DirectX).
@ Uniform
Describes an uniform buffer object (Vulkan) or constant buffer view (DirectX).
InstanceFlags
Controls how an instance within a ITopLevelAccelerationStructure behaves during ray-tracing.
Definition rendering_api.hpp:1857
@ DisableCull
If this flag is set front- and backface culling is disabled for the instance.
@ ForceNonOpaque
If this flag is set, each geometry of the instance will ignore the GeometryFlags::Opaquesetting.
@ ForceOpaque
If this flag is set, no geometry of the instance invokes the any-hit shader. This overwrites per-geom...
@ FlipWinding
If this flag is set, front- and backfaces flip their default cull order.
AttributeSemantic
Describes the semantic of a buffer attribute.
Definition rendering_api.hpp:371
@ BlendIndices
The attribute contains blend indices.
@ PointSize
The attribute contains a point size.
@ Binormal
The attribute contains a bi-normal vector.
@ Position
The attribute contains a position vector.
@ Tangent
The attribute contains a tangent vector.
@ BlendWeight
The attribute contains blend weights.
@ Unknown
The attribute is a generic, unknown semantic.
@ TransformedPosition
The attribute contains a pre-transformed position vector.
@ Color
The attribute contains a color value.
@ TextureCoordinate
The attribute contains a texture coordinate.
constexpr UInt32 getBufferFormatType(BufferFormat format)
Returns the underlying data type of a buffer format.
Definition rendering_api.hpp:1935
ResourceUsage
Describes the intended usage for a resource.
Definition rendering_api.hpp:690
@ FrameBufferImage
Default usage for frame buffer images.
@ Default
Shortcut for commonly used TransferSource | TransferDestination combination.
@ TransferSource
Allows the resource data to be copied into another resource.
@ RenderTarget
Allows the resource to be used as a render target.
@ TransferDestination
Allows the resource data to be copied from another resource.
@ AccelerationStructureBuildInput
Allows the resource to be used to build acceleration structures.
@ AllowWrite
Allows the resource to be written to.
GeometryFlags
Controls how a geometry that is part of a bottom-level acceleration structure (BLAS) behaves during r...
Definition rendering_api.hpp:1794
@ OneShotAnyHit
If this flag is set, the any-hit shader for this geometry is only invoked once for each primitive of ...
@ Opaque
If this flag is set, the any-hit shader for this geometry is never invoked, even if it is present wit...
ImageDimensions
Describes the dimensions of a image resource, i.e. the dimensions that are required to access a texel...
Definition rendering_api.hpp:1086
@ DIM_1
Represents a 1D image.
@ DIM_2
Represents a 2D image.
@ DIM_3
Represents a 3D image.
@ CUBE
Represents a set of six 2D images that are used to build a cube map.
constexpr bool hasDepth(Format format) noexcept
Returns true, if the format contains a depth channel.
Definition rendering_api.hpp:2112
DescriptorType
Describes the type of a IDescriptor.
Definition rendering_api.hpp:436
@ RWStructuredBuffer
A writable shader storage object in Vulkan. Maps to a read/write structured buffer in DirectX.
@ InputAttachment
The result of a render target from an earlier render pass. Maps to a SubpassInput in HLSL.
@ AccelerationStructure
Represents a ray-tracing acceleration structure.
@ Sampler
A sampler state of a texture or image.
@ ByteAddressBuffer
Represents an unformatted buffer.
@ RWByteAddressBuffer
Represents an unformatted writable buffer.
@ Buffer
Represents a read-only texel buffer (uniform texel buffer).
@ RWTexture
A writable image.
@ RWBuffer
Represents a writable texel buffer (storage texel buffer).
@ Texture
A read-only sampled image.
@ StructuredBuffer
A shader storage buffer object in Vulkan. Maps to a structured buffer in DirectX.
@ ConstantBuffer
A uniform buffer in Vulkan. Maps to a constant buffer in DirectX.
QueuePriority
Specifies the priority with which a queue is scheduled on the GPU.
Definition rendering_api.hpp:159
@ High
A high queue priority.
@ Normal
The default queue priority.
@ Realtime
The highest possible queue priority. Submitting work to this queue might block other queues.
QueueType
Represents the type of a CommandQueue.
Definition rendering_api.hpp:113
@ VideoDecode
Represents a queue that can perform hardware video decoding.
@ Transfer
Represents a queue that can execute only transfer workloads.
@ Compute
Represents a queue that can execute compute and transfer workloads.
@ VideoEncode
Represents a queue that can perform hardware video encoding.
@ Graphics
Represents a queue that can execute graphics, compute and transfer workloads.
ResourceHeap
Defines where a resource (buffer or image) memory is located and from where it can be accessed.
Definition rendering_api.hpp:649
@ Staging
Creates a resource that can be mapped from the CPU in order to be transferred to the GPU later.
@ Dynamic
Creates a resource that can be mapped from the CPU and read by the GPU.
@ Readback
Creates a buffer that can be written on the GPU and read by the CPU.
StencilOperation
An operation that is applied to the stencil buffer.
Definition rendering_api.hpp:1261
@ Keep
Keep the current stencil value.
@ Replace
Replace the current stencil value with the stencil ref.
@ IncrementClamp
Increment the current stencil value.
@ DecrementClamp
Decrement the current stencil value.
@ DecrementWrap
Decrement the current stencil value and wrap it, if it goes out of bounds.
@ Invert
Bitwise invert the current stencil value.
@ IncrementWrap
Increment the current stencil value and wrap it, if it goes out of bounds.
@ Zero
Set the stencil value to 0.
AccelerationStructureFlags
Controls how an acceleration structure should be built.
Definition rendering_api.hpp:1816
@ MinimizeMemory
Prefer to minimize the memory footprint of the acceleration structure, but at the cost of ray-tracing...
@ PreferFastBuild
Prefer fast build times for the acceleration structure, but sacrifice ray-tracing performance.
@ AllowCompaction
Allow the acceleration structure to be compacted.
@ PreferFastTrace
Prefer building a better performing acceleration structure, that possibly takes longer to build.
@ AllowUpdate
Allow the acceleration structure to be updated.
struct LITEFX_RENDERING_API alignas(16) IndirectBatch
An indirect batch used to execute an standard draw call.
Definition rendering_api.hpp:2149
FilterMode
Describes the filter operation when accessing a pixel from a texture coordinate.
Definition rendering_api.hpp:1152
@ Linear
Linearly interpolate between the two closest texels with respect to the texture coordinate.
@ Nearest
Take the nearest texel with respect to the texture coordinate.
const size_t SHADER_RECORD_LOCAL_DATA_ALIGNMENT
The size (in bytes) to which shader record local data must be aligned.
Definition rendering_api.hpp:5847
ShaderRecordType
Describes the type of a shader module record within a shader collection or shader binting table.
Definition rendering_api.hpp:903
@ HitGroup
Represents a hit group shader record.
PipelineStage
Defines pipeline stages as points where synchronization may occur.
Definition rendering_api.hpp:1373
@ Resolve
Waits for previous commands to finish the multi-sampling resolution stage, or blocks following comman...
@ Raytracing
Waits for the previous commands to finish ray-tracing shader stages, or blocks the following commands...
@ Draw
Waits for previous commands to finish all graphics stages, or blocks following commands until the gra...
@ InputAssembly
Waits for previous commands to finish the input assembly stage, or blocks following commands until th...
@ AccelerationStructureCopy
Waits for previous commands to finish the copying stage for an acceleration structure,...
@ AccelerationStructureBuild
Waits for previous commands to finish the building stage for an acceleration structure,...
BufferFormat
Describes a buffer attribute format.
Definition rendering_api.hpp:339
constexpr bool hasStencil(Format format) noexcept
Returns true, if the format contains a stencil channel.
Definition rendering_api.hpp:2129
constexpr UInt32 getBufferFormatChannels(BufferFormat format)
Returns the number of channels for a buffer format.
Definition rendering_api.hpp:1919
constexpr size_t getSize(Format format)
Returns the size of an element of a specified format.
Definition rendering_api.hpp:1942
ResourceAccess
Defines how a IBuffer or IImage resource is accessed.
Definition rendering_api.hpp:1537
@ ResolveWrite
Indicates that a resource is accessed as to write during a resolve operation.
@ ResolveRead
Indicates that a resource is accessed as to read during a resolve operation.
@ AccelerationStructureRead
Indicates that a resources is accessed to read an acceleration structure.
@ ShaderRead
Indicates that a resource is accessed as a read-only shader resource.
@ UniformBuffer
Indicates that a resource is accessed as an uniform/constant buffer.
@ DepthStencilRead
Indicates that a resource is accessed as to read depth/stencil values.
@ DepthStencilWrite
Indicates that a resource is accessed as to write depth/stencil values.
@ TransferRead
Indicates that a resource is accessed as to read during a transfer operation.
@ AccelerationStructureWrite
Indicates that a resources is accessed to write an acceleration structure.
@ ShaderReadWrite
Indicates that a resource is accessed as a read-write shader resource.
@ Common
Indicates that a resource can be accessed in any way, compatible to the layout.
@ TransferWrite
Indicates that a resource is accessed as to write during a transfer operation.
WriteMask
Specifies a write mask for a color buffer.
Definition rendering_api.hpp:1333
@ A
Write into the alpha channel.
@ B
Write into the blue channel.
@ G
Write into the green channel.
@ R
Write into the red channel.
Format
Describes a texel format.
Definition rendering_api.hpp:182
MultiSamplingLevel
Describes the number of samples with which a IImage is sampled.
Definition rendering_api.hpp:1111
@ x32
Use 32 samples per pixel.
@ x16
Use 16 samples per pixel.
@ x1
The default number of samples. Multi-sampling will be deactivated, if this sampling level is used.
@ x2
Use 2 samples per pixel.
@ x64
Use 64 samples per pixel.
@ x4
Use 4 samples per pixel.
@ x8
Use 8 samples per pixel.
std::generator< T, TVal > Generator
Describes an intermediate container for elements of type T .
Definition containers.hpp:206
std::reference_wrapper< T > Ref
Represents a copyable and assignable reference wrapper.
Definition containers.hpp:145
constexpr UniquePtr< T > makeUnique()
Creates a new unique pointer.
Definition containers.hpp:153
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
std::variant< T... > Variant
Represents a variant of objects.
Definition containers.hpp:130
An input range over another range, where the returned values of type T are covariants of the values ...
Definition containers.hpp:529
An algebraic matrix type.
Definition matrix.hpp:39
An algebraic vector type.
Definition vector.hpp:23
constexpr scalar_type x() const noexcept
Returns the value of the x component of the vector.
Definition vector.hpp:252
constexpr scalar_type z() const noexcept
Returns the value of the z component of the vector.
Definition vector.hpp:284
constexpr scalar_type y() const noexcept
Returns the value of the y component of the vector.
Definition vector.hpp:268
Describes the rasterizer depth bias.
Definition rendering_api.hpp:3177
Describes the rasterizer depth state.
Definition rendering_api.hpp:3150
Describes the rasterizer stencil state.
Definition rendering_api.hpp:3229
Describes a stencil test for either front or back faces.
Definition rendering_api.hpp:3203
Describes a resource binding to a descriptor or descriptor set.
Definition rendering_api.hpp:5334
Variant< std::monostate, Ref< const IBuffer >, Ref< const IImage >, Ref< const ISampler >, Ref< const IAccelerationStructure > > resource_container
Definition rendering_api.hpp:5336
Describes a single descriptor binding point within a IShaderModule.
Definition rendering_api.hpp:2735
Describes optional features that can be supported by a device.
Definition rendering_api.hpp:9138
Stores a buffer that contains axis-aligned bounding boxes.
Definition rendering_api.hpp:4670
GeometryFlags Flags
The flags that control how the primitives in the geometry behaves during ray-tracing.
Definition rendering_api.hpp:4692
SharedPtr< const IBuffer > Buffer
A buffer containing the bounding box definitions.
Definition rendering_api.hpp:4687
Represents a triangle mesh.
Definition rendering_api.hpp:4593
TriangleMesh(const TriangleMesh &other)=default
Initializes a new triangle mesh by copying another one.
TriangleMesh(const SharedPtr< const IVertexBuffer > &vertexBuffer, const SharedPtr< const IIndexBuffer > &indexBuffer=nullptr, const SharedPtr< const IBuffer > &transformBuffer=nullptr, GeometryFlags flags=GeometryFlags::None)
Initializes a new triangle mesh.
Definition rendering_api.hpp:4602
~TriangleMesh() noexcept=default
Releases the triangle mesh.
TriangleMesh & operator=(TriangleMesh &&other) noexcept=default
Takes over another triangle mesh.
TriangleMesh(TriangleMesh &&other) noexcept=default
Initializes a new triangle mesh by taking over another one.
TriangleMesh & operator=(const TriangleMesh &other)=default
Copies another triangle mesh.
Event arguments for a ICommandQueue::submitted event.
Definition rendering_api.hpp:8513
QueueSubmittedEventArgs(QueueSubmittedEventArgs &&) noexcept=default
QueueSubmittedEventArgs(UInt64 fence) noexcept
Definition rendering_api.hpp:8518
QueueSubmittedEventArgs(const QueueSubmittedEventArgs &)=default
Event arguments for a ICommandQueue::submitting event.
Definition rendering_api.hpp:8486
QueueSubmittingEventArgs(QueueSubmittingEventArgs &&) noexcept=default
QueueSubmittingEventArgs(Array< SharedPtr< const ICommandBuffer > > &&commandBuffers)
Definition rendering_api.hpp:8491
QueueSubmittingEventArgs(const QueueSubmittingEventArgs &)=default
Event arguments that are published to subscribers when a frame buffer gets released.
Definition rendering_api.hpp:7744
ReleasedEventArgs(ReleasedEventArgs &&) noexcept=default
ReleasedEventArgs() noexcept
Definition rendering_api.hpp:7746
ReleasedEventArgs(const ReleasedEventArgs &)=default
Event arguments that are published to subscribers when a frame buffer gets resized.
Definition rendering_api.hpp:7716
ResizeEventArgs(Size2d newSize) noexcept
Definition rendering_api.hpp:7721
ResizeEventArgs(ResizeEventArgs &&) noexcept=default
ResizeEventArgs(const ResizeEventArgs &)=default
Event arguments that are published to subscribers when a render pass is beginning.
Definition rendering_api.hpp:8071
BeginEventArgs(const IFrameBuffer &frameBuffer) noexcept
Definition rendering_api.hpp:8076
BeginEventArgs(BeginEventArgs &&) noexcept=default
BeginEventArgs(const BeginEventArgs &)=default
Describes the blend state of the render target.
Definition rendering_api.hpp:2824
Describes a hit group for a triangle mesh geometry.
Definition rendering_api.hpp:5756
const IShaderModule * AnyHitShader
The any hit shader for the triangle mesh.
Definition rendering_api.hpp:5765
const IShaderModule * ClosestHitShader
The closest hit shader for the triangle mesh.
Definition rendering_api.hpp:5760
Describes a record within a shader binding table.
Definition rendering_api.hpp:5746
virtual constexpr const shader_group_type & shaderGroup() const noexcept=0
Returns the shader group containing the modules for this record.
IShaderRecord() noexcept=default
Variant< const IShaderModule *, MeshGeometryHitGroup > shader_group_type
Defines the type that stores the shaders of the shader group.
Definition rendering_api.hpp:5771
Event arguments for a ISwapChain::reseted event.
Definition rendering_api.hpp:8255
ResetEventArgs(const ResetEventArgs &)=default
const Size2d & renderArea() const noexcept
Gets the new render area of the swap chain back-buffers.
Definition rendering_api.hpp:8284
ResetEventArgs(Format surfaceFormat, Size2d renderArea, UInt32 buffers, bool enableVsync) noexcept
Definition rendering_api.hpp:8263
ResetEventArgs(ResetEventArgs &&) noexcept=default
UInt32 buffers() const noexcept
Gets the number of back-buffers in the swap chain.
Definition rendering_api.hpp:8292
bool enableVsync() const noexcept
Returns true if vertical synchronization is enabled or false otherwise.
Definition rendering_api.hpp:8300
Represents an instance of an IBottomLevelAccelerationStructure.
Definition rendering_api.hpp:4877
UInt32 HitGroupOffset
An offset added to the address of the shader-local data of the shader record that is invoked for the ...
Definition rendering_api.hpp:4912
UInt32 Id
The instance ID used in shaders to identify the instance.
Definition rendering_api.hpp:4891
InstanceFlags Flags
The flags that control the behavior of this instance.
Definition rendering_api.hpp:4917
Byte Mask
A user-defined mask value that is matched with another mask value during ray-tracing to include or di...
Definition rendering_api.hpp:4896
Describes the offsets and sizes of a shader group within a shader binding table buffer.
Definition rendering_api.hpp:3646
constexpr ShaderRecord & operator=(ShaderRecord &&_other) noexcept=default
Takes over another shader record.
constexpr const void * localData() const noexcept override
Returns a pointer to the shader-local data of the record.Shader-local data is a piece of constant dat...
Definition rendering_api.hpp:5884
constexpr ShaderRecord & operator=(const ShaderRecord &_other)=default
Copies another shader record.
constexpr UInt64 localDataSize() const noexcept override
Returns the size of the shader-local data of the record.The size of the shader-local data of the reco...
Definition rendering_api.hpp:5889
constexpr ShaderRecord(const ShaderRecord &_other)=default
Copies another shader record.
constexpr ShaderRecord(ShaderRecord &&_other) noexcept=default
Takes over another shader record.
constexpr ~ShaderRecord() noexcept override=default
IShaderRecord::shader_group_type shader_group_type
Definition rendering_api.hpp:5864
constexpr const shader_group_type & shaderGroup() const noexcept override
Returns the shader group containing the modules for this record.
Definition rendering_api.hpp:5879
Denotes a shader record containing no shader-local data.
Definition rendering_api.hpp:5938
constexpr UInt64 localDataSize() const noexcept override
Returns the size of the shader-local data of the record.The size of the shader-local data of the reco...
Definition rendering_api.hpp:5960
constexpr ShaderRecord & operator=(ShaderRecord &&_other) noexcept=default
Takes over another shader record.
constexpr const void * localData() const noexcept override
Returns a pointer to the shader-local data of the record.Shader-local data is a piece of constant dat...
Definition rendering_api.hpp:5955
constexpr ShaderRecord(const ShaderRecord &_other)=default
Copies another shader record.
constexpr ~ShaderRecord() noexcept override=default
constexpr ShaderRecord & operator=(const ShaderRecord &_other)=default
Copies another shader record.
constexpr const shader_group_type & shaderGroup() const noexcept override
Returns the shader group containing the modules for this record.
Definition rendering_api.hpp:5950
IShaderRecord::shader_group_type shader_group_type
Definition rendering_api.hpp:5940
constexpr ShaderRecord(ShaderRecord &&_other) noexcept=default
Takes over another shader record.
Defines a generic shader record.
Definition rendering_api.hpp:5842
An allocator used to allocate the shared object.
Definition containers.hpp:1098
Definition alloc_descriptor_set.cpp:13