public VkResult BindMemory(IVkDeviceMemory memory, ulong memoryOffset) { var _device = Device.Handle; var _image = Handle; var _memory = memory?.Handle ?? VkDeviceMemory.HandleType.Null; var _memoryOffset = memoryOffset; return(Direct.BindImageMemory(_device, _image, _memory, _memoryOffset)); }
private void CreateBuffer(ulong size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, out IVkBuffer buffer, out IVkDeviceMemory bufferMemory) { buffer = device.CreateBuffer(new VkBufferCreateInfo { Size = size, Usage = usage, SharingMode = VkSharingMode.Exclusive }, null).Object; var memRequirements = buffer.GetMemoryRequirements(); bufferMemory = device.AllocateMemory(new VkMemoryAllocateInfo { AllocationSize = memRequirements.Size, MemoryTypeIndex = FindMemoryType(memRequirements.MemoryTypeBits, properties) }, null).Object; buffer.BindMemory(bufferMemory, 0).CheckSuccess(); }