namespace Brutal.VulkanApi.Abstractions;
///
/// Struct containing information about a buffer allocation
///
/// Handle to the Vulkan buffer
/// Offset within the buffer where this allocation starts
/// Size of the allocation within the buffer
/// Usage flags this buffer supports, for reference
/// The internal memory allocation
public readonly record struct BufferAllocationInfo(
VkBuffer VkBuffer,
ByteSize BufferOffset,
ByteSize BufferSize,
VkBufferUsageFlags Usage,
AllocationInfo AllocationInfo
) : IMappable
{
ByteSize IMappable.MapSize => BufferSize;
ByteSize IMappable.MapOffset => BufferOffset;
}
///
/// Interface for a buffer allocator object capable of allocating and freeing buffers
///
public interface IBufferAllocator : IAllocator
{
///
/// Allocate a buffer with the given creation and allocation info
///
///
/// Vulkan buffer creation info
/// Memory allocation info
/// Struct containing all relevant information about allocation
public BufferAllocationInfo AllocateBuffer(
in string name,
in VkBufferCreateInfo bufferCreateInfo,
in AllocationInfo.CreateInfo allocateCreateInfo
);
///
/// Free buffer allocation
///
/// Allocation info for the buffer previously sourced from this allocator
public void FreeAllocation(in BufferAllocationInfo inAllocation);
}