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>
69#pragma region "Enumerations"
2068#pragma region "Flags"
2085#pragma region "Helper Functions"
2092 return static_cast<UInt32>(format) & 0x000000FF;
2100 return (
static_cast<UInt32>(format) & 0xFF000000) >> 24;
2108 return (
static_cast<UInt32>(format) & 0x0000FF00) >> 8;
2285 constexpr std::array<Format, 6> depthFormats {
2294 return std::any_of(std::begin(depthFormats), std::end(depthFormats), [&](
Format f) {
return f == format; });
2302 constexpr std::array<Format, 4> stencilFormats {
2309 return std::any_of(std::begin(stencilFormats), std::end(stencilFormats), [&](
Format f) {
return f == format; });
2314#pragma region "Data Types"
2321 struct LITEFX_RENDERING_API
alignas(16) IndirectBatch {
2347#pragma warning(push)
2348#pragma warning(disable: 4324)
2354 struct LITEFX_RENDERING_API alignas(16) IndirectIndexedBatch {
2359 UInt32 IndexCount{ };
2376 Int32 VertexOffset{ };
2390 struct LITEFX_RENDERING_API
alignas(16) IndirectDispatchBatch {
2428 size_t ElementSize{ 0u };
2515 size_t AliasingOffset{ 0u };
2531 ResourceInfo(bufferInfo), Usage(usage), Name(std::move(name)), AliasingOffset(aliasingOffset) { }
2541 ResourceInfo(imageInfo), Usage(usage), Name(std::move(name)), AliasingOffset(aliasingOffset) { }
2565 m_resource(std::move(image)) { }
2572 m_resource(std::move(buffer)) { }
2588 template <std::derived_from<
IImage> TImage>
2591 throw RuntimeException(
"The allocation result does not contain an image.");
2593 auto image = std::dynamic_pointer_cast<TImage>(std::get<
SharedPtr<IImage>>(m_resource));
2595 if (image ==
nullptr)
2596 throw RuntimeException(
"The allocated image resource is not of the requested image type.");
2607 template <std::derived_from<IBuffer> TBuffer>
2610 throw RuntimeException(
"The allocation result does not contain a buffer.");
2612 auto buffer = std::dynamic_pointer_cast<TBuffer>(std::get<
SharedPtr<IBuffer>>(m_resource));
2614 if (buffer ==
nullptr)
2615 throw RuntimeException(
"The allocated buffer resource is not of the requested buffer type.");
2644 virtual const
String& name() const noexcept = 0;
2683 const
String& name() const noexcept override;
2981 bool release(const
IPipeline& pipeline);
2988 bool release(const
IBuffer& buffer);
3009 bool release(const
IImage& image);
3016 bool release(const
ISampler& sampler);
3051 UInt64 Offset { std::numeric_limits<UInt64>::max() };
3058 struct AllocatorImplBase {
3070 m_size(overallMemory), m_algorithm(algorithm)
3074 AllocatorImplBase(
const AllocatorImplBase&) =
delete;
3075 AllocatorImplBase(AllocatorImplBase&&) noexcept = delete;
3076 AllocatorImplBase& operator=(const AllocatorImplBase&) = delete;
3077 AllocatorImplBase& operator=(AllocatorImplBase&&) noexcept = delete;
3080 virtual ~AllocatorImplBase() noexcept = default;
3087 inline
UInt64 size() const noexcept {
3095 inline AllocationAlgorithm algorithm() const noexcept {
3107 [[nodiscard]]
virtual Allocation allocate(
UInt64 size,
UInt32 alignment = 1u, AllocationStrategy strategy = AllocationStrategy::OptimizePacking,
void* privateData =
nullptr)
const = 0;
3113 virtual void free(
Allocation&& allocation)
const = 0;
3120 virtual void* privateData(
const Allocation& allocation)
const = 0;
3127 template <
typename TBackend>
3128 struct AllocatorImpl final :
public AllocatorImplBase {
3129 static_assert(
false,
"Attempting to use a non-specialized virtual allocator is invalid.");
3142 m_impl(std::move(pImpl))
3160 template <typename TBackend>
3171 return m_impl->size();
3179 return m_impl->algorithm();
3191 return m_impl->allocate(size, alignment, strategy, privateData);
3202 m_impl->free(std::forward<Allocation>(allocation));
3211 return m_impl->privateData(allocation);
3244 virtual
UInt64 uniqueId() const noexcept = 0;
3250 virtual
UInt32 vendorId() const noexcept = 0;
3256 virtual
UInt32 deviceId() const noexcept = 0;
3272 virtual
UInt64 driverVersion() const noexcept = 0;
3278 virtual
UInt32 apiVersion() const noexcept = 0;
3284 virtual
UInt64 dedicatedMemory() const noexcept = 0;
3333 if (this->Space < other.Space)
3334 return std::strong_ordering::less;
3335 else if (this->Space > other.Space)
3336 return std::strong_ordering::greater;
3337 else if (this->Register < other.Register)
3338 return std::strong_ordering::less;
3339 else if(this->Register > other.Register)
3340 return std::strong_ordering::greater;
3342 return std::strong_ordering::equal;
3352 return other.Space == this->Space && other.Register == this->Register;
3385 virtual const
String& fileName() const noexcept = 0;
3391 virtual const
String& entryPoint() const noexcept = 0;
3437 bool Enable{
false };
3472 WriteMask ChannelWriteMask{ WriteMask::R | WriteMask::G | WriteMask::B | WriteMask::A };
3490 virtual
UInt64 identifier() const noexcept = 0;
3496 virtual const
String& name() const noexcept = 0;
3506 virtual
UInt32 location() const noexcept = 0;
3535 virtual
bool clearBuffer() const noexcept = 0;
3546 virtual
bool clearStencil() const noexcept = 0;
3557 virtual const
Vector4f& clearValues() const noexcept = 0;
3571 virtual
bool isVolatile() const noexcept = 0;
3648 UInt64 identifier() const noexcept override;
3651 const
String& name() const noexcept override;
3654 UInt32 location() const noexcept override;
3660 Format format() const noexcept override;
3666 bool clearBuffer() const noexcept override;
3669 bool clearStencil() const noexcept override;
3672 const
Vector4f& clearValues() const noexcept override;
3675 bool isVolatile() const noexcept override;
3678 const
BlendState& blendState() const noexcept override;
3763 bool Enable{
true };
3785 bool DepthBoundsTestEnable{
false };
3802 bool Enable{
false };
3854 bool Enable{
false };
3884 explicit DepthStencilState(
const DepthState& depthState,
const DepthBias& depthBias,
const StencilState& stencilState)
noexcept;
3923 virtual
DepthState& depthState() const noexcept;
3929 virtual
DepthBias& depthBias() const noexcept;
3979 virtual
Float lineWidth() const noexcept = 0;
3991 virtual
bool depthClip() const noexcept = 0;
4000 virtual
bool conservativeRasterization() const noexcept = 0;
4056 PolygonMode polygonMode() const noexcept override;
4059 CullMode cullMode() const noexcept override;
4062 CullOrder cullOrder() const noexcept override;
4065 Float lineWidth() const noexcept override;
4071 bool depthClip() const noexcept override;
4074 bool conservativeRasterization() const noexcept override;
4078 virtual
CullMode& cullMode() noexcept;
4079 virtual
CullOrder& cullOrder() noexcept;
4080 virtual
Float& lineWidth() noexcept;
4081 virtual
bool& depthClip() noexcept;
4083 virtual
bool& conservativeRasterization() noexcept;
4105 virtual
RectF getRectangle() const noexcept = 0;
4111 virtual
void setRectangle(const
RectF& rectangle) noexcept = 0;
4117 virtual
float getMinDepth() const noexcept = 0;
4123 virtual
void setMinDepth(
Float depth) const noexcept = 0;
4129 virtual
float getMaxDepth() const noexcept = 0;
4135 virtual
void setMaxDepth(
Float depth) const noexcept = 0;
4186 RectF getRectangle() const noexcept override;
4189 void setRectangle(const
RectF& rectangle) noexcept override;
4192 Float getMinDepth() const noexcept override;
4195 void setMinDepth(
Float depth) const noexcept override;
4198 Float getMaxDepth() const noexcept override;
4201 void setMaxDepth(
Float depth) const noexcept override;
4223 virtual
RectF getRectangle() const noexcept = 0;
4229 virtual
void setRectangle(const
RectF& rectangle) noexcept = 0;
4243 explicit Scissor(
const RectF& scissorRect = { })
noexcept;
4278 RectF getRectangle() const noexcept override;
4281 void setRectangle(const
RectF& rectangle) noexcept override;
4295 UInt64 RayGenerationGroupOffset { std::numeric_limits<UInt64>::max() };
4310 UInt64 HitGroupOffset { std::numeric_limits<UInt64>::max() };
4325 UInt64 MissGroupOffset{ std::numeric_limits<UInt64>::max() };
4340 UInt64 CallableGroupOffset { std::numeric_limits<UInt64>::max() };
4403 return SharedObject::create<TimingEvent>(swapChain, name);
4423 UInt64 readTimestamp() const;
4495 virtual
UInt32 location() const noexcept;
4507 virtual
UInt32 offset() const noexcept;
4527 virtual
UInt32 semanticIndex() const noexcept;
4552 virtual
size_t elementSize() const noexcept = 0;
4668 virtual
UInt32 descriptors() const noexcept = 0;
4675 virtual
bool unbounded() const noexcept = 0;
4686 virtual const
ISampler* staticSampler() const noexcept = 0;
4710 virtual
void map(const
void* const data,
size_t size,
UInt32 element = 0) = 0;
4718 virtual
void map(
Span<const
void* const> data,
size_t elementSize,
UInt32 firstElement = 0) = 0;
4727 virtual
void map(
void* data,
size_t size,
UInt32 element = 0,
bool write = true) = 0;
4736 virtual
void map(
Span<
void*> data,
size_t elementSize,
UInt32 firstElement = 0,
bool write = true) = 0;
4744 virtual
void write(const
void* const data,
size_t size,
size_t offset = 0) = 0;
4752 virtual
void read(
void* data,
size_t size,
size_t offset = 0) = 0;
4784 m_barrier(barrier) {
4813 m_queue(std::move(queue)), m_fence(fence)
4906 virtual
UInt32 elements() const noexcept = 0;
4921 virtual
size_t size() const noexcept = 0;
4932 virtual
size_t elementSize() const noexcept = 0;
4940 virtual
size_t elementAlignment() const noexcept = 0;
4951 virtual
size_t alignedElementSize() const noexcept = 0;
4966 virtual
UInt64 virtualAddress() const noexcept = 0;
4975 virtual inline
bool writable() const noexcept {
4976 return LITEFX_FLAG_IS_SET(this->usage(), ResourceUsage::AllowWrite);
4990 return LITEFX_FLAG_IS_SET(this->usage(), ResourceUsage::Volatile);
5021 using IDeviceMemory::size;
5043 virtual
size_t size(
UInt32 level) const noexcept = 0;
5112 return level + (layer * this->levels()) + (plane * this->levels() * this->layers());
5124 const auto levels = this->levels();
5125 const UInt32 resourcesPerPlane = levels * this->layers();
5126 plane = subresource / resourcesPerPlane;
5127 layer = (subresource % resourcesPerPlane) / levels;
5128 level = subresource % levels;
5184 virtual
Float getAnisotropy() const noexcept = 0;
5196 virtual
Float getMipMapBias() const noexcept = 0;
5202 virtual
Float getMaxLOD() const noexcept = 0;
5208 virtual
Float getMinLOD() const noexcept = 0;
5306 this->doBuild(commandBuffer, scratchBuffer, buffer, offset, maxSize);
5342 this->doUpdate(commandBuffer, scratchBuffer, buffer, offset, maxSize);
5352 return this->getBuffer();
5415 if (vertexBuffer ==
nullptr) [[unlikely]]
5539 this->addTriangleMesh(
TriangleMesh(vertexBuffer, indexBuffer, transformBuffer, flags));
5562 this->addBoundingBox(
BoundingBoxes { .Buffer = buffer, .Flags = flags });
5619 this->doCopy(commandBuffer, destination, compress, buffer, offset, copyBuildInfo);
5629 template <
typename TSelf>
5631 self.addTriangleMesh(mesh);
5632 return std::forward<TSelf>(self);
5644 template <
typename TSelf>
5646 return std::forward<TSelf>(self).withTriangleMesh(
TriangleMesh(vertexBuffer, indexBuffer, transformBuffer, flags));
5655 template <
typename TSelf>
5657 self.addBoundingBox(aabb);
5658 return std::forward<TSelf>(self);
5668 template <
typename TSelf>
5670 return std::forward<TSelf>(self).withBoundingBox(
BoundingBoxes { .Buffer = buffer, .Flags = flags });
5683#pragma warning(push)
5684#pragma warning(disable: 4324)
5688 struct alignas(16) Instance final {
5692 SharedPtr<const IBottomLevelAccelerationStructure> BottomLevelAccelerationStructure;
5754 virtual
void addInstance(const
Instance& instance) = 0;
5765 this->addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
5778 this->addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Transform = transform, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
5791 virtual
bool remove(const
Instance& instance) noexcept = 0;
5828 this->doCopy(commandBuffer, destination, compress, buffer, offset, copyBuildInfo);
5837 template<
typename TSelf>
5839 self.addInstance(instance);
5840 return std::forward<TSelf>(self);
5852 template<
typename TSelf>
5854 self.addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
5855 return std::forward<TSelf>(self);
5868 template<
typename TSelf>
5870 self.addInstance(
Instance { .BottomLevelAccelerationStructure = blas, .Transform = transform, .Id = id, .Mask = mask, .HitGroupOffset = hitGroupOffset, .Flags = flags });
5871 return std::forward<TSelf>(self);
5961 this->doTransition(buffer, accessBefore, accessAfter);
5977 this->doTransition(buffer, element, accessBefore, accessAfter);
5990 this->doTransition(image, accessBefore, accessAfter, layout);
6008 this->doTransition(image, level, levels, layer, layers, plane, accessBefore, accessAfter, layout);
6026 this->doTransition(image, accessBefore, accessAfter, fromLayout, toLayout);
6049 this->doTransition(image, level, levels, layer, layers, plane, accessBefore, accessAfter, fromLayout, toLayout);
6102 return this->doBind(bindingType, descriptor, buffer, bufferElement, elements, texelFormat);
6125 return this->doBind(bindingType, descriptor, image, firstLevel, levels, firstLayer, layers);
6142 return this->doBind(descriptor, sampler);
6155 this->doUpdate(binding, buffer, bufferElement, elements, firstDescriptor, texelFormat);
6180 this->doUpdate(binding, texture, descriptor, firstLevel, levels, firstLayer, layers);
6190 this->doUpdate(binding, sampler, descriptor);
6200 this->doUpdate(binding, accelerationStructure, descriptor);
6307 return this->getDescriptors();
6336 virtual
UInt32 uniforms() const noexcept = 0;
6342 virtual
UInt32 storages() const noexcept = 0;
6361 virtual
UInt32 samplers() const noexcept = 0;
6368 virtual
UInt32 staticSamplers() const noexcept = 0;
6374 virtual
UInt32 inputAttachments() const noexcept = 0;
6380 virtual
bool containsUnboundedArray() const noexcept = 0;
6394 virtual
bool bindsResources() const noexcept = 0;
6403 virtual
bool bindsSamplers() const noexcept = 0;
6436 return this->getDescriptorSet(0, bindings);
6441 return this->getDescriptorSet(0, bindings);
6446 return this->getDescriptorSet(0, std::move(bindings));
6458 return this->getDescriptorSet(descriptors, bindings);
6463 return this->getDescriptorSet(descriptors, bindings);
6474 return this->getDescriptorSet(descriptors, std::move(bindings));
6485 return this->getDescriptorSets(descriptorSets, 0, bindings);
6488#ifdef __cpp_lib_mdspan
6491 return this->getDescriptorSets(descriptorSets, 0, bindings);
6503 return this->getDescriptorSets(descriptorSets, 0, std::move(bindingFactory));
6515 return this->getDescriptorSets(descriptorSets, descriptors, bindings);
6518#ifdef __cpp_lib_mdspan
6521 return this->getDescriptorSets(descriptorSets, descriptors, bindings);
6534 return this->getDescriptorSets(descriptorSets, descriptors, std::move(bindingFactory));
6542 this->releaseDescriptorSet(descriptorSet);
6551#ifdef __cpp_lib_mdspan
6555 virtual void releaseDescriptorSet(
const IDescriptorSet& descriptorSet)
const = 0;
6643 return this->getRanges();
6705 const auto& group = this->shaderGroup();
6707 if (std::holds_alternative<MeshGeometryHitGroup>(group))
6709 return ShaderRecordType::HitGroup;
6711 else if (std::holds_alternative<const IShaderModule*>(group))
6713 switch (std::get<const IShaderModule*>(group)->type())
6715 case ShaderStage::RayGeneration:
return ShaderRecordType::RayGeneration;
6716 case ShaderStage::Miss:
return ShaderRecordType::Miss;
6717 case ShaderStage::Callable:
return ShaderRecordType::Callable;
6718 case ShaderStage::Intersection:
return ShaderRecordType::Intersection;
6719 default:
return ShaderRecordType::Invalid;
6742 constexpr virtual const
void* localData() const noexcept = 0;
6749 constexpr virtual
UInt64 localDataSize() const noexcept = 0;
6757 template <typename... TLocalData>
6763 const
size_t SHADER_RECORD_LOCAL_DATA_ALIGNMENT { 8 };
6775 template <
typename TLocalData>
requires
6776 (std::alignment_of_v<TLocalData> == SHADER_RECORD_LOCAL_DATA_ALIGNMENT) &&
6777 std::is_standard_layout_v<TLocalData>
6786 TLocalData m_payload;
6796 return m_shaderGroup;
6801 return static_cast<const void*
>(&m_payload);
6806 return sizeof(TLocalData);
6821 m_payload(payload), m_shaderGroup(group) { }
6867 return m_shaderGroup;
6891 m_shaderGroup(group) { }
6935 m_program(std::move(shaderProgram))
6992 auto shaderModule = this->findShaderModule(shaderName);
6994 if (shaderModule ==
nullptr) [[unlikely]]
6995 throw InvalidArgumentException(
"shaderName",
"The parent shader program does not contain a shader named \"{}\".", shaderName);
6997 if (shaderModule->type() == ShaderStage::AnyHit)
6999 else if (shaderModule->type() == ShaderStage::ClosestHit)
7018 auto shaderModule = this->findShaderModule(shaderName);
7020 if (shaderModule ==
nullptr) [[unlikely]]
7021 throw InvalidArgumentException(
"shaderName",
"The parent shader program does not contain a shader named \"{}\".", shaderName);
7023 if (shaderModule->type() == ShaderStage::AnyHit)
7025 else if (shaderModule->type() == ShaderStage::ClosestHit)
7039 .ClosestHitShader = closestHitShaderName.has_value() ? this->findShaderModule(closestHitShaderName.value()) :
nullptr,
7040 .AnyHitShader = anyHitShaderName.has_value() ? this->findShaderModule(anyHitShaderName.value()) :
nullptr
7057 .ClosestHitShader = closestHitShaderName.has_value() ? this->findShaderModule(closestHitShaderName.value()) :
nullptr,
7058 .AnyHitShader = anyHitShaderName.has_value() ? this->findShaderModule(anyHitShaderName.value()) :
nullptr
7093 this->addShaderRecord(shaderName);
7094 return std::forward<ShaderRecordCollection>(*
this);
7110 this->addShaderRecord(shaderName, payload);
7111 return std::forward<ShaderRecordCollection>(*
this);
7121 this->addMeshGeometryShaderHitGroupRecord(anyHitShaderName, closestHitShaderName);
7122 return std::forward<ShaderRecordCollection>(*
this);
7135 this->addMeshGeometryShaderHitGroupRecord(anyHitShaderName, closestHitShaderName, payload);
7136 return std::forward<ShaderRecordCollection>(*
this);
7145 this->addShaderRecord(shaderGroup);
7146 return std::forward<ShaderRecordCollection>(*
this);
7158 this->addShaderRecord(shaderGroup, payload);
7159 return std::forward<ShaderRecordCollection>(*
this);
7195 bool AsPushConstants{
false };
7285 return { .Binding = { .Register = binding, .Space = space }, .Hint =
UnboundedArrayHint { maxDescriptors } };
7304 return { .Binding = { .Register = binding, .Space = space }, .Hint =
PushConstantsHint {
true } };
7325 return { .Binding = { .Register = binding, .Space = space }, .Hint =
StaticSamplerHint { std::move(sampler) } };
7336 return { .Binding = at, .Hint =
DescriptorHeapHint { DescriptorHeapType::Resource, heapSize } };
7348 return { .Binding = { .Register = binding, .Space = space }, .Hint =
DescriptorHeapHint { DescriptorHeapType::Resource, heapSize } };
7359 return { .Binding = at, .Hint =
DescriptorHeapHint { DescriptorHeapType::Sampler, heapSize } };
7371 return { .Binding = { .Register = binding, .Space = space }, .Hint =
DescriptorHeapHint { DescriptorHeapType::Sampler, heapSize } };
7394 return { .Binding = {.Register = binding, .Space = space }, .Hint =
ShaderStageHint { shaderStages } };
7456 auto modules = this->getModules();
7458 if (
auto match = std::ranges::find_if(modules, [name](
auto& module) {
return module.fileName().compare(name) == 0; }); match != modules.end())
7459 return std::addressof(*match);
7470 auto modules = this->getModules();
7471 return std::ranges::find_if(modules, [name](
const auto& module) {
return module.fileName().compare(name) == 0; }) != modules.end();
7480 auto modules = this->getModules();
7481 return std::ranges::find_if(modules, [&module](
const auto& m) {
return std::addressof(m) == std::addressof(module); }) != modules.end();
7489 return this->getModules();
7519 return this->parsePipelineLayout(hints);
7527 return { this->shared_from_this() };
7568 return this->getDescriptorSets();
7581 virtual
bool dynamicResourceHeapAccess() const = 0;
7587 virtual
bool dynamicSamplerHeapAccess() const = 0;
7613 return this->getVertexBufferLayouts();
7663 return this->getProgram();
7671 return this->getLayout();
7705 virtual
void begin() const = 0;
7714 virtual
void end() const = 0;
7720 virtual
bool isSecondary() const noexcept = 0;
7769 return this->getQueue();
7779 return this->getBarrier(syncBefore, syncAfter);
7792 this->cmdBarrier(barrier);
7810 this->cmdTransfer(source, target, sourceElement, targetElement, elements);
7834 this->cmdTransfer(source, target, sourceElement, targetElement, elements);
7851 this->cmdTransfer(data, size, target, targetElement, elements);
7867 this->cmdTransfer(data, elementSize, target, targetElement);
7906 this->cmdTransfer(source, target, sourceElement, firstSubresource, elements);
7952 this->cmdTransfer(source, target, sourceElement, firstSubresource, elements);
7969 this->cmdTransfer(data, size, target, subresource);
7986 this->cmdTransfer(data, elementSize, target, firstSubresource, elements);
8003 this->cmdTransfer(source, target, sourceSubresource, targetSubresource, subresources);
8027 this->cmdTransfer(source, target, sourceSubresource, targetSubresource, subresources);
8066 this->cmdTransfer(source, target, firstSubresource, targetElement, subresources);
8112 this->cmdTransfer(source, target, firstSubresource, targetElement, subresources);
8119 this->cmdUse(pipeline);
8129 this->cmdBind(descriptorSet);
8141 template <
typename TSelf,
typename T>
8142 inline void bind(
this const TSelf& self, std::initializer_list<const T*> descriptorSets)
requires
8143 std::derived_from<T, IDescriptorSet>
8158 template <
typename TSelf>
8159 inline void bind(
this const TSelf& self, std::ranges::input_range
auto&& descriptorSets)
requires
8160 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>
8162 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)>>>>>>;
8163 auto sets = descriptorSets | std::ranges::to<Array<const descriptor_set_type*>>();
8175 this->cmdBind(descriptorSets);
8184 this->cmdBind(descriptorSet, pipeline);
8197 template <
typename TSelf,
typename T>
8198 inline void bind(
this const TSelf& self, std::initializer_list<const T*> descriptorSets,
const typename TSelf::pipeline_type& pipeline)
8213 template <
typename TSelf>
8214 inline void bind(
this const TSelf& self, std::ranges::input_range
auto&& descriptorSets,
const typename TSelf::pipeline_type& pipeline)
requires
8215 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>
8217 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)>>>>>>;
8218 auto sets = descriptorSets | std::ranges::to<Array<const descriptor_set_type*>>();
8231 this->cmdBind(descriptorSets, pipeline);
8245 this->cmdBind(buffer);
8258 this->cmdBind(buffer);
8275 this->dispatch({ x, y, z });
8286 this->cmdDispatchIndirect(batchBuffer, batchCount, offset);
8308 this->dispatchMesh({ x, y, z });
8319 this->cmdDispatchMeshIndirect(batchBuffer, batchCount, offset);
8332 this->cmdDispatchMeshIndirect(batchBuffer, countBuffer, offset, countOffset, maxBatches);
8350 this->cmdTraceRays(width, height, depth, offsets, rayGenerationShaderBindingTable, missShaderBindingTable, hitShaderBindingTable, callableShaderBindingTable);
8366 this->traceRays(dimensions.
x(), dimensions.
y(), dimensions.
z(), offsets, rayGenerationShaderBindingTable, missShaderBindingTable, hitShaderBindingTable, callableShaderBindingTable);
8390 this->cmdDraw(vertexBuffer, instances, firstVertex, firstInstance);
8401 this->cmdDrawIndirect(batchBuffer, batchCount, offset);
8414 this->cmdDrawIndirect(batchBuffer, countBuffer, offset, countOffset, maxBatches);
8440 this->cmdDrawIndexed(indexBuffer, instances, firstIndex, vertexOffset, firstInstance);
8456 this->cmdDrawIndexed(vertexBuffer, indexBuffer, instances, firstIndex, vertexOffset, firstInstance);
8467 this->cmdDrawIndexedIndirect(batchBuffer, batchCount, offset);
8480 this->cmdDrawIndexedIndirect(batchBuffer, countBuffer, offset, countOffset, maxBatches);
8489 this->cmdPushConstants(layout, memory);
8562 this->cmdExecute(commandBuffer);
8570 this->cmdExecute(std::move(commandBuffers));
8586 this->cmdBuildAccelerationStructure(blas, scratchBuffer, buffer, offset);
8602 this->cmdBuildAccelerationStructure(tlas, scratchBuffer, buffer, offset);
8618 this->cmdUpdateAccelerationStructure(blas, scratchBuffer, buffer, offset);
8634 this->cmdUpdateAccelerationStructure(tlas, scratchBuffer, buffer, offset);
8651 this->cmdCopyAccelerationStructure(from, to, compress);
8668 this->cmdCopyAccelerationStructure(from, to, compress);
8680 virtual
void cmdBarrier(const
IBarrier& barrier) const noexcept = 0;
8683 virtual
void cmdTransfer(const
IImage& source, const
IImage& target,
UInt32 sourceSubresource,
UInt32 targetSubresource,
UInt32 subresources) const = 0;
8689 virtual
void cmdTransfer(const
void* const data,
size_t size, const
IBuffer& target,
UInt32 targetElement,
UInt32 elements) const = 0;
8690 virtual
void cmdTransfer(
Span<const
void* const> data,
size_t elementSize, const
IBuffer& target,
UInt32 targetElement) const = 0;
8691 virtual
void cmdTransfer(const
void* const data,
size_t size, const
IImage& target,
UInt32 subresource) const = 0;
8692 virtual
void cmdTransfer(
Span<const
void* const> data,
size_t elementSize, const
IImage& target,
UInt32 firstSubresource,
UInt32 elements) const = 0;
8693 virtual
void cmdUse(const
IPipeline& pipeline) const noexcept = 0;
8694 virtual
void cmdBind(const
IDescriptorSet& descriptorSet) const = 0;
8698 virtual
void cmdBind(const
IVertexBuffer& buffer) const = 0;
8699 virtual
void cmdBind(const
IIndexBuffer& buffer) const = 0;
8700 virtual
void cmdPushConstants(const
IPushConstantsLayout& layout, const
void* const memory) const = 0;
8701 virtual
void cmdDispatchIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
8702 virtual
void cmdDispatchMeshIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
8703 virtual
void cmdDispatchMeshIndirect(const
IBuffer& batchBuffer, const
IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches) const noexcept = 0;
8705 virtual
void cmdDrawIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
8706 virtual
void cmdDrawIndirect(const
IBuffer& batchBuffer, const
IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches) const noexcept = 0;
8709 virtual
void cmdDrawIndexedIndirect(const
IBuffer& batchBuffer,
UInt32 batchCount,
UInt64 offset) const noexcept = 0;
8710 virtual
void cmdDrawIndexedIndirect(const
IBuffer& batchBuffer, const
IBuffer& countBuffer,
UInt64 offset,
UInt64 countOffset,
UInt32 maxBatches) const noexcept = 0;
8742 return this->getInputAssembler();
8750 return this->getRasterizer();
8832 virtual
UInt32 maxRecursionDepth() const noexcept = 0;
8845 virtual
UInt32 maxPayloadSize() const noexcept = 0;
8856 virtual
UInt32 maxAttributeSize() const noexcept = 0;
8874 return this->getShaderBindingTable(offsets, groups);
8924 template <
typename TImage>
8939 EventArgs(), m_newSize(std::move(newSize)) { }
8951 inline const
Size2d& newSize() const noexcept {
8984 released.invoke(
this, { });
9030 virtual
size_t getWidth() const noexcept = 0;
9039 virtual
size_t getHeight() const noexcept = 0;
9084 this->mapRenderTarget(renderTarget, renderTarget.name());
9095 std::ranges::for_each(renderTargets, [
this](
auto& renderTarget) { this->mapRenderTarget(renderTarget); });
9113 return this->getImages();
9179 template <
typename TSelf>
9181 self.addImage(format, samples, usage);
9182 return std::forward<TSelf>(self);
9192 this->addImage(
"", format, samples, usage);
9202 template <
typename TSelf>
9204 self.addImage(name, format, samples, usage);
9205 return std::forward<TSelf>(self);
9224 template <
typename TSelf>
9226 self.addImage(renderTarget, samples, usage);
9227 return std::forward<TSelf>(self);
9237 this->addImage(renderTarget.
name(), renderTarget, samples, usage);
9247 template <
typename TSelf>
9249 self.addImage(name, renderTarget, samples, usage);
9250 return std::forward<TSelf>(self);
9271 template <
typename TSelf>
9273 std::ranges::for_each(renderTargets, [&](
auto& renderTarget) { self.addImage(renderTarget.
name(), renderTarget, samples, usage); });
9274 return std::forward<TSelf>(self);
9304 EventArgs(), m_frameBuffer(&frameBuffer) { }
9317 return *m_frameBuffer;
9362 return this->getActiveFrameBuffer();
9370 return this->getCommandQueue();
9382 return this->getCommandBuffers();
9394 return this->getCommandBuffer(index);
9425 virtual
bool hasPresentTarget() const noexcept = 0;
9454 this->beginRenderPass(frameBuffer);
9475 virtual
void beginRenderPass(const
IFrameBuffer& frameBuffer) const = 0;
9476 virtual const
ICommandQueue& getCommandQueue() const noexcept = 0;
9498 EventArgs(), m_surfaceFormat(surfaceFormat), m_renderArea(std::move(renderArea)), m_buffers(buffers), m_vsync(enableVsync) { }
9510 inline
Format surfaceFormat() const noexcept {
9511 return m_surfaceFormat;
9519 return m_renderArea;
9562 return m_backBuffer;
9587 auto timingEvent = TimingEvent::create(*
this, name);
9588 this->addTimingEvent(timingEvent);
9649 virtual const
Size2d& renderArea() const noexcept = 0;
9655 virtual
bool verticalSynchronization() const noexcept = 0;
9668 virtual const
IImage& image() const noexcept = 0;
9675 return this->getImages();
9753 EventArgs(), m_commandBuffers(std::move(commandBuffers)) { }
9767 return m_commandBuffers;
9826 static constexpr Vectors::ByteVector3 DEFAULT_DEBUG_COLOR = { 128_ui8, 128_ui8, 128_ui8 };
9881 return this->getCommandBuffer(beginRecording, secondary);
9897 return this->submitCommandBuffer(commandBuffer);
9913 return this->submitCommandBuffer(commandBuffer);
9929 return this->submitCommandBuffers(std::move(commandBuffers));
9952 this->waitForQueue(queue, fence);
9968 virtual
UInt64 lastCompletedFence() const noexcept = 0;
9989 bool onGpu{
false };
9994 bool cpuVisible{
false };
10048 bool onGpu{
false };
10053 bool cpuVisible{
false };
10188 virtual
UInt64 beginDefragmentationPass() const = 0;
10203 virtual
bool endDefragmentationPass() const = 0;
10212 if (std::holds_alternative<ResourceAllocationInfo::ImageInfo>(allocationInfo.ResourceInfo))
10214 auto& imageInfo = std::get<ResourceAllocationInfo::ImageInfo>(allocationInfo.ResourceInfo);
10215 return this->createTexture(allocationInfo.Name, imageInfo.Format, imageInfo.Size, imageInfo.Dimensions, imageInfo.Levels, imageInfo.Layers, imageInfo.Samples, allocationInfo.Usage, allocationBehavior);
10219 auto& bufferInfo = std::get<ResourceAllocationInfo::BufferInfo>(allocationInfo.ResourceInfo);
10221 if (bufferInfo.Type == BufferType::Vertex && bufferInfo.VertexBufferLayout != nullptr)
10222 return std::dynamic_pointer_cast<IBuffer>(
10223 this->createVertexBuffer(allocationInfo.Name, *bufferInfo.VertexBufferLayout, bufferInfo.Heap, bufferInfo.Elements, allocationInfo.Usage, allocationBehavior));
10224 else if (bufferInfo.Type == BufferType::Index && bufferInfo.IndexBufferLayout != nullptr)
10225 return std::dynamic_pointer_cast<IBuffer>(
10226 this->createIndexBuffer(allocationInfo.Name, *bufferInfo.IndexBufferLayout, bufferInfo.Heap, bufferInfo.Elements, allocationInfo.Usage, allocationBehavior));
10228 return this->createBuffer(allocationInfo.Name, bufferInfo.Type, bufferInfo.Heap, bufferInfo.ElementSize, bufferInfo.Elements, allocationInfo.Usage, allocationBehavior);
10275 return this->getBuffer(type, heap, elementSize, elements, usage, allocationBehavior);
10290 return this->tryGetBuffer(buffer, type, heap, elementSize, elements, usage, allocationBehavior);
10304 auto& descriptor = descriptorSet.
descriptor(binding);
10305 return this->createBuffer(descriptor.type(), heap, descriptor.elementSize(), elements, usage, allocationBehavior);
10320 auto& descriptor = descriptorSet.
descriptor(binding);
10321 return this->tryCreateBuffer(buffer, descriptor.type(), heap, descriptor.elementSize(), elements, usage, allocationBehavior);
10335 auto& descriptor = descriptorSet.
descriptor(binding);
10336 return this->createBuffer(descriptor.type(), heap, elementSize, elements, usage, allocationBehavior);
10351 auto& descriptor = descriptorSet.
descriptor(binding);
10352 return this->tryCreateBuffer(buffer, descriptor.type(), heap, elementSize, elements, usage, allocationBehavior);
10367 return this->createBuffer(pipeline.
layout()->descriptorSet(space), binding, heap, elementSize, elements, usage, allocationBehavior);
10383 return this->tryCreateBuffer(buffer, pipeline.
layout()->descriptorSet(space), binding, heap, elementSize, elements, usage, allocationBehavior);
10398 return this->createBuffer(pipeline.
layout()->descriptorSet(space), binding, heap, elements, usage, allocationBehavior);
10414 return this->tryCreateBuffer(buffer, pipeline.
layout()->descriptorSet(space), binding, heap, elements, usage, allocationBehavior);
10429 return this->getBuffer(name, type, heap, elementSize, elements, usage, allocationBehavior);
10445 return this->tryGetBuffer(buffer, name, type, heap, elementSize, elements, usage, allocationBehavior);
10460 auto& descriptor = descriptorSet.
descriptor(binding);
10461 return this->createBuffer(name, descriptor.type(), heap, descriptor.elementSize(), elements, usage, allocationBehavior);
10477 auto& descriptor = descriptorSet.
descriptor(binding);
10478 return this->tryCreateBuffer(buffer, name, descriptor.type(), heap, descriptor.elementSize(), elements, usage, allocationBehavior);
10494 auto& descriptor = descriptorSet.
descriptor(binding);
10495 return this->createBuffer(name, descriptor.type(), heap, elementSize, elements, usage, allocationBehavior);
10512 auto& descriptor = descriptorSet.
descriptor(binding);
10513 return this->tryCreateBuffer(buffer, name, descriptor.type(), heap, elementSize, elements, usage, allocationBehavior);
10529 return this->createBuffer(name, pipeline.
layout()->descriptorSet(space), binding, heap, elements, usage, allocationBehavior);
10546 return this->tryCreateBuffer(buffer, name, pipeline.
layout()->descriptorSet(space), binding, heap, elements, usage, allocationBehavior);
10563 return this->createBuffer(name, pipeline.
layout()->descriptorSet(space), binding, heap, elementSize, elements, usage, allocationBehavior);
10581 return this->tryCreateBuffer(buffer, name, pipeline.
layout()->descriptorSet(space), binding, heap, elementSize, elements, usage, allocationBehavior);
10599 return this->getVertexBuffer(layout, heap, elements, usage, allocationBehavior);
10613 return this->tryGetVertexBuffer(buffer, layout, heap, elements, usage, allocationBehavior);
10632 return this->getVertexBuffer(name, layout, heap, elements, usage, allocationBehavior);
10647 return this->tryGetVertexBuffer(buffer, name, layout, heap, elements, usage, allocationBehavior);
10665 return this->getIndexBuffer(layout, heap, elements, usage, allocationBehavior);
10679 return this->tryGetIndexBuffer(buffer, layout, heap, elements, usage, allocationBehavior);
10698 return this->getIndexBuffer(name, layout, heap, elements, usage, allocationBehavior);
10713 return this->tryGetIndexBuffer(buffer, name, layout, heap, elements, usage, allocationBehavior);
10734 return this->getTexture(format, size, dimension, levels, layers, samples, usage, allocationBehavior);
10751 return this->tryGetTexture(image, format, size, dimension, levels, layers, samples, usage, allocationBehavior);
10773 return this->getTexture(name, format, size, dimension, levels, layers, samples, usage, allocationBehavior);
10791 return this->tryGetTexture(image, name, format, size, dimension, levels, layers, samples, usage, allocationBehavior);
10807 return this->getTextures(format, size, dimension, layers, levels, samples, usage, allocationBehavior);
10826 return this->getSampler(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
10845 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 {
10846 return this->getSampler(name, magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
10865 return this->getSamplers(magFilter, minFilter, borderU, borderV, borderW, mipMapMode, mipMapBias, maxLod, minLod, anisotropy);
10878 return this->createBottomLevelAccelerationStructure(
"", flags);
10892 return this->getBlas(name, flags);
10905 return this->createTopLevelAccelerationStructure(
"", flags);
10919 return this->getTlas(name, flags);
10967 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;
10988 bool MeshShaders {
false };
10993 bool RayTracing {
false };
10998 bool RayQueries {
false };
11003 bool DrawIndirect {
false };
11023 bool DynamicDescriptors {
false };
11030 bool DepthBoundsTest {
false };
11037 bool ConservativeRasterization {
false };
11044 bool ViewInstancing {
false };
11112 return this->getDefaultQueue(type);
11134 return this->getNewQueue(type, priority);
11144 return this->getNewBarrier(syncBefore, syncAfter);
11153 return this->makeFrameBuffer(
"", renderArea);
11163 return this->getNewFrameBuffer(name, renderArea);
11199 this->getAccelerationStructureSizes(blas, bufferSize, scratchSize, forUpdate);
11217 this->getAccelerationStructureSizes(tlas, bufferSize, scratchSize, forUpdate);
11227 return this->doAllocateGlobalDescriptors(descriptorSet, heapType);
11240 this->doReleaseGlobalDescriptors(descriptorSet);
11251 this->doUpdateGlobalDescriptors(descriptorSet, binding, offset, descriptors);
11265 this->doBindDescriptorSet(commandBuffer, descriptorSet, pipeline);
11273 this->doBindGlobalDescriptorHeaps(commandBuffer);
11280 virtual void doReleaseGlobalDescriptors(
const IDescriptorSet& descriptorSet)
const = 0;
11283 virtual void doBindGlobalDescriptorHeaps(
const ICommandBuffer& commandBuffer)
const noexcept = 0;
11322 return this->getAdapters();
11358 return this->device(name);
11367 return this->device(name);
11377 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:4437
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:3751
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:2697
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:5260
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:5341
SharedPtr< const IBuffer > buffer() const noexcept
Returns the acceleration structure backing buffer, that stores its last build.
Definition rendering_api.hpp:5351
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:5921
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:6007
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:6048
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:5989
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:5976
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:6025
A structure that holds a singular entity of geometry for hardware ray-tracing.
Definition rendering_api.hpp:5399
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:5669
IBottomLevelAccelerationStructure() noexcept=default
auto withTriangleMesh(this TSelf &&self, const TriangleMesh &mesh) -> TSelf &&
Adds a triangle mesh to the BLAS.
Definition rendering_api.hpp:5630
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:5645
auto withBoundingBox(this TSelf &&self, const BoundingBoxes &aabb) -> TSelf &&
Adds a buffer containing axis-aligned bounding boxes to the BLAS.
Definition rendering_api.hpp:5656
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:4997
IBuffer() noexcept=default
Describes a buffer layout.
Definition rendering_api.hpp:4536
IBufferLayout() noexcept=default
The interface for a command buffer.
Definition rendering_api.hpp:7682
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:8349
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:8633
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:8413
void barrier(const IBarrier &barrier) const noexcept
Executes the transitions that have been added to barrier .
Definition rendering_api.hpp:7791
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:7985
void bind(const IDescriptorSet &descriptorSet) const
Binds the provided descriptor to the last pipeline that was used by the command buffer.
Definition rendering_api.hpp:8128
void pushConstants(const IPushConstantsLayout &layout, const void *const memory) const
Pushes a block of memory into the push constants backing memory.
Definition rendering_api.hpp:8488
void 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:8214
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:8601
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:7968
void dispatchMesh(UInt32 x, UInt32 y, UInt32 z) const noexcept
Executes a mesh shader pipeline.
Definition rendering_api.hpp:8307
void transfer(const IBuffer &source, const IBuffer &target, UInt32 sourceElement=0, UInt32 targetElement=0, UInt32 elements=1) const
Performs a buffer-to-buffer transfer from source to target .
Definition rendering_api.hpp:7809
virtual void drawIndexed(UInt32 indices, UInt32 instances=1, UInt32 firstIndex=0, Int32 vertexOffset=0, UInt32 firstInstance=0) const noexcept=0
Draws the currently bound vertex buffer with a set of indices from the currently bound index buffer.
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:8667
virtual void dispatchMesh(const Vector3u &threadGroupCount) const noexcept=0
Executes a mesh shader pipeline.
virtual void setDepthBounds(Float minBounds, Float maxBounds) const noexcept=0
Sets the depth range for the depth bounds test.
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:8244
void execute(const SharedPtr< const ICommandBuffer > &commandBuffer) const
Executes a secondary command buffer/bundle.
Definition rendering_api.hpp:8561
void updateAccelerationStructure(IBottomLevelAccelerationStructure &blas, const SharedPtr< const IBuffer > &scratchBuffer, const IBuffer &buffer, UInt64 offset=0) const
Updates a bottom-level acceleration structure.
Definition rendering_api.hpp:8617
void 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:8111
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:8455
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:8159
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:8002
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:8174
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:8026
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:7905
void execute(Enumerable< SharedPtr< const ICommandBuffer > > commandBuffers) const
Executes a series of secondary command buffers/bundles.
Definition rendering_api.hpp:8569
void use(const IPipeline &pipeline) const noexcept
Sets the active pipeline state.
Definition rendering_api.hpp:8118
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:7833
void copyAccelerationStructure(const IBottomLevelAccelerationStructure &from, const IBottomLevelAccelerationStructure &to, bool compress=false) const noexcept
Copies the acceleration structure from into the acceleration structure to .
Definition rendering_api.hpp:8650
virtual void dispatch(const Vector3u &threadGroupCount) const noexcept=0
Executes a compute shader.
void drawIndexedIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect indexed draw calls.
Definition rendering_api.hpp:8466
void 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:7850
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:7951
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:8274
void dispatchIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect dispatches.
Definition rendering_api.hpp:8285
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:8365
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:8318
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:7866
void drawIndirect(const IBuffer &batchBuffer, UInt32 batchCount, UInt64 offset=0) const noexcept
Executes a set of indirect non-indexed draw calls.
Definition rendering_api.hpp:8400
UniquePtr< IBarrier > makeBarrier(PipelineStage syncBefore, PipelineStage syncAfter) const
Creates a new barrier instance.
Definition rendering_api.hpp:7778
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:8198
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:8230
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:8183
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:8142
void bind(const IIndexBuffer &buffer) const
Binds a index buffer to the pipeline.
Definition rendering_api.hpp:8257
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:8065
void buildAccelerationStructure(IBottomLevelAccelerationStructure &blas, const SharedPtr< const IBuffer > &scratchBuffer, const IBuffer &buffer, UInt64 offset=0) const
Builds a bottom-level acceleration structure.
Definition rendering_api.hpp:8585
virtual void draw(UInt32 vertices, UInt32 instances=1, UInt32 firstVertex=0, UInt32 firstInstance=0) const noexcept=0
Draws a number of vertices from the currently bound vertex buffer.
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:8479
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:8331
The interface for a command queue.
Definition rendering_api.hpp:9742
ICommandQueue() noexcept=default
Event< QueueSubmittingEventArgs > submitting
Invoked, when one or more command buffers are submitted to the queue.
Definition rendering_api.hpp:9860
Event< QueueSubmittedEventArgs > submitted
Invoked, after one or more command buffers have been submitted to the queue.
Definition rendering_api.hpp:9865
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:9836
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:9880
virtual void setDebugMarker(const String &label, const Vectors::ByteVector3 &color=DEFAULT_DEBUG_COLOR) const noexcept
Inserts a debug marker.
Definition rendering_api.hpp:9854
UInt64 submit(const SharedPtr< const ICommandBuffer > &commandBuffer) const
Submits a single command buffer with shared ownership and inserts a fence to wait for it.
Definition rendering_api.hpp:9896
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:9928
virtual void endDebugRegion() const noexcept
Ends the current debug region.
Definition rendering_api.hpp:9844
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:9951
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:9912
The interface for a compute pipeline.
Definition rendering_api.hpp:8795
IComputePipeline() noexcept=default
Describes a the layout of a single descriptor within a DescriptorSet.
Definition rendering_api.hpp:4641
IDescriptorLayout() noexcept=default
The interface for a descriptor set.
Definition rendering_api.hpp:6064
UInt32 bindToHeap(UInt32 descriptor, const ISampler &sampler) const
Binds a sampler directly to a descriptor heap and returns the index that can be used to access it.
Definition rendering_api.hpp:6141
UInt32 bindToHeap(DescriptorType bindingType, UInt32 descriptor, const IImage &image, UInt32 firstLevel=0, UInt32 levels=0, UInt32 firstLayer=0, UInt32 layers=0) const
Binds a resource directly to a descriptor heap and returns the index that can be used to access it.
Definition rendering_api.hpp:6124
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:6179
void update(UInt32 binding, const IAccelerationStructure &accelerationStructure, UInt32 descriptor=0) const
Updates an acceleration structure within the current descriptor set.
Definition rendering_api.hpp:6199
void update(UInt32 binding, const IBuffer &buffer, UInt32 bufferElement=0, UInt32 elements=0, UInt32 firstDescriptor=0, Format texelFormat=Format::None) const
Updates one or more buffer descriptors within the current descriptor set.
Definition rendering_api.hpp:6154
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:6189
The interface for a descriptor set layout.
Definition rendering_api.hpp:6290
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:6445
UniquePtr< IDescriptorSet > allocate(UInt32 descriptors, Generator< DescriptorBinding > bindings) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:6473
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:6541
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:6514
Generator< UniquePtr< IDescriptorSet > > allocate(UInt32 descriptorSets, std::function< Generator< DescriptorBinding >(UInt32)> bindingFactory) const
Allocates an array of descriptor sets.
Definition rendering_api.hpp:6502
UniquePtr< IDescriptorSet > allocate(Span< DescriptorBinding > bindings) const
Definition rendering_api.hpp:6440
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:6484
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:6533
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:6457
UniquePtr< IDescriptorSet > allocate(UInt32 descriptors, Span< DescriptorBinding > bindings) const
Definition rendering_api.hpp:6462
Describes a chunk of device memory.
Definition rendering_api.hpp:4758
virtual bool volatileMove() const noexcept
Returns true, if the contents of the resource should not be copied during a move.
Definition rendering_api.hpp:4989
IDeviceMemory() noexcept=default
The interface for a frame buffer.
Definition rendering_api.hpp:8903
Event< ResizeEventArgs > resized
Invoked after the frame buffer has been resized.
Definition rendering_api.hpp:9000
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:9094
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:9236
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:9203
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:9272
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:9191
Event< ResizeEventArgs > resizing
Invoked if the frame buffer gets resized.
Definition rendering_api.hpp:8993
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.
std::function< SharedPtr< const TImage >(Optional< UInt64 >, Size2d, ResourceUsage, Format, MultiSamplingLevel, const String &)> allocation_callback_type
A function that gets invoked as a callback, if the frame buffer needs to allocate an image.
Definition rendering_api.hpp:8925
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:9180
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:9248
Enumerable< const IImage & > images() const
Returns all images contained by the frame buffer.
Definition rendering_api.hpp:9112
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:9011
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:9225
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:3222
IGraphicsAdapter() noexcept=default
The interface for a graphics device that.
Definition rendering_api.hpp:11050
void bindGlobalDescriptorHeaps(const ICommandBuffer &commandBuffer) const noexcept
Binds the global descriptor heap.
Definition rendering_api.hpp:11272
SharedPtr< IFrameBuffer > makeFrameBuffer(const Size2d &renderArea) const
Creates a new frame buffer instance.
Definition rendering_api.hpp:11152
void bindDescriptorSet(const ICommandBuffer &commandBuffer, const IDescriptorSet &descriptorSet, const IPipeline &pipeline) const noexcept
Binds the descriptors of the descriptor set to the global descriptor heaps.
Definition rendering_api.hpp:11264
void releaseGlobalDescriptors(const IDescriptorSet &descriptorSet) const
Releases a range of descriptors from the global descriptor heaps.
Definition rendering_api.hpp:11239
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:11133
VirtualAllocator::Allocation allocateGlobalDescriptors(const IDescriptorSet &descriptorSet, DescriptorHeapType heapType) const
Allocates a range of descriptors in the global descriptor heaps for the provided descriptorSet .
Definition rendering_api.hpp:11226
void updateGlobalDescriptors(const IDescriptorSet &descriptorSet, UInt32 binding, UInt32 offset, UInt32 descriptors) const
Updates a range of descriptors in the global buffer descriptor heap with the descriptors from descrip...
Definition rendering_api.hpp:11250
UniquePtr< IBarrier > makeBarrier(PipelineStage syncBefore, PipelineStage syncAfter) const
Creates a memory barrier instance.
Definition rendering_api.hpp:11143
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:11216
SharedPtr< IFrameBuffer > makeFrameBuffer(StringView name, const Size2d &renderArea) const
Creates a new frame buffer instance.
Definition rendering_api.hpp:11162
The interface for a graphics factory.
Definition rendering_api.hpp:10120
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer of type type .
Definition rendering_api.hpp:10444
SharedPtr< IBuffer > createBuffer(const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer of type type .
Definition rendering_api.hpp:10428
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer of type type .
Definition rendering_api.hpp:10289
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10580
SharedPtr< IIndexBuffer > createIndexBuffer(const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates an index buffer, based on the layout .
Definition rendering_api.hpp:10664
SharedPtr< IBuffer > createBuffer(const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10459
UniquePtr< IBottomLevelAccelerationStructure > createBottomLevelAccelerationStructure(AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a bottom-level acceleration structure.
Definition rendering_api.hpp:10877
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10545
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:10845
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10413
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10319
UniquePtr< ITopLevelAccelerationStructure > createTopLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a top-level acceleration structure.
Definition rendering_api.hpp:10918
SharedPtr< IBuffer > createBuffer(const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10303
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10350
SharedPtr< IVertexBuffer > createVertexBuffer(const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a vertex buffer, based on the layout .
Definition rendering_api.hpp:10598
SharedPtr< IBuffer > createBuffer(BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer of type type .
Definition rendering_api.hpp:10274
bool tryCreateTexture(SharedPtr< IImage > &image, Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a texture.
Definition rendering_api.hpp:10750
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10511
SharedPtr< IImage > createTexture(Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a texture.
Definition rendering_api.hpp:10733
SharedPtr< IBuffer > createBuffer(const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10528
IGraphicsFactory() noexcept=default
bool tryCreateIndexBuffer(SharedPtr< IIndexBuffer > &buffer, const String &name, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create an index buffer, based on the layout .
Definition rendering_api.hpp:10712
Generator< SharedPtr< ISampler > > createSamplers(FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
Creates a series of texture samplers.
Definition rendering_api.hpp:10864
virtual bool canAlias(Enumerable< const ResourceAllocationInfo & > allocationInfos) const =0
Checks if the resources described by allocationInfos can be overlapped.
virtual bool supportsResizableBaseAddressRegister() const noexcept=0
Returns true, if the GPU supports resizable base address register (ReBAR) and false otherwise.
SharedPtr< IBuffer > createBuffer(const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10397
bool tryCreateTexture(SharedPtr< IImage > &image, 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, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a texture.
Definition rendering_api.hpp:10790
bool tryCreateVertexBuffer(SharedPtr< IVertexBuffer > &buffer, const String &name, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a vertex buffer, based on the layout .
Definition rendering_api.hpp:10646
SharedPtr< IBuffer > createBuffer(const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10493
SharedPtr< IIndexBuffer > createIndexBuffer(const String &name, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates an index buffer, based on the layout .
Definition rendering_api.hpp:10697
SharedPtr< ISampler > createSampler(FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
Creates a texture sampler.
Definition rendering_api.hpp:10825
SharedPtr< IBuffer > createBuffer(const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10334
bool tryCreateVertexBuffer(SharedPtr< IVertexBuffer > &buffer, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a vertex buffer, based on the layout .
Definition rendering_api.hpp:10612
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, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10562
SharedPtr< IVertexBuffer > createVertexBuffer(const String &name, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a vertex buffer, based on the layout .
Definition rendering_api.hpp:10631
UniquePtr< IBottomLevelAccelerationStructure > createBottomLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a bottom-level acceleration structure.
Definition rendering_api.hpp:10891
Generator< SharedPtr< IImage > > createTextures(Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 layers=1, UInt32 levels=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a series of textures.
Definition rendering_api.hpp:10806
SharedPtr< IBuffer > createBuffer(const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10366
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, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Creates a texture.
Definition rendering_api.hpp:10772
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a specific descriptor.
Definition rendering_api.hpp:10476
UniquePtr< ITopLevelAccelerationStructure > createTopLevelAccelerationStructure(AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
Creates a top-level acceleration structure.
Definition rendering_api.hpp:10904
bool tryCreateBuffer(SharedPtr< IBuffer > &buffer, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
Definition rendering_api.hpp:10382
bool tryCreateIndexBuffer(SharedPtr< IIndexBuffer > &buffer, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
Tries to create an index buffer, based on the layout .
Definition rendering_api.hpp:10678
virtual Generator< ResourceAllocationResult > allocate(Enumerable< const ResourceAllocationInfo & > allocationInfos, AllocationBehavior allocationBehavior=AllocationBehavior::Default, bool alias=false) const =0
Allocates a set of resources as described by allocationInfos .
Describes a generic image.
Definition rendering_api.hpp:5019
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:5123
IImage() noexcept=default
The interface for an index buffer.
Definition rendering_api.hpp:5236
IIndexBuffer() noexcept=default
Describes a index buffer layout.
Definition rendering_api.hpp:4603
IIndexBufferLayout() noexcept=default
Allows for data to be mapped into the object.
Definition rendering_api.hpp:4692
IMappable() noexcept=default
The interface for a pipeline.
Definition rendering_api.hpp:7646
IPipeline() noexcept=default
SharedPtr< const IPipelineLayout > layout() const noexcept
Returns the layout of the render pipeline.
Definition rendering_api.hpp:7670
The interface for a pipeline layout.
Definition rendering_api.hpp:7538
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:6609
IPushConstantsLayout() noexcept=default
Describes a range within a IPushConstantsLayout.
Definition rendering_api.hpp:6561
IPushConstantsRange() noexcept=default
Represents the rasterizer state of a RenderPipeline.
Definition rendering_api.hpp:3941
IRasterizer() noexcept=default
The interface for a ray tracing pipeline.
Definition rendering_api.hpp:8810
IRayTracingPipeline() noexcept=default
The interface to access a render backend.
Definition rendering_api.hpp:11305
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:11357
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:11366
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:9292
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:9393
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:9369
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:9381
IRenderPass() noexcept=default
virtual UInt64 end() const =0
Ends the render pass.
virtual UInt32 viewMask() const noexcept=0
Returns the mask that identifies the views that are enabled during rendering.
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:8725
SharedPtr< IRasterizer > rasterizer() const noexcept
Returns the rasterizer state used by the render pipeline.
Definition rendering_api.hpp:8749
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:3427
IRenderTarget() noexcept=default
Describes a texture sampler.
Definition rendering_api.hpp:5135
ISampler() noexcept=default
The interface of a scissor.
Definition rendering_api.hpp:4207
IScissor() noexcept=default
Represents a single shader module, i.e. a part of a IShaderProgram.
Definition rendering_api.hpp:3363
IShaderModule() noexcept=default
The interface for a shader program.
Definition rendering_api.hpp:7437
Enumerable< const IShaderModule & > modules() const
Returns the modules, the shader program is build from.
Definition rendering_api.hpp:7488
ShaderRecordCollection buildShaderRecordCollection() const noexcept
Builds a shader record collection based on the current shader program.
Definition rendering_api.hpp:7526
IShaderProgram() noexcept=default
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:7469
SharedPtr< IPipelineLayout > reflectPipelineLayout(Enumerable< PipelineBindingHint > hints={}) const
Uses shader reflection to extract the pipeline layout of a shader. May not be available in all backen...
Definition rendering_api.hpp:7518
bool contains(const IShaderModule &module) const
Returns true, if the program contains the provided shader module and false otherwise.
Definition rendering_api.hpp:7479
The interface for a state resource.
Definition rendering_api.hpp:2625
IStateResource() noexcept=default
Represents a surface to render to.
Definition rendering_api.hpp:3294
ISurface() noexcept=default
Interface for a swap chain.
Definition rendering_api.hpp:9484
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:9701
virtual Enumerable< Format > getSurfaceFormats() const =0
Returns an array of supported formats, that can be drawn to the surface.
Event< BackBufferSwapEventArgs > swapped
Invoked, when the swap chain has swapped the back buffers.
Definition rendering_api.hpp:9695
ISwapChain() noexcept=default
virtual Format surfaceFormat() const noexcept=0
Returns the swap chain image format.
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:5681
void addInstance(const SharedPtr< const IBottomLevelAccelerationStructure > &blas, const TMatrix3x4< Float > &transform, UInt32 id, UInt32 hitGroupOffset=0, UInt8 mask=0xFF, InstanceFlags flags=InstanceFlags::None) noexcept
Adds an instance to the TLAS.
Definition rendering_api.hpp:5777
ITopLevelAccelerationStructure() noexcept=default
auto withInstance(this TSelf &&self, const Instance &instance) noexcept -> TSelf &&
Adds an instance to the current TLAS.
Definition rendering_api.hpp:5838
virtual void clear() noexcept=0
Clears all instances from the acceleration structure.
auto withInstance(this TSelf &&self, const SharedPtr< const IBottomLevelAccelerationStructure > &blas, const TMatrix3x4< Float > &transform, UInt32 id, UInt32 hitGroupOffset=0, UInt8 mask=0xFF, InstanceFlags flags=InstanceFlags::None) noexcept -> TSelf &&
Adds an instance to the current TLAS.
Definition rendering_api.hpp:5869
auto withInstance(this TSelf &&self, const SharedPtr< const IBottomLevelAccelerationStructure > &blas, UInt32 id, UInt32 hitGroupOffset=0, UInt8 mask=0xFF, InstanceFlags flags=InstanceFlags::None) noexcept -> TSelf &&
Adds an instance to the current TLAS.
Definition rendering_api.hpp:5853
The interface for a vertex buffer.
Definition rendering_api.hpp:5214
IVertexBuffer() noexcept=default
Describes a vertex buffer layout.
Definition rendering_api.hpp:4574
IVertexBufferLayout() noexcept=default
Interface for a viewport.
Definition rendering_api.hpp:4089
IViewport() noexcept=default
Describes an index buffer.
Definition rendering.hpp:501
Implements a IRasterizer.
Definition rendering_api.hpp:4006
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:1042
Represents a mapping between a set of RenderTarget instances and the input attachments of a IRenderPa...
Definition rendering_api.hpp:3684
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:3584
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:4235
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:6923
void addShaderRecord(const ShaderRecord<>::shader_group_type &shaderGroup)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:7068
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:7017
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:7092
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:7055
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:7037
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:7109
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:7134
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:7120
void addShaderRecord(ShaderRecord< TLocalData >::shader_group_type shaderGroup, TLocalData payload)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:7079
ShaderRecordCollection && withShaderRecord(ShaderRecord< TLocalData >::shader_group_type shaderGroup, TLocalData payload)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:7157
ShaderRecordCollection()=delete
ShaderRecordCollection && withShaderRecord(ShaderRecord<>::shader_group_type shaderGroup)
Adds a new shader record to the shader record collection.
Definition rendering_api.hpp:7144
Base class for a resource that can be identified by a name string within a DeviceState.
Definition rendering_api.hpp:2650
StateResource(StateResource &&) noexcept
An event that is used to measure timestamps in a command queue.
Definition rendering_api.hpp:4371
~TimingEvent() noexcept override
Releases the render target instance.
Describes a vertex buffer.
Definition rendering.hpp:477
Implements a viewport.
Definition rendering_api.hpp:4141
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.
Represents a virtual allocator that manages memory distribution from a piece of raw memory.
Definition rendering_api.hpp:3032
VirtualAllocator(const VirtualAllocator &)=delete
Allocation allocate(UInt64 size, UInt32 alignment=1u, AllocationStrategy strategy=AllocationStrategy::OptimizePacking, void *privateData=nullptr) const
Allocates a piece of memory of size bytes, aligned to alignment .
Definition rendering_api.hpp:3190
AllocationAlgorithm algorithm() const noexcept
Returns the algorithm used by the allocator.
Definition rendering_api.hpp:3178
void * privateData(const Allocation &allocation) const
Returns the private data associated with an allocation.
Definition rendering_api.hpp:3210
void free(Allocation &&allocation) const
Releases an allocation from the allocator, so that its memory can be re-used later.
Definition rendering_api.hpp:3201
VirtualAllocator(VirtualAllocator &&) noexcept=delete
UInt64 size() const noexcept
Returns the size of the memory managed by the virtual allocator.
Definition rendering_api.hpp:3170
Implements the IResource interface.
Definition containers.hpp:823
An exception that is thrown, if a requested operation could not be executed.
Definition exceptions.hpp:235
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:11378
uint16_t UInt16
A type for an unsigned 16 bit integer.
Definition math.hpp:51
uint8_t UInt8
A type for an unsigned 8 bit integer.
Definition math.hpp:41
uint64_t UInt64
A type for an unsigned 64 bit integer.
Definition math.hpp:71
float_t Float
A type for a floating point value with single precision.
Definition math.hpp:76
uint32_t UInt32
A type for an unsigned 32 bit integer.
Definition math.hpp:61
int32_t Int32
A type for a signed 32 bit integer.
Definition math.hpp:56
BorderMode
Describes how to treat texture coordinates that are outside the domain [0..1].
Definition rendering_api.hpp:1356
@ 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:1190
@ CounterClockWise
Vertices are evaluated in a counter clock-wise manner.
@ ClockWise
Vertices are evaluated in a clock-wise manner.
DescriptorHeapType
The target heap type for a descriptor.
Definition rendering_api.hpp:580
RenderTargetFlags
Describes the behavior of render targets.
Definition rendering_api.hpp:1228
@ 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:1858
@ 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:1341
BlendFactor
Specifies a blend factor.
Definition rendering_api.hpp:1479
@ OneMinusDestinationColor
@ OneMinusDestinationAlpha
CullMode
Describes which faces are culled by the Rasterizer stage.
Definition rendering_api.hpp:1163
@ 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:971
@ 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:1205
@ 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:2099
GraphicsAdapterType
Defines different types of graphics adapters.
Definition rendering_api.hpp:76
@ 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:1387
@ 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:1531
IndexType
Describes the element type of an index buffer.
Definition rendering_api.hpp:906
PrimitiveTopology
Describes the topology of a mesh primitive.
Definition rendering_api.hpp:937
@ 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:1111
@ 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:1142
@ 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:601
@ 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).
DefragmentationStrategy
The strategy to apply to a defragmentation pass.
Definition rendering_api.hpp:886
@ Full
Provides optimal packing at the cost of potentially more copies.
@ Balanced
Provides a balance between fragment computation time and packing efficiency.
@ Fast
Provides fast fragment computation, but potentially suboptimal packing.
InstanceFlags
Controls how an instance within a ITopLevelAccelerationStructure behaves during ray-tracing.
Definition rendering_api.hpp:2029
@ 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:372
@ BlendIndices
The attribute contains blend indices.
@ PointSize
The attribute contains a point size.
@ Binormal
The attribute contains a bi-normal vector.
@ Arbitrary
The attribute contains arbitrary data, that does not have any semantic associated with it.
@ 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:2107
ResourceUsage
Describes the intended usage for a resource.
Definition rendering_api.hpp:761
@ FrameBufferImage
Default usage for frame buffer images.
@ Volatile
Causes the contents of the resource to not be copied during defragmentation.
@ 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:1966
@ 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:1258
@ 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:2284
AllocationAlgorithm
The allocation algorithm used by VirtualAllocators.
Definition rendering_api.hpp:852
@ Linear
A linear allocation algorithm, that allocates memory blocks sequentially.
DescriptorType
Describes the type of a IDescriptor.
Definition rendering_api.hpp:442
@ RWStructuredBuffer
A writable shader storage object in Vulkan. Maps to a read/write structured buffer in DirectX.
@ SamplerDescriptorHeap
A special descriptor type that allows indexed access to the a portion of the global sampler heap.
@ 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.
@ ResourceDescriptorHeap
Special descriptor type, that can bind all resources besides constant buffers, acceleration structure...
@ 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.
AllocationStrategy
The allocation strategy used by allocators (IGraphicsFactory and VirtualAllocator) when allocating ne...
Definition rendering_api.hpp:869
@ OptimizeTime
Prefers allocation time over packing.
@ OptimizePacking
Prefers good packing over allocation time and reduces fragmentation.
QueuePriority
Specifies the priority with which a queue is scheduled on the GPU.
Definition rendering_api.hpp:160
@ 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:114
@ 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:710
@ 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.
@ GPUUpload
Creates a buffer that is directly allocated in GPU memory, but that can be efficiently written from t...
StencilOperation
An operation that is applied to the stencil buffer.
Definition rendering_api.hpp:1433
@ 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:1988
@ 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:2321
FilterMode
Describes the filter operation when accessing a pixel from a texture coordinate.
Definition rendering_api.hpp:1324
@ Nearest
Take the nearest texel with respect to the texture coordinate.
AllocationBehavior
Controls the allocation behavior of IGraphicsFactory.
Definition rendering_api.hpp:830
@ DontExpandCache
Does not resize heap cache, if no more pre-allocated memory is available and will fail,...
@ StayWithinBudget
Stays within heap budgets. If the desired resource heap is out of memory, allocation will fail....
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:6763
ShaderRecordType
Describes the type of a shader module record within a shader collection or shader binting table.
Definition rendering_api.hpp:1075
@ HitGroup
Represents a hit group shader record.
VertexBufferInputRate
The rate at which a vertex buffer of a certain IVertexBufferLayout is made available for vertex shade...
Definition rendering_api.hpp:922
PipelineStage
Defines pipeline stages as points where synchronization may occur.
Definition rendering_api.hpp:1545
@ 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:340
constexpr bool hasStencil(Format format) noexcept
Returns true, if the format contains a stencil channel.
Definition rendering_api.hpp:2301
constexpr UInt32 getBufferFormatChannels(BufferFormat format)
Returns the number of channels for a buffer format.
Definition rendering_api.hpp:2091
constexpr size_t getSize(Format format)
Returns the size of an element of a specified format.
Definition rendering_api.hpp:2114
ResourceAccess
Defines how a IBuffer or IImage resource is accessed.
Definition rendering_api.hpp:1709
@ 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:1505
@ 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:183
MultiSamplingLevel
Describes the number of samples with which a IImage is sampled.
Definition rendering_api.hpp:1283
@ 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
void * Handle
Represents a handle type.
Definition containers.hpp:58
Definition input_assembler.cpp:19
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:3797
Describes the rasterizer depth state.
Definition rendering_api.hpp:3758
Describes the rasterizer stencil state.
Definition rendering_api.hpp:3849
Describes a stencil test for either front or back faces.
Definition rendering_api.hpp:3823
Describes a resource binding to a descriptor or descriptor set.
Definition rendering_api.hpp:6218
Variant< std::monostate, Ref< const IBuffer >, Ref< const IImage >, Ref< const ISampler >, Ref< const IAccelerationStructure > > resource_container
Definition rendering_api.hpp:6220
Describes a single descriptor binding point within a IShaderModule.
Definition rendering_api.hpp:3309
bool operator==(const DescriptorBindingPoint &other) const noexcept
Implements equality comparison for descriptor binding points.
Definition rendering_api.hpp:3351
auto operator<=>(const DescriptorBindingPoint &other) const noexcept
Implements three-way comparison for descriptor binding points.
Definition rendering_api.hpp:3331
Defines a single statistics block.
Definition rendering_api.hpp:10044
Stores extended memory statistics, that can be queried by calling IGraphicsFactory::detailedMemorySta...
Definition rendering_api.hpp:10040
Describes optional features that can be supported by a device.
Definition rendering_api.hpp:10983
Stores a buffer that contains axis-aligned bounding boxes.
Definition rendering_api.hpp:5481
GeometryFlags Flags
The flags that control how the primitives in the geometry behaves during ray-tracing.
Definition rendering_api.hpp:5503
SharedPtr< const IBuffer > Buffer
A buffer containing the bounding box definitions.
Definition rendering_api.hpp:5498
Represents a triangle mesh.
Definition rendering_api.hpp:5404
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:5413
~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:9774
QueueSubmittedEventArgs(QueueSubmittedEventArgs &&) noexcept=default
QueueSubmittedEventArgs(UInt64 fence) noexcept
Definition rendering_api.hpp:9779
QueueSubmittedEventArgs(const QueueSubmittedEventArgs &)=default
Event arguments for a ICommandQueue::submitting event.
Definition rendering_api.hpp:9747
QueueSubmittingEventArgs(QueueSubmittingEventArgs &&) noexcept=default
QueueSubmittingEventArgs(Array< SharedPtr< const ICommandBuffer > > &&commandBuffers)
Definition rendering_api.hpp:9752
QueueSubmittingEventArgs(const QueueSubmittingEventArgs &)=default
Stores a reference to a barrier that can be used to synchronize accesses to the resource with a move ...
Definition rendering_api.hpp:4764
PrepareMoveEventArgs(const PrepareMoveEventArgs &)=delete
PrepareMoveEventArgs()=delete
PrepareMoveEventArgs(PrepareMoveEventArgs &&) noexcept=delete
IBarrier & barrier() const noexcept
Returns a reference of the barrier that is used to synchronize the move operation with other accesses...
Definition rendering_api.hpp:4792
Stores the fence and the command queue to wait on for the fence before a moved resource can be used.
Definition rendering_api.hpp:4801
ResourceMovingEventArgs(ResourceMovingEventArgs &&) noexcept=default
ResourceMovingEventArgs(SharedPtr< const ICommandQueue > queue, UInt64 fence) noexcept
Creates a new instance of the resource moving event arguments.
Definition rendering_api.hpp:4812
ResourceMovingEventArgs(const ResourceMovingEventArgs &)=default
UInt64 fence() const noexcept
Returns the fence on queue after which the resource can be used.
Definition rendering_api.hpp:4836
Event arguments that are published to subscribers when a frame buffer gets released.
Definition rendering_api.hpp:8961
ReleasedEventArgs(ReleasedEventArgs &&) noexcept=default
ReleasedEventArgs() noexcept
Definition rendering_api.hpp:8963
ReleasedEventArgs(const ReleasedEventArgs &)=default
Event arguments that are published to subscribers when a frame buffer gets resized.
Definition rendering_api.hpp:8933
ResizeEventArgs(Size2d newSize) noexcept
Definition rendering_api.hpp:8938
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:9298
BeginEventArgs(const IFrameBuffer &frameBuffer) noexcept
Definition rendering_api.hpp:9303
BeginEventArgs(BeginEventArgs &&) noexcept=default
BeginEventArgs(const BeginEventArgs &)=default
Describes the blend state of the render target.
Definition rendering_api.hpp:3432
Describes a hit group for a triangle mesh geometry.
Definition rendering_api.hpp:6672
const IShaderModule * AnyHitShader
The any hit shader for the triangle mesh.
Definition rendering_api.hpp:6681
const IShaderModule * ClosestHitShader
The closest hit shader for the triangle mesh.
Definition rendering_api.hpp:6676
Describes a record within a shader binding table.
Definition rendering_api.hpp:6662
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:6687
Event arguments for a ISwapChain::swapped event.
Definition rendering_api.hpp:9542
BackBufferSwapEventArgs(BackBufferSwapEventArgs &&) noexcept=default
BackBufferSwapEventArgs(UInt32 backBuffer) noexcept
Definition rendering_api.hpp:9547
BackBufferSwapEventArgs(const BackBufferSwapEventArgs &)=default
Event arguments for a ISwapChain::reseted event.
Definition rendering_api.hpp:9489
ResetEventArgs(const ResetEventArgs &)=default
const Size2d & renderArea() const noexcept
Gets the new render area of the swap chain back-buffers.
Definition rendering_api.hpp:9518
ResetEventArgs(Format surfaceFormat, Size2d renderArea, UInt32 buffers, bool enableVsync) noexcept
Definition rendering_api.hpp:9497
ResetEventArgs(ResetEventArgs &&) noexcept=default
UInt32 buffers() const noexcept
Gets the number of back-buffers in the swap chain.
Definition rendering_api.hpp:9526
bool enableVsync() const noexcept
Returns true if vertical synchronization is enabled or false otherwise.
Definition rendering_api.hpp:9534
Represents an instance of an IBottomLevelAccelerationStructure.
Definition rendering_api.hpp:5688
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:5723
UInt32 Id
The instance ID used in shaders to identify the instance.
Definition rendering_api.hpp:5702
InstanceFlags Flags
The flags that control the behavior of this instance.
Definition rendering_api.hpp:5728
UInt8 Mask
A user-defined mask value that is matched with another mask value during ray-tracing to include or di...
Definition rendering_api.hpp:5707
Stores simple memory heap statistics, that can be quickly queried by calling IGraphicsFactory::memory...
Definition rendering_api.hpp:9985
Defines a hint that is used to initialize a dynamic descriptor heap.
Definition rendering_api.hpp:7220
Defines a hint that is used to mark a push constants range.
Definition rendering_api.hpp:7190
Defines a hint that is used to mark additional a binding as used by certain shader stages.
Definition rendering_api.hpp:7244
Defines a hint that is used to bind a static sampler state to a sampler descriptor.
Definition rendering_api.hpp:7201
Defines a hint that is used to mark an unbounded descriptor array.
Definition rendering_api.hpp:7179
A hint used during shader reflection to control the pipeline layout.
Definition rendering_api.hpp:7174
static auto pushConstants(DescriptorBindingPoint at) noexcept -> PipelineBindingHint
Initializes a hint that binds push constants.
Definition rendering_api.hpp:7293
static auto shaderStage(DescriptorBindingPoint at, ShaderStage shaderStages) noexcept -> PipelineBindingHint
Initializes a hint provides additional shader stages, that may be not covered by shader reflection.
Definition rendering_api.hpp:7381
static auto pushConstants(UInt32 space, UInt32 binding) noexcept -> PipelineBindingHint
Initializes a hint that binds push constants.
Definition rendering_api.hpp:7303
static auto staticSampler(UInt32 space, UInt32 binding, SharedPtr< ISampler > sampler) noexcept -> PipelineBindingHint
Initializes a hint that binds a static sampler, if supported by the backend.
Definition rendering_api.hpp:7324
static auto runtimeArray(DescriptorBindingPoint at, UInt32 maxDescriptors) noexcept -> PipelineBindingHint
Initializes a hint that binds an unbounded runtime array.
Definition rendering_api.hpp:7273
Variant< std::monostate, UnboundedArrayHint, PushConstantsHint, StaticSamplerHint, DescriptorHeapHint, ShaderStageHint > hint_type
Defines the type of the pipeline binding hint.
Definition rendering_api.hpp:7254
static auto shaderStage(UInt32 space, UInt32 binding, ShaderStage shaderStages) noexcept -> PipelineBindingHint
Initializes a hint provides additional shader stages, that may be not covered by shader reflection.
Definition rendering_api.hpp:7393
static auto staticSampler(DescriptorBindingPoint at, SharedPtr< ISampler > sampler) noexcept -> PipelineBindingHint
Initializes a hint that binds a static sampler, if supported by the backend.
Definition rendering_api.hpp:7313
static auto samplerHeap(DescriptorBindingPoint at, UInt32 heapSize) noexcept -> PipelineBindingHint
Initializes a hint that binds a proxy descriptor set to access the sampler heap at the provided bindi...
Definition rendering_api.hpp:7358
static auto runtimeArray(UInt32 space, UInt32 binding, UInt32 maxDescriptors) noexcept -> PipelineBindingHint
Initializes a hint that binds an unbounded runtime array.
Definition rendering_api.hpp:7284
static auto resourceHeap(UInt32 space, UInt32 binding, UInt32 heapSize) noexcept -> PipelineBindingHint
Initializes a hint that binds a proxy descriptor set to access the resource heap at the provided bind...
Definition rendering_api.hpp:7347
static auto samplerHeap(UInt32 space, UInt32 binding, UInt32 heapSize) noexcept -> PipelineBindingHint
Initializes a hint that binds a proxy descriptor set to access the sampler heap at the provided bindi...
Definition rendering_api.hpp:7370
static auto resourceHeap(DescriptorBindingPoint at, UInt32 heapSize) noexcept -> PipelineBindingHint
Initializes a hint that binds a proxy descriptor set to access the resource heap at the provided bind...
Definition rendering_api.hpp:7335
Stores information about a buffer resource allocation.
Definition rendering_api.hpp:2419
Stores information about an image resource allocation.
Definition rendering_api.hpp:2463
Contains the parameters for a resource allocation.
Definition rendering_api.hpp:2413
ResourceAllocationInfo(const BufferInfo &bufferInfo, ResourceUsage usage=ResourceUsage::Default, String name="", size_t aliasingOffset=0u)
Creates a new resource allocation info instance for a buffer resource.
Definition rendering_api.hpp:2530
ResourceAllocationInfo(const ImageInfo &imageInfo, ResourceUsage usage=ResourceUsage::Default, String name="", size_t aliasingOffset=0u)
Creates a new resource allocation info instance for an image resource.
Definition rendering_api.hpp:2540
ResourceAllocationInfo(ResourceAllocationInfo &&) noexcept=default
ResourceAllocationInfo()=default
Creates a new resource allocation info instance.
ResourceAllocationInfo(const ResourceAllocationInfo &)=default
Stores the result of a resource allocation.
Definition rendering_api.hpp:2555
ResourceAllocationResult()=delete
ResourceAllocationResult(ResourceAllocationResult &&) noexcept=default
ResourceAllocationResult(SharedPtr< IImage > &&image) noexcept
Initializes an allocation result for an image resource.
Definition rendering_api.hpp:2564
ResourceAllocationResult(const ResourceAllocationResult &)=delete
ResourceAllocationResult(SharedPtr< IBuffer > &&buffer) noexcept
Initializes an allocation result for a buffer resource.
Definition rendering_api.hpp:2571
SharedPtr< TBuffer > buffer() const
Returns the allocated buffer resource, or raises an exception if the allocation does not contain a bu...
Definition rendering_api.hpp:2608
Describes the offsets and sizes of a shader group within a shader binding table buffer.
Definition rendering_api.hpp:4291
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:6800
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:6805
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:6780
constexpr const shader_group_type & shaderGroup() const noexcept override
Returns the shader group containing the modules for this record.
Definition rendering_api.hpp:6795
Denotes a shader record containing no shader-local data.
Definition rendering_api.hpp:6854
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:6876
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:6871
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:6866
IShaderRecord::shader_group_type shader_group_type
Definition rendering_api.hpp:6856
constexpr ShaderRecord(ShaderRecord &&_other) noexcept=default
Takes over another shader record.
Defines a generic shader record.
Definition rendering_api.hpp:6758
Represents an allocation within the memory managed by the virtual allocator.
Definition rendering_api.hpp:3037
An allocator used to allocate the shared object.
Definition containers.hpp:1098
Definition alloc_buffer.cpp:13