3#include <litefx/rendering.hpp>
6#include "dx12_formatters.hpp"
9#pragma warning(disable:4250)
23 LITEFX_BUILDER(DirectX12VertexBufferLayoutBuilder);
105 size_t elementSize() const noexcept override;
108 UInt32 binding() const noexcept override;
169 IndexType indexType() const noexcept override;
174 size_t elementSize() const noexcept override;
177 UInt32 binding() const noexcept override;
219 virtual const D3D12_VERTEX_BUFFER_VIEW& view() const noexcept = 0;
239 virtual const D3D12_INDEX_BUFFER_VIEW& view() const noexcept = 0;
354 UInt64 offset() const noexcept override;
357 UInt64 size() const noexcept override;
365 void addTriangleMesh(const
TriangleMesh& mesh) override;
374 void clear() noexcept override;
377 bool remove(const
TriangleMesh& mesh) noexcept override;
383 Array<D3D12_RAYTRACING_GEOMETRY_DESC> buildInfo() const;
448 UInt64 offset() const noexcept override;
451 UInt64 size() const noexcept override;
459 void addInstance(const
Instance& instance) override;
462 void clear() noexcept override;
465 bool remove(const
Instance& instance) noexcept override;
468 Array<D3D12_RAYTRACING_INSTANCE_DESC> buildInfo() const;
486 LITEFX_BUILDER(DirectX12BarrierBuilder);
490 using base_type::transition;
606 const
String& fileName() const noexcept override;
609 const
String& entryPoint() const noexcept override;
625 LITEFX_BUILDER(DirectX12ShaderProgramBuilder);
689 return std::static_pointer_cast<IPipelineLayout>(this->reflectPipelineLayout(hints));
702 using base_type::update;
766 virtual const ComPtr<ID3D12DescriptorHeap> localHeap(
DescriptorHeapType heapType) const noexcept;
824 bool local() const noexcept;
832 UInt32 descriptors() const noexcept override;
835 bool unbounded() const noexcept override;
843 size_t elementSize() const noexcept override;
846 UInt32 binding() const noexcept override;
859 LITEFX_BUILDER(DirectX12DescriptorSetLayoutBuilder);
865 using base_type::free;
866 using base_type::allocate;
942 const
Array<DirectX12DescriptorLayout>& descriptors() const noexcept override;
945 const DirectX12DescriptorLayout& descriptor(
UInt32 binding) const override;
948 UInt32 space() const noexcept override;
951 ShaderStage shaderStages() const noexcept override;
954 UInt32 uniforms() const noexcept override;
957 UInt32 storages() const noexcept override;
960 UInt32 images() const noexcept override;
963 UInt32 buffers() const noexcept override;
966 UInt32 samplers() const noexcept override;
969 UInt32 staticSamplers() const noexcept override;
972 UInt32 inputAttachments() const noexcept override;
975 bool containsUnboundedArray() const noexcept override;
981 bool bindsResources() const noexcept override;
984 bool bindsSamplers() const noexcept override;
999#ifdef __cpp_lib_mdspan
1008 void free(
const DirectX12DescriptorSet& descriptorSet)
const override;
1047 UInt32 space() const noexcept override;
1050 UInt32 binding() const noexcept override;
1053 UInt32 offset() const noexcept override;
1056 UInt32 size() const noexcept override;
1075 LITEFX_BUILDER(DirectX12PushConstantsLayoutBuilder);
1110 UInt32 size() const noexcept override;
1132 LITEFX_BUILDER(DirectX12PipelineLayoutBuilder);
1192 const DirectX12Device& device() const noexcept ;
1195 const DirectX12DescriptorSetLayout& descriptorSet(
UInt32 space) const override;
1198 const
Array<
SharedPtr<const DirectX12DescriptorSetLayout>>& descriptorSets() const override;
1201 const DirectX12PushConstantsLayout* pushConstants() const noexcept override;
1204 bool dynamicResourceHeapAccess() const override;
1207 bool dynamicSamplerHeapAccess() const override;
1241 Optional<
UInt32> rootParameterIndex(const DirectX12PushConstantsRange& range) const noexcept;
1250 LITEFX_BUILDER(DirectX12InputAssemblerBuilder);
1310 static inline auto create() {
1319 const DirectX12VertexBufferLayout& vertexBufferLayout(
UInt32 binding)
const override;
1322 const DirectX12IndexBufferLayout* indexBufferLayout() const noexcept override;
1333 LITEFX_BUILDER(DirectX12RasterizerBuilder);
1401 static inline auto create() {
1413 using ComResource<ID3D12PipelineState>::ComResource;
1441 using base_type::dispatch;
1442 using base_type::dispatchIndirect;
1443 using base_type::dispatchMesh;
1444 using base_type::draw;
1445 using base_type::drawIndirect;
1446 using base_type::drawIndexed;
1447 using base_type::drawIndexedIndirect;
1448 using base_type::barrier;
1449 using base_type::transfer;
1450 using base_type::bind;
1451 using base_type::use;
1452 using base_type::pushConstants;
1453 using base_type::buildAccelerationStructure;
1454 using base_type::updateAccelerationStructure;
1455 using base_type::copyAccelerationStructure;
1500 void begin() const override;
1503 void end() const override;
1518 bool isSecondary() const noexcept override;
1521 void setViewports(
Span<const
IViewport*> viewports) const override;
1524 void setViewports(const
IViewport* viewport) const override;
1527 void setScissors(
Span<const
IScissor*> scissors) const override;
1530 void setScissors(const
IScissor* scissor) const override;
1533 void setBlendFactors(const
Vector4f& blendFactors) const noexcept override;
1536 void setStencilRef(
UInt32 stencilRef) const noexcept override;
1539 void setDepthBounds(
Float minBounds,
Float maxBounds) const noexcept override;
1542 UInt64 submit() const override;
1554 void transfer(const
void* const data,
size_t size, const
IDirectX12Buffer& target,
UInt32 targetElement = 0,
UInt32 elements = 1) const override;
1557 void transfer(
Span<const
void* const> data,
size_t elementSize, const
IDirectX12Buffer& target,
UInt32 firstElement = 0) const override;
1563 void transfer(const
void* const data,
size_t size, const
IDirectX12Image& target,
UInt32 subresource = 0) const override;
1566 void transfer(
Span<const
void* const> data,
size_t elementSize, const
IDirectX12Image& target,
UInt32 firstSubresource = 0,
UInt32 subresources = 1) const override;
1608 void dispatch(const
Vector3u& threadCount) const noexcept override;
1617 void dispatchMesh(const
Vector3u& threadCount) const noexcept override;
1626 void draw(
UInt32 vertices,
UInt32 instances = 1,
UInt32 firstVertex = 0,
UInt32 firstInstance = 0) const noexcept override;
1635 void drawIndexed(
UInt32 indices,
UInt32 instances = 1,
UInt32 firstIndex = 0,
Int32 vertexOffset = 0,
UInt32 firstInstance = 0) const noexcept override;
1678 return std::static_pointer_cast<const ICommandQueue>(this->queue());
1681 void releaseSharedState()
const override;
1694 using base_type::submit;
1748 QueueType type() const noexcept override;
1750#if defined(LITEFX_BUILD_SUPPORT_DEBUG_MARKERS) && defined(LITEFX_BUILD_WITH_PIX_RUNTIME)
1756 void endDebugRegion() const noexcept override;
1759 void setDebugMarker(const
String& label, const Vectors::ByteVector3& color = DEFAULT_DEBUG_COLOR) const noexcept override;
1773 void waitFor(
UInt64 fence)
const override;
1779 UInt64 currentFence() const noexcept override;
1782 UInt64 lastCompletedFence() const noexcept override;
1788 if (d3dQueue ==
nullptr) [[unlikely]]
1791 this->waitFor(*d3dQueue, fence);
1802 LITEFX_BUILDER(DirectX12RenderPipelineBuilder);
1858 bool alphaToCoverage() const noexcept override;
1879 LITEFX_BUILDER(DirectX12ComputePipelineBuilder);
1940 LITEFX_BUILDER(DirectX12RayTracingPipelineBuilder);
1993 UInt32 maxRecursionDepth() const noexcept override;
1996 UInt32 maxPayloadSize() const noexcept override;
1999 UInt32 maxAttributeSize() const noexcept override;
2013 ComPtr<ID3D12StateObject> stateObject() const noexcept;
2026 using FrameBuffer::addImage;
2027 using FrameBuffer::mapRenderTarget;
2028 using FrameBuffer::mapRenderTargets;
2098 D3D12_CPU_DESCRIPTOR_HANDLE descriptorHandle(
UInt32 imageIndex)
const;
2106 D3D12_CPU_DESCRIPTOR_HANDLE descriptorHandle(
StringView imageName)
const;
2114 D3D12_CPU_DESCRIPTOR_HANDLE descriptorHandle(
const RenderTarget& renderTarget)
const;
2119 const Size2d& size() const noexcept override;
2122 size_t getWidth() const noexcept override;
2125 size_t getHeight() const noexcept override;
2134 void unmapRenderTarget(const
RenderTarget& renderTarget) noexcept override;
2141 return this->image(index);
2149 return this->image(renderTarget);
2157 return this->resolveImage(hash(renderTargetName));
2162 return this->resolveImage(hash(renderTargetName));
2175 void resize(
const Size2d& renderArea)
override;
2184 LITEFX_BUILDER(DirectX12RenderPassBuilder);
2245 DirectX12RenderPass(DirectX12RenderPass&&) noexcept = delete;
2248 DirectX12RenderPass(const DirectX12RenderPass&) = delete;
2251 DirectX12RenderPass& operator=(DirectX12RenderPass&&) noexcept = delete;
2254 DirectX12RenderPass& operator=(const DirectX12RenderPass&) = delete;
2331 explicit DirectX12RenderPass(
const DirectX12Device& device,
const String& name =
"");
2353 const DirectX12Device& device() const noexcept ;
2356 SharedPtr<const DirectX12FrameBuffer> activeFrameBuffer() const noexcept override;
2359 const DirectX12Queue& commandQueue() const noexcept override;
2365 SharedPtr<const DirectX12CommandBuffer> commandBuffer(
UInt32 index) const override;
2368 UInt32 secondaryCommandBuffers() const noexcept override;
2377 bool hasPresentTarget() const noexcept override;
2389 void begin(const DirectX12FrameBuffer& frameBuffer) const override;
2392 UInt64 end() const override;
2395 UInt32 viewMask() const noexcept override;
2444 virtual
bool supportsVariableRefreshRate() const noexcept;
2450 virtual ID3D12QueryHeap* timestampQueryHeap() const noexcept;
2470 Format surfaceFormat() const noexcept override;
2473 UInt32 buffers() const noexcept override;
2476 const
Size2d& renderArea() const noexcept override;
2479 bool verticalSynchronization() const noexcept override;
2491 void present(
UInt64 fence) const override;
2501 void reset(
Format surfaceFormat, const
Size2d& renderArea,
UInt32 buffers,
bool enableVsync = false) override;
2504 [[nodiscard]]
UInt32 swapBackBuffer() const override;
2517 LITEFX_IMPLEMENTATION(DirectX12GraphicsFactoryImpl);
2523 using base_type::createBuffer;
2524 using base_type::tryCreateBuffer;
2525 using base_type::createVertexBuffer;
2526 using base_type::tryCreateVertexBuffer;
2527 using base_type::createIndexBuffer;
2528 using base_type::tryCreateIndexBuffer;
2529 using base_type::createTexture;
2530 using base_type::tryCreateTexture;
2531 using base_type::createTextures;
2532 using base_type::createSampler;
2533 using base_type::createSamplers;
2534 using base_type::allocate;
2643 SharedPtr<IDirectX12Sampler> 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 override;
2667 class LITEFX_DIRECTX12_API
DirectX12Device final : public
GraphicsDevice<
DirectX12GraphicsFactory,
DirectX12Surface,
DirectX12GraphicsAdapter,
DirectX12SwapChain,
DirectX12Queue,
DirectX12RenderPass,
DirectX12RenderPipeline,
DirectX12ComputePipeline,
DirectX12RayTracingPipeline,
DirectX12Barrier>, public
ComResource<ID3D12Device10> {
2748 void release() noexcept;
2759 ID3D12DescriptorHeap* globalBufferHeap() const noexcept;
2766 ID3D12DescriptorHeap* globalSamplerHeap() const noexcept;
2775 void indirectDrawSignatures(ComPtr<ID3D12CommandSignature>& dispatchSignature, ComPtr<ID3D12CommandSignature>& dispatchMeshSignature, ComPtr<ID3D12CommandSignature>& drawSignature, ComPtr<ID3D12CommandSignature>& drawIndexedSignature) const noexcept;
2812 const DirectX12SwapChain& swapChain() const noexcept override;
2815 DirectX12SwapChain& swapChain() noexcept override;
2818 const DirectX12Surface& surface() const noexcept override;
2821 const DirectX12GraphicsAdapter& adapter() const noexcept override;
2824 const DirectX12GraphicsFactory& factory() const noexcept override;
2827 const DirectX12Queue& defaultQueue(
QueueType type) const override;
2836 [[nodiscard]]
SharedPtr<DirectX12FrameBuffer> makeFrameBuffer(
StringView name, const
Size2d& renderArea) const override;
2839 [[nodiscard]]
SharedPtr<DirectX12FrameBuffer> makeFrameBuffer(
StringView name, const
Size2d& renderArea, DirectX12FrameBuffer::allocation_callback_type allocationCallback) const override;
2846 double ticksPerMillisecond() const noexcept override;
2849 void wait() const override;
2852 void computeAccelerationStructureSizes(const DirectX12BottomLevelAccelerationStructure& blas,
UInt64& bufferSize,
UInt64& scratchSize,
bool forUpdate = false) const override;
2855 void computeAccelerationStructureSizes(const DirectX12TopLevelAccelerationStructure& tlas,
UInt64& bufferSize,
UInt64& scratchSize,
bool forUpdate = false) const override;
2861 void releaseGlobalDescriptors(const DirectX12DescriptorSet& descriptorSet) const override;
2864 void updateGlobalDescriptors(const DirectX12DescriptorSet& descriptorSet,
UInt32 binding,
UInt32 offset,
UInt32 descriptors) const override;
2867 void bindDescriptorSet(const DirectX12CommandBuffer& commandBuffer, const DirectX12DescriptorSet& descriptorSet, const DirectX12PipelineState& pipeline) const noexcept override;
2870 void bindGlobalDescriptorHeaps(const DirectX12CommandBuffer& commandBuffer) const noexcept override;
2872#if defined(LITEFX_BUILD_DEFINE_BUILDERS)
2875 [[nodiscard]] DirectX12RenderPassBuilder buildRenderPass(
UInt32 commandBuffers = 1)
const override;
2878 [[nodiscard]] DirectX12RenderPassBuilder buildRenderPass(
const String& name,
UInt32 commandBuffers = 1)
const override;
2884 [[nodiscard]] DirectX12RenderPipelineBuilder buildRenderPipeline(
const DirectX12RenderPass& renderPass,
const String& name)
const override;
2887 [[nodiscard]] DirectX12ComputePipelineBuilder buildComputePipeline(
const String& name)
const override;
2890 [[nodiscard]] DirectX12RayTracingPipelineBuilder buildRayTracingPipeline(
ShaderRecordCollection&& shaderRecords)
const override;
2893 [[nodiscard]] DirectX12RayTracingPipelineBuilder buildRayTracingPipeline(
const String& name,
ShaderRecordCollection&& shaderRecords)
const override;
2896 [[nodiscard]] DirectX12PipelineLayoutBuilder buildPipelineLayout()
const override;
2899 [[nodiscard]] DirectX12InputAssemblerBuilder buildInputAssembler()
const override;
2902 [[nodiscard]] DirectX12RasterizerBuilder buildRasterizer()
const override;
2905 [[nodiscard]] DirectX12ShaderProgramBuilder buildShaderProgram()
const override;
2908 [[nodiscard]] DirectX12BarrierBuilder buildBarrier()
const override;
2946 void activate() override;
2949 void deactivate() override;
2963 void releaseDevice(const
String& name) override;
2987 virtual
void enableAdvancedSoftwareRasterizer(
bool enable = false);
Definition barrier.cpp:14
Definition command_buffer.cpp:9
Definition compute_pipeline.cpp:10
Definition descriptor_layout.cpp:10
Definition descriptor_set.cpp:9
Definition descriptor_set_layout.cpp:11
Definition frame_buffer.cpp:9
Definition index_buffer_layout.cpp:9
Definition pipeline_layout.cpp:10
Definition push_constants_layout.cpp:10
Definition push_constants_range.cpp:9
Definition ray_tracing_pipeline.cpp:36
Definition render_pass.cpp:16
Definition render_pipeline.cpp:10
Definition shader_module.cpp:9
Definition shader_program.cpp:31
Definition swapchain.cpp:10
Definition vertex_buffer_layout.cpp:10
The base class for an application.
Definition app.hpp:402
Provides access to a resource managed by the class.
Definition containers.hpp:792
An exception that is thrown, if a provided argument is not valid.
Definition exceptions.hpp:60
Implements the DirectX 12 RenderBackend.
Definition dx12.hpp:2915
DirectX12Backend(DirectX12Backend &&) noexcept
Implements a DirectX 12 resource barrier.
Definition dx12.hpp:484
DirectX12Barrier(DirectX12Barrier &&) noexcept
Implements a DirectX 12 bottom-level acceleration structure (BLAS).
Definition dx12.hpp:302
DirectX12BottomLevelAccelerationStructure(DirectX12BottomLevelAccelerationStructure &&) noexcept
Records commands for a DirectX12Queue
Definition dx12.hpp:1435
Implements a DirectX 12 ComputePipeline.
Definition dx12.hpp:1877
DirectX12ComputePipeline(DirectX12ComputePipeline &&) noexcept
Implements a DirectX 12 IDescriptorLayout
Definition dx12.hpp:777
DirectX12DescriptorLayout(DirectX12DescriptorLayout &&) noexcept
Implements a DirectX 12 DescriptorSet.
Definition dx12.hpp:697
DirectX12DescriptorSet(DirectX12DescriptorSet &&) noexcept=delete
Implements a DirectX 12 DescriptorSetLayout.
Definition dx12.hpp:857
static auto create(const DirectX12DescriptorSetLayout &other)
Creates a copy of a DirectX 12 descriptor set layout.
Definition dx12.hpp:919
Implements a DirectX 12 graphics device.
Definition dx12.hpp:2667
static SharedPtr< DirectX12Device > create(const DirectX12Backend &backend, const DirectX12GraphicsAdapter &adapter, UniquePtr< DirectX12Surface > &&surface, Format format, const Size2d &renderArea, UInt32 backBuffers, bool enableVsync=false, GraphicsDeviceFeatures features={}, UInt32 globalBufferHeapSize=D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1, UInt32 globalSamplerHeapSize=D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE)
Initializes the device instance.
Definition dx12.hpp:2728
Implements a DirectX 12 frame buffer.
Definition dx12.hpp:2020
const IDirectX12Image & image(StringView renderTargetName) const override
Resolves a render target name and returns the image mapped to it.The image mapped to the render targe...
Definition dx12.hpp:2161
static SharedPtr< DirectX12FrameBuffer > create(const DirectX12Device &device, const Size2d &renderArea, allocation_callback_type allocationCallback, StringView name="")
Initializes a DirectX 12 frame buffer.
Definition dx12.hpp:2086
const IDirectX12Image & operator[](const RenderTarget &renderTarget) const override
Resolves a render target and returns the image mapped to it.The image mapped to the render target.
Definition dx12.hpp:2148
const IDirectX12Image & operator[](StringView renderTargetName) const override
Resolves a render target name and returns the image mapped to it.The image mapped to the render targe...
Definition dx12.hpp:2156
Implements a DirectX12 IGraphicsAdapter.
Definition dx12_api.hpp:224
A graphics factory that produces objects for a DirectX12Device.
Definition dx12.hpp:2516
SharedPtr< IDirectX12Sampler > 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 override
bool tryCreateTexture(SharedPtr< IDirectX12Image > &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 override
SharedPtr< IDirectX12Sampler > 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 override
SharedPtr< IDirectX12IndexBuffer > createIndexBuffer(const DirectX12IndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
bool endDefragmentationPass() const override
Ends a defragmentation pass.Before calling this method, make sure you have started a defragmentation ...
Generator< ResourceAllocationResult > allocate(Enumerable< const ResourceAllocationInfo & > allocationInfos, AllocationBehavior allocationBehavior=AllocationBehavior::Default, bool alias=false) const override
Allocates a set of resources as described by allocationInfos .If the alias parameter is set to true,...
Generator< SharedPtr< IDirectX12Sampler > > 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 override
UniquePtr< DirectX12TopLevelAccelerationStructure > createTopLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const override
bool tryCreateIndexBuffer(SharedPtr< IDirectX12IndexBuffer > &buffer, const String &name, const DirectX12IndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
SharedPtr< IDirectX12Image > 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 override
UInt64 beginDefragmentationPass() const override
Starts a new defragmentation pass.Before calling this method, make sure you have started a defragment...
UniquePtr< DirectX12BottomLevelAccelerationStructure > createBottomLevelAccelerationStructure(StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const override
bool tryCreateVertexBuffer(SharedPtr< IDirectX12VertexBuffer > &buffer, const DirectX12VertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
VirtualAllocator createAllocator(UInt64 overallMemory, AllocationAlgorithm algorithm=AllocationAlgorithm::Default) const override
Creates a virtual allocator that can be used to manage allocation from a custom block of memory....
SharedPtr< IDirectX12Buffer > createBuffer(const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
bool tryCreateBuffer(SharedPtr< IDirectX12Buffer > &buffer, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
SharedPtr< IDirectX12VertexBuffer > createVertexBuffer(const DirectX12VertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
SharedPtr< IDirectX12IndexBuffer > createIndexBuffer(const String &name, const DirectX12IndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
SharedPtr< IDirectX12Buffer > createBuffer(BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
bool tryCreateTexture(SharedPtr< IDirectX12Image > &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 override
SharedPtr< IDirectX12VertexBuffer > createVertexBuffer(const String &name, const DirectX12VertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
bool canAlias(Enumerable< const ResourceAllocationInfo & > allocationInfos) const override
Checks if the resources described by allocationInfos can be overlapped.true, if the resources descri...
bool tryCreateIndexBuffer(SharedPtr< IDirectX12IndexBuffer > &buffer, const DirectX12IndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
bool tryCreateVertexBuffer(SharedPtr< IDirectX12VertexBuffer > &buffer, const String &name, const DirectX12VertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
void beginDefragmentation(const ICommandQueue &queue, DefragmentationStrategy strategy=DefragmentationStrategy::Balanced, UInt64 maxBytesToMove=0u, UInt32 maxAllocationsToMove=0u) const override
Starts a defragmentation process for the resources allocated from the factory.Defragmentation is an i...
bool tryCreateBuffer(SharedPtr< IDirectX12Buffer > &buffer, const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const override
SharedPtr< IDirectX12Image > 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 override
Generator< SharedPtr< IDirectX12Image > > createTextures(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 override
bool supportsResizableBaseAddressRegister() const noexcept override
Returns true, if the GPU supports resizable base address register (ReBAR) and false otherwise....
Implements a DirectX12 IImage.
Definition image.h:16
Implements a DirectX 12 index buffer layout.
Definition dx12.hpp:119
static auto create(const DirectX12IndexBufferLayout &other)
Creates a copy of an index buffer layout.
Definition dx12.hpp:162
Implements a DirectX 12 PipelineLayout.
Definition dx12.hpp:1130
Defines the base class for DirectX 12 pipeline state objects.
Definition dx12.hpp:1411
DirectX12PipelineState(DirectX12PipelineState &&) noexcept=default
Implements the DirectX 12 PushConstantsLayout.
Definition dx12.hpp:1073
DirectX12PushConstantsLayout(DirectX12PushConstantsLayout &&) noexcept
Implements the DirectX 12 IPushConstantsRange.
Definition dx12.hpp:1015
DirectX12PushConstantsRange(DirectX12PushConstantsRange &&) noexcept
Implements a DirectX 12 command queue.
Definition dx12.hpp:1688
Implements a DirectX 12 IRasterizer.
Definition dx12.hpp:1332
static auto create(const DirectX12Rasterizer &other)
Creates a new DirectX 12 rasterizer state by copying an existing one.
Definition dx12.hpp:1392
Implements a DirectX 12 RayTracingPipeline.
Definition dx12.hpp:1938
DirectX12RayTracingPipeline(DirectX12RayTracingPipeline &&) noexcept
Implements a DirectX 12 render pass.
Definition dx12.hpp:2182
static SharedPtr< DirectX12RenderPass > create(const DirectX12Device &device, const String &name, const DirectX12Queue &queue, Span< RenderTarget > renderTargets, Span< RenderPassDependency > inputAttachments={ }, Optional< DescriptorBindingPoint > inputAttachmentSamplerBinding=std::nullopt, UInt32 secondaryCommandBuffers=1u, UInt32 viewMask=0b0000)
Creates and initializes a new DirectX 12 render pass instance.
Definition dx12.hpp:2321
static SharedPtr< DirectX12RenderPass > create(const DirectX12Device &device, const String &name, Span< RenderTarget > renderTargets, Span< RenderPassDependency > inputAttachments={ }, Optional< DescriptorBindingPoint > inputAttachmentSamplerBinding=std::nullopt, UInt32 secondaryCommandBuffers=1u, UInt32 viewMask=0b0000)
Creates and initializes a new DirectX 12 render pass instance that executes on the default graphics q...
Definition dx12.hpp:2288
static SharedPtr< DirectX12RenderPass > create(const DirectX12Device &device, const DirectX12Queue &queue, Span< RenderTarget > renderTargets, Span< RenderPassDependency > inputAttachments={ }, Optional< DescriptorBindingPoint > inputAttachmentSamplerBinding=std::nullopt, UInt32 secondaryCommandBuffers=1u, UInt32 viewMask=0b0000)
Creates and initializes a new DirectX 12 render pass instance.
Definition dx12.hpp:2304
Implements a DirectX 12 RenderPipeline.
Definition dx12.hpp:1800
DirectX12RenderPipeline(DirectX12RenderPipeline &&) noexcept=delete
Implements a DirectX 12 IShaderModule.
Definition dx12.hpp:563
DirectX12ShaderModule(DirectX12ShaderModule &&) noexcept
Implements a DirectX 12 ShaderProgram.
Definition dx12.hpp:623
Implements a DirectX12 ISurface.
Definition dx12_api.hpp:290
Implements a DirectX 12 swap chain.
Definition dx12.hpp:2401
DirectX12SwapChain(DirectX12SwapChain &&) noexcept=delete
Implements a DirectX 12 top-level acceleration structure (TLAS).
Definition dx12.hpp:396
DirectX12TopLevelAccelerationStructure(DirectX12TopLevelAccelerationStructure &&) noexcept
Implements a DirectX 12 vertex buffer layout.
Definition dx12.hpp:21
static auto create(size_t vertexSize, const Enumerable< BufferAttribute > &attributes, UInt32 binding=0, VertexBufferInputRate inputRate=VertexBufferInputRate::Vertex)
Creates a new vertex buffer layout.
Definition dx12.hpp:81
static auto create(const DirectX12VertexBufferLayout &other)
Creates a copy of a vertex buffer layout.
Definition dx12.hpp:90
Represents the base interface for a DirectX 12 acceleration structure implementation.
Definition dx12.hpp:286
IDirectX12AccelerationStructure() noexcept=default
Represents the base interface for a DirectX 12 buffer implementation.
Definition dx12.hpp:190
IDirectX12Buffer() noexcept=default
Represents a DirectX 12 sampled image or the base interface for a texture.
Definition dx12.hpp:249
IDirectX12Image() noexcept=default
Represents a DirectX 12 index buffer.
Definition dx12.hpp:227
IDirectX12IndexBuffer() noexcept=default
Represents a DirectX 12 sampler.
Definition dx12.hpp:268
IDirectX12Sampler() noexcept=default
Represents a DirectX 12 vertex buffer.
Definition dx12.hpp:207
IDirectX12VertexBuffer() noexcept=default
A barrier used for GPU resource synchronization.
Definition rendering.hpp:17
Represents a command buffer, that buffers commands that should be submitted to a CommandQueue.
Definition rendering.hpp:619
Represents a command queue.
Definition rendering.hpp:1113
Represents a compute Pipeline.
Definition rendering.hpp:1023
Stores the depth/stencil state of a see IRasterizer.
Definition rendering_api.hpp:3751
Defines a set of descriptors.
Definition rendering.hpp:150
Describes the layout of a descriptor set.
Definition rendering.hpp:237
A class that can be used to manage the state of a IGraphicsDevice.
Definition rendering_api.hpp:2697
Stores the images used by a RenderPass to either read from using input attachments or write to using ...
Definition rendering.hpp:1079
IFrameBuffer::allocation_callback_type< image_type > allocation_callback_type
Definition rendering.hpp:1082
Represents the graphics device that a rendering back-end is doing work on.
Definition rendering.hpp:1538
Describes a factory that creates objects for a GraphicsDevice.
Definition rendering.hpp:1277
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
void build(const ICommandBuffer &commandBuffer, const SharedPtr< const IBuffer > &scratchBuffer=nullptr, const SharedPtr< const IBuffer > &buffer=nullptr, UInt64 offset=0, UInt64 maxSize=0)
Performs a complete build of the acceleration structure.
Definition rendering_api.hpp:5305
A structure that holds a singular entity of geometry for hardware ray-tracing.
Definition rendering_api.hpp:5399
void copy(const ICommandBuffer &commandBuffer, IBottomLevelAccelerationStructure &destination, bool compress=false, const SharedPtr< const IBuffer > &buffer=nullptr, UInt64 offset=0, bool copyBuildInfo=true) const
Copies the acceleration structure into the acceleration structure provided by destination .
Definition rendering_api.hpp:5618
Base interface for buffer objects.
Definition rendering_api.hpp:4997
The interface for a command buffer.
Definition rendering_api.hpp:7682
The interface for a command queue.
Definition rendering_api.hpp:9742
Describes a the layout of a single descriptor within a DescriptorSet.
Definition rendering_api.hpp:4641
The interface for a descriptor set.
Definition rendering_api.hpp:6064
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
The interface for a graphics device that.
Definition rendering_api.hpp:11050
Describes a generic image.
Definition rendering_api.hpp:5019
Describes a index buffer layout.
Definition rendering_api.hpp:4603
Describes a range within a IPushConstantsLayout.
Definition rendering_api.hpp:6561
Describes a texture sampler.
Definition rendering_api.hpp:5135
The interface of a scissor.
Definition rendering_api.hpp:4207
Represents a single shader module, i.e. a part of a IShaderProgram.
Definition rendering_api.hpp:3363
A structure that stores the instance data for a IBottomLevelAccelerationStructure.
Definition rendering_api.hpp:5681
void copy(const ICommandBuffer &commandBuffer, ITopLevelAccelerationStructure &destination, bool compress=false, const SharedPtr< const IBuffer > &buffer=nullptr, UInt64 offset=0, bool copyBuildInfo=true) const
Copies the acceleration structure into the acceleration structure provided by destination .
Definition rendering_api.hpp:5827
Describes a vertex buffer layout.
Definition rendering_api.hpp:4574
Interface for a viewport.
Definition rendering_api.hpp:4089
Describes an index buffer.
Definition rendering.hpp:501
Represents a pipeline state.
Definition rendering.hpp:569
Represents a the layout of a RenderPipeline, ComputePipeline or RayTracingPipeline.
Definition rendering.hpp:440
Describes the layout of the pipelines push constant ranges.
Definition rendering.hpp:377
Implements a IRasterizer.
Definition rendering_api.hpp:4006
Represents a ray-tracing Pipeline.
Definition rendering.hpp:1042
Defines a back-end, that provides a device instance for a certain surface and graphics adapter.
Definition rendering.hpp:1796
Represents a mapping between a set of RenderTarget instances and the input attachments of a IRenderPa...
Definition rendering_api.hpp:3684
Represents a render pass.
Definition rendering.hpp:1173
Represents a graphics Pipeline.
Definition rendering.hpp:984
Implements a render target.
Definition rendering_api.hpp:3584
Represents a shader program, consisting of multiple IShaderModules.
Definition rendering.hpp:408
Stores a set of IShaderRecords in that later form a shader binding table used for ray-tracing.
Definition rendering_api.hpp:6923
Base class for a resource that can be identified by a name string within a DeviceState.
Definition rendering_api.hpp:2650
Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurfa...
Definition rendering.hpp:1233
An event that is used to measure timestamps in a command queue.
Definition rendering_api.hpp:4371
Describes a vertex buffer.
Definition rendering.hpp:477
Represents a virtual allocator that manages memory distribution from a piece of raw memory.
Definition rendering_api.hpp:3032
Implements the IResource interface.
Definition containers.hpp:823
static auto create(TArgs &&... args) -> SharedPtr< T >
Generic factory method used to create instances of the shared object.
Definition containers.hpp:1114
Concept that can be used to refer to backend implementations.
Definition app.hpp:80
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
CullOrder
Describes the order or vertex winding, that is used to determine, whether a polygon is facing towards...
Definition rendering_api.hpp:1190
DescriptorHeapType
The target heap type for a descriptor.
Definition rendering_api.hpp:580
ImageLayout
Specifies the layout of an IImage resource.
Definition rendering_api.hpp:1858
MipMapMode
Describes the filter operation between two mip-map levels.
Definition rendering_api.hpp:1341
CullMode
Describes which faces are culled by the Rasterizer stage.
Definition rendering_api.hpp:1163
ShaderStage
Describes the valid shader stages of a graphics pipeline.
Definition rendering_api.hpp:971
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
@ 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
BufferType
Describes the type of a IBuffer.
Definition rendering_api.hpp:601
DefragmentationStrategy
The strategy to apply to a defragmentation pass.
Definition rendering_api.hpp:886
ResourceUsage
Describes the intended usage for a resource.
Definition rendering_api.hpp:761
ImageDimensions
Describes the dimensions of a image resource, i.e. the dimensions that are required to access a texel...
Definition rendering_api.hpp:1258
AllocationAlgorithm
The allocation algorithm used by VirtualAllocators.
Definition rendering_api.hpp:852
DescriptorType
Describes the type of a IDescriptor.
Definition rendering_api.hpp:442
QueuePriority
Specifies the priority with which a queue is scheduled on the GPU.
Definition rendering_api.hpp:160
QueueType
Represents the type of a CommandQueue.
Definition rendering_api.hpp:114
ResourceHeap
Defines where a resource (buffer or image) memory is located and from where it can be accessed.
Definition rendering_api.hpp:710
AccelerationStructureFlags
Controls how an acceleration structure should be built.
Definition rendering_api.hpp:1988
FilterMode
Describes the filter operation when accessing a pixel from a texture coordinate.
Definition rendering_api.hpp:1324
AllocationBehavior
Controls the allocation behavior of IGraphicsFactory.
Definition rendering_api.hpp:830
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
ResourceAccess
Defines how a IBuffer or IImage resource is accessed.
Definition rendering_api.hpp:1709
Format
Describes a texel format.
Definition rendering_api.hpp:183
MultiSamplingLevel
Describes the number of samples with which a IImage is sampled.
Definition rendering_api.hpp:1283
std::generator< T, TVal > Generator
Describes an intermediate container for elements of type T .
Definition containers.hpp:206
std::vector< T > Array
Represents a dynamic array.
Definition containers.hpp:73
std::optional< T > Optional
Represents an optional value.
Definition containers.hpp:94
std::shared_ptr< T > SharedPtr
Represents a shared pointer, that expresses non-exclusive ownership.
Definition containers.hpp:109
std::unique_ptr< T, TDeleter > UniquePtr
Represents a unique pointer, that expresses exclusive ownership.
Definition containers.hpp:102
std::string String
Definition string.hpp:24
std::string_view StringView
Definition string.hpp:26
BackendType
Definition app_api.hpp:35
std::span< T > Span
Represents a view of an array.
Definition containers.hpp:87
An input range over another range, where the returned values of type T are covariants of the values ...
Definition containers.hpp:529
An algebraic vector type.
Definition vector.hpp:23
Describes a resource binding to a descriptor or descriptor set.
Definition rendering_api.hpp:6218
Describes a single descriptor binding point within a IShaderModule.
Definition rendering_api.hpp:3309
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
Represents a triangle mesh.
Definition rendering_api.hpp:5404
Represents an instance of an IBottomLevelAccelerationStructure.
Definition rendering_api.hpp:5688
Stores simple memory heap statistics, that can be quickly queried by calling IGraphicsFactory::memory...
Definition rendering_api.hpp:9985
A hint used during shader reflection to control the pipeline layout.
Definition rendering_api.hpp:7174
Describes the offsets and sizes of a shader group within a shader binding table buffer.
Definition rendering_api.hpp:4291
An allocator used to allocate the shared object.
Definition containers.hpp:1098
Definition alloc_buffer.cpp:13