Exemplo n.º 1
0
        private void CreateCommandPool()
        {
            VkCommandPoolCreateInfo cmdPoolInfo = VkCommandPoolCreateInfo.New();

            cmdPoolInfo.queueFamilyIndex = Swapchain.QueueNodeIndex;
            cmdPoolInfo.flags            = VkCommandPoolCreateFlags.ResetCommandBuffer;
            Util.CheckResult(vkCreateCommandPool(device, &cmdPoolInfo, null, out _cmdPool));
        }
Exemplo n.º 2
0
        private void CreatePerFrameCommandPool()
        {
            VkCommandPoolCreateInfo commandPoolCI = VkCommandPoolCreateInfo.New();

            commandPoolCI.flags            = VkCommandPoolCreateFlags.ResetCommandBuffer | VkCommandPoolCreateFlags.Transient;
            commandPoolCI.queueFamilyIndex = _graphicsQueueIndex;
            vkCreateCommandPool(_device, ref commandPoolCI, null, out _perFrameCommandPool);
        }
Exemplo n.º 3
0
 public override void Activate()
 {
     if (state != ActivableState.Activated)
     {
         VkCommandPoolCreateInfo infos = VkCommandPoolCreateInfo.New();
         infos.queueFamilyIndex = QFamIndex;
         Utils.CheckResult(vkCreateCommandPool(Dev.VkDev, ref infos, IntPtr.Zero, out handle));
     }
     base.Activate();
 }
Exemplo n.º 4
0
        private void CreateGraphicsCommandPool()
        {
            VkCommandPoolCreateInfo commandPoolCI = VkCommandPoolCreateInfo.New();

            commandPoolCI.flags            = VkCommandPoolCreateFlags.ResetCommandBuffer;
            commandPoolCI.queueFamilyIndex = _graphicsQueueIndex;
            VkResult result = vkCreateCommandPool(_device, ref commandPoolCI, null, out _graphicsCommandPool);

            CheckResult(result);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public VkResourceFactory(VkRenderContext rc)
        {
            RenderContext   = rc;
            _device         = rc.Device;
            _physicalDevice = rc.PhysicalDevice;

            VkCommandPoolCreateInfo commandPoolCI = VkCommandPoolCreateInfo.New();

            commandPoolCI.flags            = VkCommandPoolCreateFlags.None;
            commandPoolCI.queueFamilyIndex = rc.GraphicsQueueIndex;
        }
Exemplo n.º 7
0
            public SharedCommandPool(VkGraphicsDevice gd, bool isCached)
            {
                _gd      = gd;
                IsCached = isCached;

                VkCommandPoolCreateInfo commandPoolCI = VkCommandPoolCreateInfo.New();

                commandPoolCI.flags            = VkCommandPoolCreateFlags.Transient;
                commandPoolCI.queueFamilyIndex = _gd.GraphicsQueueIndex;
                VkResult result = vkCreateCommandPool(_gd.Device, ref commandPoolCI, null, out _pool);

                CheckResult(result);
            }
Exemplo n.º 8
0
        public VkCommandList(VkGraphicsDevice gd, ref CommandListDescription description)
            : base(ref description, gd.Features)
        {
            _gd = gd;
            VkCommandPoolCreateInfo poolCI = VkCommandPoolCreateInfo.New();

            poolCI.flags            = VkCommandPoolCreateFlags.ResetCommandBuffer;
            poolCI.queueFamilyIndex = gd.GraphicsQueueIndex;
            VkResult result = vkCreateCommandPool(_gd.Device, ref poolCI, null, out _pool);

            CheckResult(result);

            _cb = GetNextCommandBuffer();
        }
Exemplo n.º 9
0
        public CommandPool(GraphicsDevice device, Swapchain swapchain)
        {
            this.device = device;

            VkCommandPoolCreateInfo cmdPoolInfo = VkCommandPoolCreateInfo.New();

            cmdPoolInfo.queueFamilyIndex = swapchain.vkSwapchain.QueueNodeIndex;
            cmdPoolInfo.flags            =
                VkCommandPoolCreateFlags.ResetCommandBuffer
                | VkCommandPoolCreateFlags.Transient;
            Util.CheckResult(vkCreateCommandPool(device.device, &cmdPoolInfo, null, out vkCmdPool));

            AllocateBuffers(VkCommandBufferLevel.Primary, 2);
            AllocateBuffers(VkCommandBufferLevel.Secondary, 2);
        }
Exemplo n.º 10
0
        public VkCommandList(VkGraphicsDevice gd, ref CommandListDescription description)
            : base(ref description)
        {
            _gd = gd;
            VkCommandPoolCreateInfo poolCI = VkCommandPoolCreateInfo.New();

            poolCI.queueFamilyIndex = gd.GraphicsQueueIndex;
            VkResult result = vkCreateCommandPool(_gd.Device, ref poolCI, null, out _pool);

            CheckResult(result);

            VkCommandBufferAllocateInfo cbAI = VkCommandBufferAllocateInfo.New();

            cbAI.commandPool        = _pool;
            cbAI.commandBufferCount = 1;
            cbAI.level = VkCommandBufferLevel.Primary;
            result     = vkAllocateCommandBuffers(gd.Device, ref cbAI, out _cb);
            CheckResult(result);
        }
Exemplo n.º 11
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);
        }