Exemplo n.º 1
0
        public void CmdPipelineBarrier(MgPipelineStageFlagBits srcStageMask, MgPipelineStageFlagBits dstStageMask, MgDependencyFlagBits dependencyFlags, MgMemoryBarrier[] pMemoryBarriers, MgBufferMemoryBarrier[] pBufferMemoryBarriers, MgImageMemoryBarrier[] pImageMemoryBarriers)
        {
            unsafe
            {
                var memBarrierCount = pMemoryBarriers != null ? (uint)pMemoryBarriers.Length : 0U;
                var pMemBarriers    = stackalloc VkMemoryBarrier[(int)memBarrierCount];

                for (var i = 0; i < memBarrierCount; ++i)
                {
                    pMemBarriers[i] = new VkMemoryBarrier
                    {
                        sType         = VkStructureType.StructureTypeMemoryBarrier,
                        pNext         = IntPtr.Zero,
                        srcAccessMask = (VkAccessFlags)pMemoryBarriers[i].SrcAccessMask,
                        dstAccessMask = (VkAccessFlags)pMemoryBarriers[i].DstAccessMask,
                    };
                }


                uint bufBarrierCount = pBufferMemoryBarriers != null ? (uint)pBufferMemoryBarriers.Length : 0U;
                var  pBufBarriers    = stackalloc VkBufferMemoryBarrier[(int)bufBarrierCount];
                for (var j = 0; j < bufBarrierCount; ++j)
                {
                    var current = pBufferMemoryBarriers[j];
                    var bBuffer = (VkBuffer)current.Buffer;
                    Debug.Assert(bBuffer != null);

                    pBufBarriers[j] = new VkBufferMemoryBarrier
                    {
                        sType               = VkStructureType.StructureTypeBufferMemoryBarrier,
                        pNext               = IntPtr.Zero,
                        dstAccessMask       = (VkAccessFlags)current.DstAccessMask,
                        srcAccessMask       = (VkAccessFlags)current.SrcAccessMask,
                        srcQueueFamilyIndex = current.SrcQueueFamilyIndex,
                        dstQueueFamilyIndex = current.DstQueueFamilyIndex,
                        buffer              = bBuffer.Handle,
                        offset              = current.Offset,
                        size = current.Size,
                    };
                }


                uint imgBarriersCount = pImageMemoryBarriers != null ? (uint)pImageMemoryBarriers.Length : 0U;
                var  pImgBarriers     = stackalloc VkImageMemoryBarrier[(int)imgBarriersCount];

                for (var k = 0; k < imgBarriersCount; ++k)
                {
                    var current = pImageMemoryBarriers[k];
                    var bImage  = (VkImage)current.Image;
                    Debug.Assert(bImage != null);

                    pImgBarriers[k] = new VkImageMemoryBarrier
                    {
                        sType               = VkStructureType.StructureTypeImageMemoryBarrier,
                        pNext               = IntPtr.Zero,
                        dstAccessMask       = (VkAccessFlags)current.DstAccessMask,
                        srcAccessMask       = (VkAccessFlags)current.SrcAccessMask,
                        oldLayout           = (VkImageLayout)current.OldLayout,
                        newLayout           = (VkImageLayout)current.NewLayout,
                        srcQueueFamilyIndex = current.SrcQueueFamilyIndex,
                        dstQueueFamilyIndex = current.DstQueueFamilyIndex,
                        image               = bImage.Handle,
                        subresourceRange    = new VkImageSubresourceRange
                        {
                            aspectMask     = (VkImageAspectFlags)current.SubresourceRange.AspectMask,
                            baseArrayLayer = current.SubresourceRange.BaseArrayLayer,
                            baseMipLevel   = current.SubresourceRange.BaseMipLevel,
                            layerCount     = current.SubresourceRange.LayerCount,
                            levelCount     = current.SubresourceRange.LevelCount,
                        }
                    };
                }

                VkMemoryBarrier *      mems   = memBarrierCount > 0 ? pMemBarriers : null;
                VkBufferMemoryBarrier *bufs   = bufBarrierCount > 0 ? pBufBarriers : null;
                VkImageMemoryBarrier * images = imgBarriersCount > 0 ? pImgBarriers : null;


                Interops.vkCmdPipelineBarrier(Handle,
                                              (VkPipelineStageFlags)srcStageMask,
                                              (VkPipelineStageFlags)dstStageMask,
                                              (VkDependencyFlags)dependencyFlags,
                                              memBarrierCount,
                                              mems,
                                              bufBarrierCount,
                                              bufs,
                                              imgBarriersCount,
                                              images);
            }
        }
Exemplo n.º 2
0
 public void CmdPipelineBarrier(MgPipelineStageFlagBits srcStageMask, MgPipelineStageFlagBits dstStageMask, MgDependencyFlagBits dependencyFlags, MgMemoryBarrier[] pMemoryBarriers, MgBufferMemoryBarrier[] pBufferMemoryBarriers, MgImageMemoryBarrier[] pImageMemoryBarriers)
 {
 }
Exemplo n.º 3
0
 public void CmdPipelineBarrier(MgPipelineStageFlagBits srcStageMask, MgPipelineStageFlagBits dstStageMask, MgDependencyFlagBits dependencyFlags, MgMemoryBarrier[] pMemoryBarriers, MgBufferMemoryBarrier[] pBufferMemoryBarriers, MgImageMemoryBarrier[] pImageMemoryBarriers)
 {
     throw new NotImplementedException();
 }