Allocators
Management of GPU resources is an important part of any renderer. vuk provides an API that lets you plug in your allocation schemes, complementing built-in general purpose schemes that get you started and give good performance out of the box.
Overview
-
class Allocator
Interface for allocating device resources.
The Allocator is a concrete value type wrapping over a polymorphic DeviceResource, forwarding allocations and deallocations to it. The allocation functions take spans of creation parameters and output values, reporting error through the return value of Result<void, AllocateException>. The deallocation functions can’t fail.
-
struct DeviceResource
DeviceResource is a polymorphic interface over allocation of GPU resources. A DeviceResource must prevent reuse of cross-device resources after deallocation until CPU-GPU timelines are synchronized. GPU-only resources may be reused immediately.
Subclassed by vuk::DeviceNestedResource, vuk::DeviceVkResource
To facilitate ownership, a RAII wrapper type is provided, that wraps an Allocator and a payload:
-
template<typename Type>
class Unique
Built-in resources
-
struct DeviceNestedResource : public vuk::DeviceResource
Helper base class for DeviceResources. Forwards all allocations and deallocations to the upstream DeviceResource.
Subclassed by vuk::DeviceFrameResource, vuk::DeviceLinearResource, vuk::DeviceSuperFrameResource
-
struct DeviceVkResource : public vuk::DeviceResource
Device resource that performs direct allocation from the resources from the Vulkan runtime.
-
struct DeviceFrameResource : public vuk::DeviceNestedResource
Represents “per-frame” resources - temporary allocations that persist through a frame. Handed out by DeviceSuperFrameResource, cannot be constructed directly.
Allocations from this resource are tied to the “frame” - all allocations recycled when a DeviceFrameResource is recycled. Furthermore all resources allocated are also deallocated at recycle time - it is not necessary (but not an error) to deallocate them.
Subclassed by vuk::DeviceMultiFrameResource
-
struct DeviceSuperFrameResource : public vuk::DeviceNestedResource
DeviceSuperFrameResource is an allocator that gives out DeviceFrameResource allocators, and manages their resources.
DeviceSuperFrameResource models resource lifetimes that span multiple frames - these can be allocated directly from this resource Allocation of these resources are persistent, and they can be deallocated at any time - they will be recycled when the current frame is recycled This resource also hands out DeviceFrameResources in a round-robin fashion. The lifetime of resources allocated from those allocators is frames_in_flight number of frames (until the DeviceFrameResource is recycled).
Helpers
Allocator provides functions that can perform bulk allocation (to reduce overhead for repeated calls) and return resources directly. However, usually it is more convenient to allocate a single resource and immediately put it into a RAII wrapper to prevent forgetting to deallocate it.
-
namespace vuk
Functions
-
inline Result<Unique<VkSemaphore>, AllocateException> allocate_semaphore(Allocator &allocator, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single semaphore from an Allocator.
- Parameters:
allocator – Allocator to use
loc – Source location information
- Returns:
Semaphore in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<TimelineSemaphore>, AllocateException> allocate_timeline_semaphore(Allocator &allocator, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single timeline semaphore from an Allocator.
- Parameters:
allocator – Allocator to use
loc – Source location information
- Returns:
Timeline semaphore in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<CommandPool>, AllocateException> allocate_command_pool(Allocator &allocator, const VkCommandPoolCreateInfo &cpci, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single command pool from an Allocator.
- Parameters:
allocator – Allocator to use
cpci – Command pool creation parameters
loc – Source location information
- Returns:
Command pool in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<CommandBufferAllocation>, AllocateException> allocate_command_buffer(Allocator &allocator, const CommandBufferAllocationCreateInfo &cbci, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single command buffer from an Allocator.
- Parameters:
allocator – Allocator to use
cbci – Command buffer creation parameters
loc – Source location information
- Returns:
Command buffer in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<VkFence>, AllocateException> allocate_fence(Allocator &allocator, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single fence from an Allocator.
- Parameters:
allocator – Allocator to use
loc – Source location information
- Returns:
Fence in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<Buffer>, AllocateException> allocate_buffer(Allocator &allocator, const BufferCreateInfo &bci, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single GPU-only buffer from an Allocator.
- Parameters:
allocator – Allocator to use
bci – Buffer creation parameters
loc – Source location information
- Returns:
GPU-only buffer in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<Image>, AllocateException> allocate_image(Allocator &allocator, const ImageCreateInfo &ici, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single image from an Allocator.
- Parameters:
allocator – Allocator to use
ici – Image creation parameters
loc – Source location information
- Returns:
Image in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<Image>, AllocateException> allocate_image(Allocator &allocator, const ImageAttachment &attachment, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single image from an Allocator.
- Parameters:
allocator – Allocator to use
attachment – ImageAttachment to make the Image from
loc – Source location information
- Returns:
Image in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<ImageView>, AllocateException> allocate_image_view(Allocator &allocator, const ImageViewCreateInfo &ivci, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single image view from an Allocator.
- Parameters:
allocator – Allocator to use
ivci – Image view creation parameters
loc – Source location information
- Returns:
ImageView in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<ImageView>, AllocateException> allocate_image_view(Allocator &allocator, const ImageAttachment &attachment, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate a single image view from an Allocator.
- Parameters:
allocator – Allocator to use
attachment – ImageAttachment to make the ImageView from
loc – Source location information
- Returns:
ImageView in a RAII wrapper (Unique<T>) or AllocateException on error
-
inline Result<Unique<VkSemaphore>, AllocateException> allocate_semaphore(Allocator &allocator, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Reference
-
class Allocator
Interface for allocating device resources.
The Allocator is a concrete value type wrapping over a polymorphic DeviceResource, forwarding allocations and deallocations to it. The allocation functions take spans of creation parameters and output values, reporting error through the return value of Result<void, AllocateException>. The deallocation functions can’t fail.
Public Functions
-
inline explicit Allocator(DeviceResource &device_resource)
Create new Allocator that wraps a DeviceResource.
- Parameters:
device_resource – The DeviceResource to allocate from
-
Result<void, AllocateException> allocate(std::span<VkSemaphore> dst, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate semaphores from this Allocator.
- Parameters:
dst – Destination span to place allocated semaphores into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_semaphores(std::span<VkSemaphore> dst, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate semaphores from this Allocator.
- Parameters:
dst – Destination span to place allocated semaphores into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const VkSemaphore> src)
Deallocate semaphores previously allocated from this Allocator.
- Parameters:
src – Span of semaphores to be deallocated
-
Result<void, AllocateException> allocate(std::span<VkFence> dst, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate fences from this Allocator.
- Parameters:
dst – Destination span to place allocated fences into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_fences(std::span<VkFence> dst, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate fences from this Allocator.
- Parameters:
dst – Destination span to place allocated fences into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const VkFence> src)
Deallocate fences previously allocated from this Allocator.
- Parameters:
src – Span of fences to be deallocated
-
Result<void, AllocateException> allocate(std::span<CommandPool> dst, std::span<const VkCommandPoolCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate command pools from this Allocator.
- Parameters:
dst – Destination span to place allocated command pools into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_command_pools(std::span<CommandPool> dst, std::span<const VkCommandPoolCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate command pools from this Allocator.
- Parameters:
dst – Destination span to place allocated command pools into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const CommandPool> src)
Deallocate command pools previously allocated from this Allocator.
- Parameters:
src – Span of command pools to be deallocated
-
Result<void, AllocateException> allocate(std::span<CommandBufferAllocation> dst, std::span<const CommandBufferAllocationCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate command buffers from this Allocator.
- Parameters:
dst – Destination span to place allocated command buffers into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_command_buffers(std::span<CommandBufferAllocation> dst, std::span<const CommandBufferAllocationCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate command buffers from this Allocator.
- Parameters:
dst – Destination span to place allocated command buffers into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const CommandBufferAllocation> src)
Deallocate command buffers previously allocated from this Allocator.
- Parameters:
src – Span of command buffers to be deallocated
-
Result<void, AllocateException> allocate(std::span<Buffer> dst, std::span<const BufferCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate buffers from this Allocator.
- Parameters:
dst – Destination span to place allocated buffers into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_buffers(std::span<Buffer> dst, std::span<const BufferCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate buffers from this Allocator.
- Parameters:
dst – Destination span to place allocated buffers into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const Buffer> src)
Deallocate buffers previously allocated from this Allocator.
- Parameters:
src – Span of buffers to be deallocated
-
Result<void, AllocateException> allocate(std::span<VkFramebuffer> dst, std::span<const FramebufferCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate framebuffers from this Allocator.
- Parameters:
dst – Destination span to place allocated framebuffers into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_framebuffers(std::span<VkFramebuffer> dst, std::span<const FramebufferCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate framebuffers from this Allocator.
- Parameters:
dst – Destination span to place allocated framebuffers into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const VkFramebuffer> src)
Deallocate framebuffers previously allocated from this Allocator.
- Parameters:
src – Span of framebuffers to be deallocated
-
Result<void, AllocateException> allocate(std::span<Image> dst, std::span<const ImageCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate images from this Allocator.
- Parameters:
dst – Destination span to place allocated images into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_images(std::span<Image> dst, std::span<const ImageCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate images from this Allocator.
- Parameters:
dst – Destination span to place allocated images into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const Image> src)
Deallocate images previously allocated from this Allocator.
- Parameters:
src – Span of images to be deallocated
-
Result<void, AllocateException> allocate(std::span<ImageView> dst, std::span<const ImageViewCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate image views from this Allocator.
- Parameters:
dst – Destination span to place allocated image views into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_image_views(std::span<ImageView> dst, std::span<const ImageViewCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate image views from this Allocator.
- Parameters:
dst – Destination span to place allocated image views into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const ImageView> src)
Deallocate image views previously allocated from this Allocator.
- Parameters:
src – Span of image views to be deallocated
-
Result<void, AllocateException> allocate(std::span<PersistentDescriptorSet> dst, std::span<const PersistentDescriptorSetCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate persistent descriptor sets from this Allocator.
- Parameters:
dst – Destination span to place allocated persistent descriptor sets into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_persistent_descriptor_sets(std::span<PersistentDescriptorSet> dst, std::span<const PersistentDescriptorSetCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate persistent descriptor sets from this Allocator.
- Parameters:
dst – Destination span to place allocated persistent descriptor sets into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const PersistentDescriptorSet> src)
Deallocate persistent descriptor sets previously allocated from this Allocator.
- Parameters:
src – Span of persistent descriptor sets to be deallocated
-
Result<void, AllocateException> allocate(std::span<DescriptorSet> dst, std::span<const SetBinding> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate descriptor sets from this Allocator.
- Parameters:
dst – Destination span to place allocated descriptor sets into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_descriptor_sets_with_value(std::span<DescriptorSet> dst, std::span<const SetBinding> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate descriptor sets from this Allocator.
- Parameters:
dst – Destination span to place allocated descriptor sets into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate(std::span<DescriptorSet> dst, std::span<const DescriptorSetLayoutAllocInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate descriptor sets from this Allocator.
- Parameters:
dst – Destination span to place allocated descriptor sets into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_descriptor_sets(std::span<DescriptorSet> dst, std::span<const DescriptorSetLayoutAllocInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate descriptor sets from this Allocator.
- Parameters:
dst – Destination span to place allocated descriptor sets into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const DescriptorSet> src)
Deallocate descriptor sets previously allocated from this Allocator.
- Parameters:
src – Span of descriptor sets to be deallocated
-
Result<void, AllocateException> allocate(std::span<TimestampQueryPool> dst, std::span<const VkQueryPoolCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate timestamp query pools from this Allocator.
- Parameters:
dst – Destination span to place allocated timestamp query pools into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_timestamp_query_pools(std::span<TimestampQueryPool> dst, std::span<const VkQueryPoolCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate timestamp query pools from this Allocator.
- Parameters:
dst – Destination span to place allocated timestamp query pools into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const TimestampQueryPool> src)
Deallocate timestamp query pools previously allocated from this Allocator.
- Parameters:
src – Span of timestamp query pools to be deallocated
-
Result<void, AllocateException> allocate(std::span<TimestampQuery> dst, std::span<const TimestampQueryCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate timestamp queries from this Allocator.
- Parameters:
dst – Destination span to place allocated timestamp queries into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_timestamp_queries(std::span<TimestampQuery> dst, std::span<const TimestampQueryCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate timestamp queries from this Allocator.
- Parameters:
dst – Destination span to place allocated timestamp queries into
cis – Per-element construction info
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const TimestampQuery> src)
Deallocate timestamp queries previously allocated from this Allocator.
- Parameters:
src – Span of timestamp queries to be deallocated
-
Result<void, AllocateException> allocate(std::span<TimelineSemaphore> dst, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate timeline semaphores from this Allocator.
- Parameters:
dst – Destination span to place allocated timeline semaphores into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_timeline_semaphores(std::span<TimelineSemaphore> dst, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate timeline semaphores from this Allocator.
- Parameters:
dst – Destination span to place allocated timeline semaphores into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const TimelineSemaphore> src)
Deallocate timeline semaphores previously allocated from this Allocator.
- Parameters:
src – Span of timeline semaphores to be deallocated
-
Result<void, AllocateException> allocate(std::span<VkAccelerationStructureKHR> dst, std::span<const VkAccelerationStructureCreateInfoKHR> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate acceleration structures from this Allocator.
- Parameters:
dst – Destination span to place allocated acceleration structures into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_acceleration_structures(std::span<VkAccelerationStructureKHR> dst, std::span<const VkAccelerationStructureCreateInfoKHR> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate acceleration structures from this Allocator.
- Parameters:
dst – Destination span to place allocated acceleration structures into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const VkAccelerationStructureKHR> src)
Deallocate acceleration structures previously allocated from this Allocator.
- Parameters:
src – Span of acceleration structures to be deallocated
-
void deallocate(std::span<const VkSwapchainKHR> src)
Deallocate swapchains previously allocated from this Allocator.
- Parameters:
src – Span of swapchains to be deallocated
-
Result<void, AllocateException> allocate(std::span<GraphicsPipelineInfo> dst, std::span<const GraphicsPipelineInstanceCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate graphics pipelines from this Allocator.
- Parameters:
dst – Destination span to place allocated pipelines into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_graphics_pipelines(std::span<GraphicsPipelineInfo> dst, std::span<const GraphicsPipelineInstanceCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate graphics pipelines from this Allocator.
- Parameters:
dst – Destination span to place allocated pipelines into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const GraphicsPipelineInfo> src)
Deallocate pipelines previously allocated from this Allocator.
- Parameters:
src – Span of pipelines to be deallocated
-
Result<void, AllocateException> allocate(std::span<ComputePipelineInfo> dst, std::span<const ComputePipelineInstanceCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate compute pipelines from this Allocator.
- Parameters:
dst – Destination span to place allocated pipelines into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_compute_pipelines(std::span<ComputePipelineInfo> dst, std::span<const ComputePipelineInstanceCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate compute pipelines from this Allocator.
- Parameters:
dst – Destination span to place allocated pipelines into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const ComputePipelineInfo> src)
Deallocate pipelines previously allocated from this Allocator.
- Parameters:
src – Span of pipelines to be deallocated
-
Result<void, AllocateException> allocate(std::span<RayTracingPipelineInfo> dst, std::span<const RayTracingPipelineInstanceCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate ray tracing pipelines from this Allocator.
- Parameters:
dst – Destination span to place allocated pipelines into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_ray_tracing_pipelines(std::span<RayTracingPipelineInfo> dst, std::span<const RayTracingPipelineInstanceCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate ray tracing pipelines from this Allocator.
- Parameters:
dst – Destination span to place allocated pipelines into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const RayTracingPipelineInfo> src)
Deallocate pipelines previously allocated from this Allocator.
- Parameters:
src – Span of pipelines to be deallocated
-
Result<void, AllocateException> allocate(std::span<VkRenderPass> dst, std::span<const RenderPassCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate render passes from this Allocator.
- Parameters:
dst – Destination span to place allocated render passes into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
Result<void, AllocateException> allocate_render_passes(std::span<VkRenderPass> dst, std::span<const RenderPassCreateInfo> cis, SourceLocationAtFrame loc = VUK_HERE_AND_NOW())
Allocate render passes from this Allocator.
- Parameters:
dst – Destination span to place allocated render passes into
loc – Source location information
- Returns:
Result<void, AllocateException> : void or AllocateException if the allocation could not be performed.
-
void deallocate(std::span<const VkRenderPass> src)
Deallocate render passes previously allocated from this Allocator.
- Parameters:
src – Span of render passes to be deallocated
-
inline DeviceResource &get_device_resource()
Get the underlying DeviceResource.
- Returns:
the underlying DeviceResource
-
inline explicit Allocator(DeviceResource &device_resource)