private void CreateBuffer(ulong size)
        {
            var createInfo = new SharpVulkan.BufferCreateInfo {
                StructureType = SharpVulkan.StructureType.BufferCreateInfo,
                Size          = size,
                SharingMode   = SharpVulkan.SharingMode.Exclusive,
                Usage         = SharpVulkan.BufferUsageFlags.TransferSource
            };

            buffer = context.Device.CreateBuffer(ref createInfo);
            memory = context.MemoryAllocator.Allocate(buffer,
                                                      SharpVulkan.MemoryPropertyFlags.HostVisible | SharpVulkan.MemoryPropertyFlags.HostCoherent);
            mappedMemory = context.MemoryAllocator.Map(memory);
            bufferSize   = size;
            bufferOffset = 0;
        }
Example #2
0
        private void CreateBuffer()
        {
            var alignedSliceSize = GraphicsUtility.AlignUp(sliceSize, sliceAlignment);
            var bufferSize       = sliceCount * alignedSliceSize;
            var createInfo       = new SharpVulkan.BufferCreateInfo {
                StructureType = SharpVulkan.StructureType.BufferCreateInfo,
                Size          = bufferSize,
                SharingMode   = SharpVulkan.SharingMode.Exclusive,
                Usage         = usage
            };

            buffer = context.Device.CreateBuffer(ref createInfo);
            memory = context.MemoryAllocator.Allocate(buffer, memoryPropertyFlags);
            sliceQueue.Clear();
            for (ulong i = 0; i < sliceCount; i++)
            {
                sliceQueue.Enqueue(new SliceEntry {
                    Offset = i * alignedSliceSize
                });
            }
            Generation++;
        }