Ejemplo n.º 1
0
        /// <summary>
        /// Submits semaphores or a command buffer to a queue.
        /// </summary>
        /// <param name="fence">
        /// An optional handle to a fence to be signaled. If fence is not <c>null</c>, it defines a
        /// fence signal operation.
        /// </param>
        /// <param name="waitSemaphore">
        /// Semaphore upon which to wait before the command buffer for this batch begins execution.
        /// If semaphore to wait on is provided, it defines a semaphore wait operation.
        /// </param>
        /// <param name="waitDstStageMask">Pipeline stages at which semaphore wait will occur.</param>
        /// <param name="commandBuffer">Command buffer to execute in the batch.</param>
        /// <param name="signalSemaphore">
        /// Semaphore which will be signaled when the command buffer for this batch has completed
        /// execution. If semaphore to be signaled is provided, it defines a semaphore signal operation.
        /// </param>
        /// <exception cref="VulkanException">Vulkan returns an error code.</exception>
        public void Submit(Semaphore waitSemaphore, PipelineStages waitDstStageMask,
                           CommandBuffer commandBuffer, Semaphore signalSemaphore, Fence fence = null)
        {
            long   waitSemaphoreHandle   = waitSemaphore;
            IntPtr commandBufferHandle   = commandBuffer;
            long   signalSemaphoreHandle = signalSemaphore;

            var nativeSubmit = new SubmitInfo.Native {
                Type = StructureType.SubmitInfo
            };

            if (waitSemaphoreHandle != 0)
            {
                nativeSubmit.WaitSemaphoreCount = 1;
                nativeSubmit.WaitSemaphores     = new IntPtr(&waitSemaphoreHandle);
                nativeSubmit.WaitDstStageMask   = new IntPtr(&waitDstStageMask);
            }
            if (commandBufferHandle != IntPtr.Zero)
            {
                nativeSubmit.CommandBufferCount = 1;
                nativeSubmit.CommandBuffers     = new IntPtr(&commandBufferHandle);
            }
            if (signalSemaphoreHandle != 0)
            {
                nativeSubmit.SignalSemaphoreCount = 1;
                nativeSubmit.SignalSemaphores     = new IntPtr(&signalSemaphoreHandle);
            }

            Result result = vkQueueSubmit(this, 1, &nativeSubmit, fence);

            VulkanException.ThrowForInvalidResult(result);
        }
Ejemplo n.º 2
0
 public InstanceRendererEffect(
     string name, Graphics graphics,
     ImageLayout finalLayout, Accesses finalAccess, PipelineStages finalStage, ImageLayout initialLayout = ImageLayout.Undefined,
     Accesses initialAccess = Accesses.None, PipelineStages initialStage = PipelineStages.TopOfPipe
     )
     : base(name, graphics, finalLayout, finalAccess, finalStage, initialLayout, initialAccess, initialStage)
 {
 }
Ejemplo n.º 3
0
 public SpriteEffect(Graphics graphics, RenderPassObject renderPass, int maxSprites, ImageLayout initialLayout,
                     Accesses initialAccess, PipelineStages initialStage)
     : base(
         nameof(SpriteEffect), graphics, ImageLayout.ColorAttachmentOptimal,
         Accesses.ColorAttachmentWrite, PipelineStages.ColorAttachmentOutput, initialLayout, initialAccess, initialStage
         )
 {
     RenderPass = renderPass;
     MaxSprites = maxSprites;
 }
Ejemplo n.º 4
0
 public TriangleTestEffect(Graphics graphics, RenderPassObject renderPass, Texture2D texture, ImageLayout initialLayout,
                           Accesses initialAccess, PipelineStages initialStage)
     : base(
         nameof(TriangleTestEffect), graphics, ImageLayout.ColorAttachmentOptimal,
         Accesses.ColorAttachmentWrite, PipelineStages.ColorAttachmentOutput, initialLayout, initialAccess, initialStage
         )
 {
     RenderPass = renderPass;
     Texture    = texture;
 }
Ejemplo n.º 5
0
 public TransitionEffect(
         Graphics graphics, ImageLayout initialLayout, Accesses initialAccess, PipelineStages initialStage,
         ImageLayout finalLayout, Accesses finalAccess, PipelineStages finalStage
     )
     : base(
             nameof(TransitionEffect), graphics,
             finalLayout, finalAccess, finalStage,
             initialLayout, initialAccess, initialStage
         )
 {
 }
Ejemplo n.º 6
0
 public ImageEffect(
     string name, Graphics graphics,
     ImageLayout finalLayout, Accesses finalAccess, PipelineStages finalStage, ImageLayout initialLayout = ImageLayout.Undefined,
     Accesses initialAccess = Accesses.None, PipelineStages initialStage = PipelineStages.TopOfPipe
     )
 {
     Name          = name;
     Graphics      = graphics;
     InitialLayout = initialLayout;
     InitialAccess = initialAccess;
     InitialStage  = initialStage;
     FinalLayout   = finalLayout;
     FinalAccess   = finalAccess;
     FinalStage    = finalStage;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubpassDependency"/> structure.
 /// </summary>
 /// <param name="srcSubpass">
 /// The subpass index of the first subpass in the dependency, or <see cref="Constant.SubpassExternal"/>.
 /// </param>
 /// <param name="dstSubpass">
 /// The subpass index of the second subpass in the dependency, or <see cref="Constant.SubpassExternal"/>.
 /// </param>
 /// <param name="srcStageMask">Specifies a source stage mask.</param>
 /// <param name="dstStageMask">Specifies a destination stage mask.</param>
 /// <param name="srcAccessMask">Specifies a source access mask.</param>
 /// <param name="dstAccessMask">Specifies a destination access mask.</param>
 /// <param name="dependencyFlags">A bitmask of <see cref="Dependencies"/>.</param>
 public SubpassDependency(
     int srcSubpass,
     int dstSubpass,
     PipelineStages srcStageMask,
     PipelineStages dstStageMask,
     Accesses srcAccessMask,
     Accesses dstAccessMask,
     Dependencies dependencyFlags = Dependencies.None)
 {
     SrcSubpass      = srcSubpass;
     DstSubpass      = dstSubpass;
     SrcStageMask    = srcStageMask;
     DstStageMask    = dstStageMask;
     SrcAccessMask   = srcAccessMask;
     DstAccessMask   = dstAccessMask;
     DependencyFlags = dependencyFlags;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Execute a pipelined write of a marker value into a buffer.
 /// </summary>
 /// <param name="commandBuffer">The command buffer into which the command will be recorded.</param>
 /// <param name="pipelineStage">Specifies the pipeline stage whose completion triggers the marker write.</param>
 /// <param name="dstBuffer">The buffer where the marker will be written to.</param>
 /// <param name="dstOffset">The byte offset into the buffer where the marker will be written to.</param>
 /// <param name="marker">The 32-bit value of the marker.</param>
 public static void CmdWriteBufferMarkerAmd(this CommandBuffer commandBuffer,
                                            PipelineStages pipelineStage, Buffer dstBuffer, long dstOffset, int marker)
 {
     vkCmdWriteBufferMarkerAMD(commandBuffer)(commandBuffer, pipelineStage, dstBuffer, dstOffset, marker);
 }
Ejemplo n.º 9
0
 public PipelineStage GetStage(PipelineStages stage)
 {
     return(GetStage("__PipelineEntry"));
 }
Ejemplo n.º 10
0
 public PipelineStage GetStage(PipelineStages stage)
 {
     return GetStage("__PipelineEntry");
 }