예제 #1
0
        void EndSingleTimeCommand(VkCommandBuffer commandBuffer)
        {
            commandBuffer.End();
            var commands = new List <VkCommandBuffer> {
                commandBuffer
            };

            var info = new VkSubmitInfo();

            info.commandBuffers = commands;

            graphicsQueue.Submit(new List <VkSubmitInfo> {
                info
            }, null);
            graphicsQueue.WaitIdle();

            commandPool.Free(commands);
        }
예제 #2
0
        void CopyBuffer(VkBuffer src, VkBuffer dst, long size)
        {
            var info = new VkCommandBufferAllocateInfo();

            info.level = VkCommandBufferLevel.Primary;
            info.commandBufferCount = 1;

            var buffers = commandPool.Allocate(info);
            var buffer  = buffers[0];

            var beginInfo = new VkCommandBufferBeginInfo();

            beginInfo.flags = VkCommandBufferUsageFlags.OneTimeSubmitBit;

            buffer.Begin(beginInfo);

            VkBufferCopy region = new VkBufferCopy();

            region.srcOffset = 0;
            region.dstOffset = 0;
            region.size      = size;

            buffer.CopyBuffer(src, dst, new VkBufferCopy[] { region });
            buffer.End();

            var submitInfo = new VkSubmitInfo();

            submitInfo.commandBuffers = new List <VkCommandBuffer> {
                buffer
            };

            graphicsQueue.Submit(new List <VkSubmitInfo> {
                submitInfo
            }, null);
            graphicsQueue.WaitIdle();

            commandPool.Free(buffers);
        }
예제 #3
0
 public void BlitFramebufferToPointer(VkQueue Queue, IntPtr pointer)
 {
     Queue.WaitIdle();
     Copy(pointer, _TransferBufferPtr, Width * Height * 4);
 }