public VKBuffer( string name, Graphics graphics, long count, BufferUsages usages, MemoryProperties memoryProperties, BufferCreateFlags flags = BufferCreateFlags.None, SharingMode sharingMode = SharingMode.Exclusive, int[] queueFamilyIndices = null ) { Name = name; Graphics = graphics; Count = count; Size = count * Interop.SizeOf <T>(); Usages = usages; Buffer = Graphics.Device.CreateBuffer(new BufferCreateInfo( size: Size, usages: usages, flags: flags, sharingMode: sharingMode, queueFamilyIndices: queueFamilyIndices )); var reqs = Buffer.GetMemoryRequirements(); DeviceMemory = Graphics.Device.AllocateMemory(new MemoryAllocateInfo( reqs.Size, graphics.GetMemoryTypeIndex(reqs.MemoryTypeBits, memoryProperties) )); Buffer.BindMemory(DeviceMemory); }
/// <summary> /// Initializes a new instance of the <see cref="BufferCreateInfo"/> structure. /// </summary> /// <param name="size">The size in bytes of the buffer to be created.</param> /// <param name="usages">The bitmask describing the allowed usages of the buffer.</param> /// <param name="flags">Additional parameters of the buffer.</param> /// <param name="sharingMode"> /// The sharing mode of the buffer when it will be accessed by multiple queue families. /// </param> /// <param name="queueFamilyIndices"> /// A list of queue families that will access this buffer (ignored if <see /// cref="SharingMode"/> is not <see cref="VulkanCore.SharingMode.Concurrent"/>). /// </param> /// <param name="next"> /// Is <see cref="IntPtr.Zero"/> or a pointer to an extension-specific structure. /// </param> public BufferCreateInfo( long size, BufferUsages usages, BufferCreateFlags flags = 0, SharingMode sharingMode = SharingMode.Exclusive, int[] queueFamilyIndices = null, IntPtr next = default(IntPtr)) { Next = next; Size = size; Usages = usages; Flags = flags; SharingMode = sharingMode; QueueFamilyIndices = queueFamilyIndices; }
public PhysicalDeviceExternalBufferInfo ( StructureType sType = StructureType.PhysicalDeviceExternalBufferInfo, void *pNext = default, BufferCreateFlags flags = default, BufferUsageFlags usage = default, ExternalMemoryHandleTypeFlags handleType = default ) { SType = sType; PNext = pNext; Flags = flags; Usage = usage; HandleType = handleType; }
public BufferCreateInfo ( StructureType sType = StructureType.BufferCreateInfo, void *pNext = default, BufferCreateFlags flags = default, ulong size = default, BufferUsageFlags usage = default, SharingMode sharingMode = default, uint queueFamilyIndexCount = default, uint *pQueueFamilyIndices = default ) { SType = sType; PNext = pNext; Flags = flags; Size = size; Usage = usage; SharingMode = sharingMode; QueueFamilyIndexCount = queueFamilyIndexCount; PQueueFamilyIndices = pQueueFamilyIndices; }