public CommandBufferAllocateInfo
 (
     StructureType sType      = StructureType.CommandBufferAllocateInfo,
     void *pNext              = default,
     CommandPool commandPool  = default,
     CommandBufferLevel level = default,
     uint commandBufferCount  = default
 )
 {
     SType              = sType;
     PNext              = pNext;
     CommandPool        = commandPool;
     Level              = level;
     CommandBufferCount = commandBufferCount;
 }
        protected CommandBuffer AllocateCommandBuffer(CommandBufferLevel level)
        {
            CommandBufferAllocateInfo info = new CommandBufferAllocateInfo(commandPool: this.CommandPool, level: level, commandBufferCount: 1);

            CommandBuffer buffer;

            var res = VkApi.AllocateCommandBuffers(Device, &info, &buffer);

            if (res != Result.Success)
            {
                throw new Exception("Unable to allocate command buffers");
            }

            return(buffer);
        }
        protected CommandBuffer[] AllocateCommandBuffers(int count, CommandBufferLevel level)
        {
            CommandBufferAllocateInfo info = new CommandBufferAllocateInfo(commandPool: this.CommandPool, level: level, commandBufferCount: (uint)count);

            CommandBuffer[] buffers = new CommandBuffer[count];

            fixed(CommandBuffer *pbuffers = buffers)
            {
                var res = VkApi.AllocateCommandBuffers(Device, &info, pbuffers);

                if (res != Result.Success)
                {
                    throw new Exception("Unable to allocate command buffers");
                }
            }

            return(buffers);
        }
Beispiel #4
0
 /// <summary>
 /// Create a set of command buffers
 /// </summary>
 /// <param name="level"></param>
 /// <param name="count"></param>
 /// <returns></returns>
 public CommandBuffer[] CreateCommandBuffers(CommandBufferLevel level, int count)
 {
     return(CommandPool.AllocateBuffers(new CommandBufferAllocateInfo(level, count)));
 }
 public CommandBufferAllocateInfo(CommandPool CommandPool, CommandBufferLevel Level, UInt32 CommandBufferCount) : this()
 {
     this.CommandPool        = CommandPool;
     this.Level              = Level;
     this.CommandBufferCount = CommandBufferCount;
 }