mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-28 22:18:25 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
|
|
@ -0,0 +1,57 @@
|
|||
namespace Brutal.VulkanApi.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Allocation information for a partition of a buffer allocation (portion of a larger buffer)
|
||||
/// </summary>
|
||||
/// <param name="Partitioner">Buffer partitioner that created this partition</param>
|
||||
/// <param name="BufferInfo">Information about this allocation within the buffer</param>
|
||||
/// <param name="PartitionOffset">Offset within owning buffer where this partition starts</param>
|
||||
/// <param name="PartitionSize">Size of this partition</param>
|
||||
public readonly record struct BufferPartitionInfo(
|
||||
IBufferPartitioner? Partitioner,
|
||||
BufferAllocationInfo BufferInfo,
|
||||
ByteSize PartitionOffset,
|
||||
ByteSize PartitionSize
|
||||
) : IMappable, IBindBuffer
|
||||
{
|
||||
public record struct CreateInfo(ByteSize Size);
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the parent Vulkan buffer
|
||||
/// </summary>
|
||||
public VkBuffer VkBuffer => BufferInfo.VkBuffer;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within the parent buffer where this partition starts
|
||||
/// </summary>
|
||||
public ByteSize BindOffset => BufferInfo.BufferOffset + PartitionOffset;
|
||||
|
||||
/// <summary>
|
||||
/// Offset within the owning device memory allocation where this partition starts
|
||||
/// </summary>
|
||||
public ByteSize MemoryOffset => BufferInfo.AllocationInfo.AllocOffset + BindOffset;
|
||||
|
||||
/// <summary>
|
||||
/// If true, this partition is a full buffer allocation
|
||||
/// </summary>
|
||||
public bool IsFullPartition => Partitioner is null;
|
||||
|
||||
/// <summary>
|
||||
/// Convenience function to create a partition info object for a full buffer allocation
|
||||
/// </summary>
|
||||
/// <param name="bufferAllocationInfo">BufferAllocationInfo object</param>
|
||||
/// <returns>BufferAllocationInfo as BufferPartitionInfo, with the 'partition' covering the entire buffer</returns>
|
||||
public static BufferPartitionInfo FullPartition(BufferAllocationInfo bufferAllocationInfo)
|
||||
{
|
||||
return new BufferPartitionInfo(
|
||||
Partitioner: null,
|
||||
BufferInfo: bufferAllocationInfo,
|
||||
PartitionSize: bufferAllocationInfo.BufferSize,
|
||||
PartitionOffset: ByteSize.Zero
|
||||
);
|
||||
}
|
||||
|
||||
AllocationInfo IMappable.AllocationInfo => BufferInfo.AllocationInfo;
|
||||
ByteSize IMappable.MapSize => PartitionSize;
|
||||
ByteSize IMappable.MapOffset => PartitionOffset;
|
||||
}
|
||||
Loading…
Reference in a new issue