Beispiel #1
0
        /// <summary>
        /// Create and activate a new Command Pool.
        /// </summary>
        /// <param name="device">Vulkan Device.</param>
        /// <param name="qFamIdx">Queue family index.</param>
        public CommandPool(Device device, uint qFamIdx, VkCommandPoolCreateFlags flags = 0) : base(device)
        {
            QFamIndex = qFamIdx;
            Flags     = flags;

            Activate();
        }
Beispiel #2
0
        public static VkResult vkCreateCommandPool(VkDevice device, VkCommandPoolCreateFlags flags, uint queueFamilyIndex, out VkCommandPool commandPool)
        {
            VkCommandPoolCreateInfo createInfo = new VkCommandPoolCreateInfo
            {
                sType            = VkStructureType.CommandPoolCreateInfo,
                flags            = flags,
                queueFamilyIndex = queueFamilyIndex
            };

            return(vkCreateCommandPool(device, &createInfo, null, out commandPool));
        }
Beispiel #3
0
        private VkCommandPool CreateCommandPool(
            uint queueFamilyIndex,
            VkCommandPoolCreateFlags createFlags = VkCommandPoolCreateFlags.ResetCommandBuffer)
        {
            VkCommandPoolCreateInfo cmdPoolInfo = VkCommandPoolCreateInfo.New();

            cmdPoolInfo.queueFamilyIndex = queueFamilyIndex;
            cmdPoolInfo.flags            = createFlags;
            Util.CheckResult(vkCreateCommandPool(LogicalDevice, &cmdPoolInfo, null, out VkCommandPool cmdPool));
            return(cmdPool);
        }
Beispiel #4
0
        public static VkCommandPool CreateCommandPool(uint queueFamilyIndex, VkCommandPoolCreateFlags createFlags = VkCommandPoolCreateFlags.ResetCommandBuffer)
        {
            VkCommandPoolCreateInfo cmdPoolInfo = new VkCommandPoolCreateInfo
            {
                sType = VkStructureType.CommandPoolCreateInfo
            };

            cmdPoolInfo.queueFamilyIndex = queueFamilyIndex;
            cmdPoolInfo.flags            = createFlags;
            VulkanUtil.CheckResult(vkCreateCommandPool(device, &cmdPoolInfo, null, out VkCommandPool cmdPool));
            return(cmdPool);
        }
Beispiel #5
0
        void CreateCommandPool(CommandPoolCreateInfo mInfo)
        {
            VkCommandPoolCreateInfo info = new VkCommandPoolCreateInfo();

            info.sType            = VkStructureType.CommandPoolCreateInfo;
            info.flags            = mInfo.flags;
            info.queueFamilyIndex = mInfo.queueFamilyIndex;

            var result = Device.Commands.createCommandPool(Device.Native, ref info, Device.Instance.AllocationCallbacks, out commandPool);

            if (result != VkResult.Success)
            {
                throw new CommandPoolException(string.Format("Error creating command pool: {0}", result));
            }

            Flags = mInfo.flags;
        }
Beispiel #6
0
        public static int CreateCommandPool(VkCommandPoolCreateFlags flags)
        {
            VkCommandPoolCreateInfo createInfo = VkCommandPoolCreateInfo.New();

            createInfo.flags            = flags;
            createInfo.queueFamilyIndex = graphicsQueueFamily;

            VkCommandPool pool = VkCommandPool.Null;

            if (vkCreateCommandPool(device, &createInfo, null, &pool) != VkResult.Success)
            {
                throw new System.Exception("Failed to create commandpool");
            }

            Guid guid = Guid.NewGuid();
            int  id   = guid.GetHashCode();

            pools[id] = pool;
            return(id);
        }
Beispiel #7
0
 public CommandBufferPool(uint queue, VkCommandPoolCreateFlags commandPoolCreateFlags)
 {
     QueueIndex = queue;
     cmdPool    = Device.CreateCommandPool(queue, commandPoolCreateFlags);
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the [[CommandPool]]"/> class.
 /// </summary>
 /// <param name="queue">Device Queue of the queue family to create the pool for.</param>
 public CommandPool(Queue queue, VkCommandPoolCreateFlags flags = 0) : this(queue.dev, queue.qFamIndex, flags)
 {
 }