コード例 #1
0
        public CommandBuffer[] AllocateCommandBuffer(uint count, VkCommandBufferLevel level = VkCommandBufferLevel.Primary)
        {
            VkCommandBufferAllocateInfo infos = VkCommandBufferAllocateInfo.New();

            infos.commandPool        = handle;
            infos.level              = level;
            infos.commandBufferCount = count;
            VkCommandBuffer[] buffs = new VkCommandBuffer[count];
            Utils.CheckResult(vkAllocateCommandBuffers(Dev.VkDev, ref infos, buffs.Pin()));
            buffs.Unpin();
            CommandBuffer[] cmds = new CommandBuffer[count];
            for (int i = 0; i < count; i++)
            {
                cmds[i] = new CommandBuffer(Dev.VkDev, this, buffs[i]);
            }

            return(cmds);
        }
コード例 #2
0
ファイル: CommandBuffer.cs プロジェクト: Svengali/vk.net
        public void Submit(VkQueue queue, VkSemaphore wait = default(VkSemaphore), VkSemaphore signal = default(VkSemaphore), VkFence fence = default(VkFence))
        {
            VkSubmitInfo submit_info = VkSubmitInfo.New();

            IntPtr dstStageMask = Marshal.AllocHGlobal(sizeof(uint));

            Marshal.WriteInt32(dstStageMask, (int)VkPipelineStageFlags.ColorAttachmentOutput);

            submit_info.pWaitDstStageMask = dstStageMask;
            if (signal != VkSemaphore.Null)
            {
                submit_info.signalSemaphoreCount = 1;
                submit_info.pSignalSemaphores    = signal.Pin();
            }
            if (wait != VkSemaphore.Null)
            {
                submit_info.waitSemaphoreCount = 1;
                submit_info.pWaitSemaphores    = wait.Pin();
            }

            submit_info.commandBufferCount = 1;
            submit_info.pCommandBuffers    = handle.Pin();

            Utils.CheckResult(vkQueueSubmit(queue, 1, ref submit_info, fence));

            if (signal != VkSemaphore.Null)
            {
                signal.Unpin();
            }
            if (wait != VkSemaphore.Null)
            {
                wait.Unpin();
            }
            handle.Unpin();

            Marshal.FreeHGlobal(dstStageMask);
        }