mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
55
Brutal.Vulkan.Abstractions/Allocator/Allocation.cs
Normal file
55
Brutal.Vulkan.Abstractions/Allocator/Allocation.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
namespace Brutal.VulkanApi.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Struct containing information about a memory allocation. Intentionally made similar to VMA's AllocationInfo
|
||||
/// </summary>
|
||||
/// <param name="Allocator">Allocator that sourced this allocation</param>
|
||||
/// <param name="Memory">Device memory handle</param>
|
||||
/// <param name="AllocSize">Size available in the memory allocation (might be more than requested)</param>
|
||||
/// <param name="AllocOffset">Offset into the memory allocation</param>
|
||||
/// <param name="MemoryTypeIndex">Memory type this allocation was made from</param>
|
||||
/// <param name="AllocHandle">Custom handle, optionally used by allocator</param>
|
||||
public readonly record struct AllocationInfo(
|
||||
IAllocator Allocator,
|
||||
VkDeviceMemory Memory,
|
||||
ByteSize AllocSize,
|
||||
ByteSize AllocOffset,
|
||||
int MemoryTypeIndex,
|
||||
nint AllocHandle
|
||||
)
|
||||
{
|
||||
/// <summary>
|
||||
/// Struct containing information about a memory allocation. Intentionally made similar to VMA's AllocationCreateInfo
|
||||
/// </summary>
|
||||
/// <param name="Preference">Memory location preference can just leave as 'None'</param>
|
||||
/// <param name="RequiredProperties">Flags that must be set in a Memory Type chosen for an allocation</param>
|
||||
/// <param name="PreferredProperties">Flags that preferably should be set in a memory type chosen for an allocation</param>
|
||||
/// <param name="Priority">A floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations</param>
|
||||
/// <param name="Next">For advanced use only. A pointer to an application-defined structure that can be used to pass custom data to the allocator</param>
|
||||
public record struct CreateInfo(
|
||||
MemoryPreference Preference,
|
||||
VkMemoryPropertyFlags RequiredProperties,
|
||||
VkMemoryPropertyFlags PreferredProperties,
|
||||
float Priority,
|
||||
Ptr Next
|
||||
)
|
||||
{
|
||||
/// <summary>
|
||||
/// Optional memory allocation flags. When set, the allocator chains a
|
||||
/// <see cref="VkMemoryAllocateFlagsInfo"/> in front of <see cref="Next"/>
|
||||
/// (e.g. <see cref="VkMemoryAllocateFlags.DeviceAddressBit"/> for buffers whose
|
||||
/// device address will be queried).
|
||||
/// </summary>
|
||||
public VkMemoryAllocateFlags AllocateFlags { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum listing memory allocation preferences: whether to prefer GPU or CPU memory
|
||||
/// </summary>
|
||||
public enum MemoryPreference : byte
|
||||
{
|
||||
None,
|
||||
PreferGpu,
|
||||
PreferCpu,
|
||||
}
|
||||
Loading…
Reference in a new issue