Example #1
0
 internal static unsafe extern void vkCmdEndQuery(CommandBuffer commandBuffer, QueryPool queryPool, uint query);
Example #2
0
 internal static unsafe extern Result vkAllocateCommandBuffers(Device device, CommandBufferAllocateInfo* allocateInfo, CommandBuffer* commandBuffers);
Example #3
0
        protected virtual void CreateCommandBuffer()
        {
            // Command pool
            var commandPoolCreateInfo = new CommandPoolCreateInfo
            {
                StructureType = StructureType.CommandPoolCreateInfo,
                QueueFamilyIndex = 0,
                Flags = CommandPoolCreateFlags.ResetCommandBuffer
            };
            commandPool = device.CreateCommandPool(ref commandPoolCreateInfo);

            // Command buffer
            var commandBufferAllocationInfo = new CommandBufferAllocateInfo
            {
                StructureType = StructureType.CommandBufferAllocateInfo,
                Level = CommandBufferLevel.Primary,
                CommandPool = commandPool,
                CommandBufferCount = 1
            };
            CommandBuffer commandBuffer;
            device.AllocateCommandBuffers(ref commandBufferAllocationInfo, &commandBuffer);
            this.commandBuffer = commandBuffer;
        }
Example #4
0
 internal static unsafe extern Result vkEndCommandBuffer(CommandBuffer commandBuffer);
Example #5
0
 public unsafe void AllocateCommandBuffers(ref CommandBufferAllocateInfo allocateInfo, CommandBuffer* commandBuffers)
 {
     fixed (CommandBufferAllocateInfo* __allocateInfo__ = &allocateInfo)
     {
         vkAllocateCommandBuffers(this, __allocateInfo__, commandBuffers).CheckError();
     }
 }
Example #6
0
 internal static unsafe extern void vkCmdSetViewport(CommandBuffer commandBuffer, uint firstViewport, uint viewportCount, Viewport* viewports);
Example #7
0
 internal static unsafe extern void vkCmdWaitEvents(CommandBuffer commandBuffer, uint eventCount, Event* events, PipelineStageFlags sourceStageMask, PipelineStageFlags destinationStageMask, uint memoryBarrierCount, MemoryBarrier* memoryBarriers, uint bufferMemoryBarrierCount, BufferMemoryBarrier* bufferMemoryBarriers, uint imageMemoryBarrierCount, ImageMemoryBarrier* imageMemoryBarriers);
Example #8
0
 internal static unsafe extern void vkCmdPushConstants(CommandBuffer commandBuffer, PipelineLayout layout, ShaderStageFlags stageFlags, uint offset, uint size, IntPtr values);
Example #9
0
 internal static unsafe extern void vkCmdResetQueryPool(CommandBuffer commandBuffer, QueryPool queryPool, uint firstQuery, uint queryCount);
Example #10
0
 internal static unsafe extern void vkCmdNextSubpass(CommandBuffer commandBuffer, SubpassContents contents);
Example #11
0
 internal static unsafe extern void vkCmdPipelineBarrier(CommandBuffer commandBuffer, PipelineStageFlags sourceStageMask, PipelineStageFlags destinationStageMask, DependencyFlags dependencyFlags, uint memoryBarrierCount, MemoryBarrier* memoryBarriers, uint bufferMemoryBarrierCount, BufferMemoryBarrier* bufferMemoryBarriers, uint imageMemoryBarrierCount, ImageMemoryBarrier* imageMemoryBarriers);
Example #12
0
 internal static unsafe extern void vkCmdFillBuffer(CommandBuffer commandBuffer, Buffer destinationBuffer, ulong destinationOffset, ulong size, uint data);
Example #13
0
 internal static unsafe extern void vkCmdExecuteCommands(CommandBuffer commandBuffer, uint commandBufferCount, CommandBuffer* commandBuffers);
Example #14
0
 internal static unsafe extern void vkCmdEndRenderPass(CommandBuffer commandBuffer);
Example #15
0
 internal static unsafe extern void vkCmdSetStencilReference(CommandBuffer commandBuffer, StencilFaceFlags faceMask, uint reference);
Example #16
0
 internal static unsafe extern void vkCmdResolveImage(CommandBuffer commandBuffer, Image sourceImage, ImageLayout sourceImageLayout, Image destinationImage, ImageLayout destinationImageLayout, uint regionCount, ImageResolve* regions);
Example #17
0
 internal static unsafe extern void vkCmdSetStencilWriteMask(CommandBuffer commandBuffer, StencilFaceFlags faceMask, uint writeMask);
Example #18
0
 internal static unsafe extern void vkCmdSetBlendConstants(CommandBuffer commandBuffer, float blendConstants);
Example #19
0
 internal static unsafe extern void vkCmdUpdateBuffer(CommandBuffer commandBuffer, Buffer destinationBuffer, ulong destinationOffset, ulong dataSize, uint* data);
Example #20
0
 internal static unsafe extern void vkCmdSetDepthBias(CommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
Example #21
0
 internal static unsafe extern void vkCmdWriteTimestamp(CommandBuffer commandBuffer, PipelineStageFlags pipelineStage, QueryPool queryPool, uint query);
Example #22
0
 internal static unsafe extern void vkCmdSetDepthBounds(CommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds);
Example #23
0
 internal static unsafe extern Result vkResetCommandBuffer(CommandBuffer commandBuffer, CommandBufferResetFlags flags);
Example #24
0
 internal static unsafe extern void vkCmdSetEvent(CommandBuffer commandBuffer, Event @event, PipelineStageFlags stageMask);
Example #25
0
 public unsafe void FreeCommandBuffers(CommandPool commandPool, uint commandBufferCount, CommandBuffer* commandBuffers)
 {
     vkFreeCommandBuffers(this, commandPool, commandBufferCount, commandBuffers);
 }
Example #26
0
 internal static unsafe extern void vkCmdSetLineWidth(CommandBuffer commandBuffer, float lineWidth);
Example #27
0
        public void Flush()
        {
            if (this.setupCommanBuffer == CommandBuffer.Null)
                return;

            var setupCommanBuffer = this.setupCommanBuffer;

            this.setupCommanBuffer.End();

            var submitInfo = new SubmitInfo
            {
                StructureType = StructureType.SubmitInfo,
                CommandBufferCount = 1,
                CommandBuffers = new IntPtr(&setupCommanBuffer)
            };

            queue.Submit(1, &submitInfo, Fence.Null);

            queue.WaitIdle();

            device.FreeCommandBuffers(commandPool, 1, &setupCommanBuffer);

            this.setupCommanBuffer = CommandBuffer.Null;
        }
Example #28
0
 internal static unsafe extern void vkCmdSetScissor(CommandBuffer commandBuffer, uint firstScissor, uint scissorCount, Rect2D* scissors);
Example #29
0
        private void SetImageLayout(Image image, ImageAspectFlags imageAspect, ImageLayout oldLayout, ImageLayout newLayout)
        {
            if (setupCommanBuffer == CommandBuffer.Null)
            {
                // Create command buffer
                CommandBuffer setupCommandBuffer;
                var allocateInfo = new CommandBufferAllocateInfo
                {
                    StructureType = StructureType.CommandBufferAllocateInfo,
                    CommandPool = commandPool,
                    Level = CommandBufferLevel.Primary,
                    CommandBufferCount = 1,
                };
                device.AllocateCommandBuffers(ref allocateInfo, &setupCommandBuffer);
                setupCommanBuffer = setupCommandBuffer;

                // Begin command buffer
                var inheritanceInfo = new CommandBufferInheritanceInfo { StructureType = StructureType.CommandBufferInheritanceInfo };
                var beginInfo = new CommandBufferBeginInfo
                {
                    StructureType = StructureType.CommandBufferBeginInfo,
                    InheritanceInfo = new IntPtr(&inheritanceInfo)
                };
                setupCommanBuffer.Begin(ref beginInfo);
            }

            var imageMemoryBarrier = new ImageMemoryBarrier
            {
                StructureType = StructureType.ImageMemoryBarrier,
                OldLayout = oldLayout,
                NewLayout = newLayout,
                Image = image,
                SubresourceRange = new ImageSubresourceRange(imageAspect, 0, 1, 0, 1)
            };

            switch (newLayout)
            {
                case ImageLayout.TransferDestinationOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.TransferRead;
                    break;
                case ImageLayout.ColorAttachmentOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.ColorAttachmentWrite;
                    break;
                case ImageLayout.DepthStencilAttachmentOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.DepthStencilAttachmentWrite;
                    break;
                case ImageLayout.ShaderReadOnlyOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.ShaderRead | AccessFlags.InputAttachmentRead;
                    break;
            }

            var sourceStages = PipelineStageFlags.TopOfPipe;
            var destinationStages = PipelineStageFlags.TopOfPipe;

            setupCommanBuffer.PipelineBarrier(sourceStages, destinationStages, DependencyFlags.None, 0, null, 0, null, 1, &imageMemoryBarrier);
        }
Example #30
0
 internal static unsafe extern void vkCmdDrawIndirect(CommandBuffer commandBuffer, Buffer buffer, ulong offset, uint drawCount, uint stride);