Skip to content
Permalink
Browse files

[Vulkan] Fix some memory barriers in CommandList.Copy and CopyRegion

  • Loading branch information
xen2 committed Sep 5, 2019
1 parent 05eba03 commit 4249625313e1cd12d67fab6750ce87dbb8f7320b
Showing with 4 additions and 4 deletions.
  1. +4 −4 sources/engine/Xenko.Graphics/Vulkan/CommandList.Vulkan.cs
@@ -847,7 +847,7 @@ public unsafe void Copy(GraphicsResource source, GraphicsResource destination)
imageBarriers[imageBarrierCount++] = new ImageMemoryBarrier(destinationParent.NativeImage, destinationTexture.NativeLayout, ImageLayout.TransferDestinationOptimal, destinationTexture.NativeAccessMask, AccessFlags.TransferWrite, new ImageSubresourceRange(destinationParent.NativeImageAspect));
}

currentCommandList.NativeCommandBuffer.PipelineBarrier(sourceTexture.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);
currentCommandList.NativeCommandBuffer.PipelineBarrier(sourceTexture.NativePipelineStageMask | destinationParent.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);

// Copy
if (destinationTexture.Usage == GraphicsResourceUsage.Staging)
@@ -936,7 +936,7 @@ public unsafe void Copy(GraphicsResource source, GraphicsResource destination)
imageBarrierCount++;
}

currentCommandList.NativeCommandBuffer.PipelineBarrier(PipelineStageFlags.Transfer, sourceTexture.NativePipelineStageMask, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);
currentCommandList.NativeCommandBuffer.PipelineBarrier(PipelineStageFlags.Transfer, sourceTexture.NativePipelineStageMask | destinationParent.NativePipelineStageMask, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);
}
else
{
@@ -1015,7 +1015,7 @@ public unsafe void CopyRegion(GraphicsResource source, int sourceSubresource, Re
imageBarriers[imageBarrierCount++] = new ImageMemoryBarrier(destinationParent.NativeImage, destinationParent.NativeLayout, ImageLayout.TransferDestinationOptimal, destinationParent.NativeAccessMask, AccessFlags.TransferWrite, new ImageSubresourceRange(destinationParent.NativeImageAspect));
}

currentCommandList.NativeCommandBuffer.PipelineBarrier(sourceTexture.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);
currentCommandList.NativeCommandBuffer.PipelineBarrier(sourceTexture.NativePipelineStageMask | destinationParent.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);

// Copy
if (destinationTexture.Usage == GraphicsResourceUsage.Staging)
@@ -1110,7 +1110,7 @@ public unsafe void CopyRegion(GraphicsResource source, int sourceSubresource, Re
imageBarrierCount++;
}

currentCommandList.NativeCommandBuffer.PipelineBarrier(PipelineStageFlags.Transfer, sourceTexture.NativePipelineStageMask, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);
currentCommandList.NativeCommandBuffer.PipelineBarrier(PipelineStageFlags.Transfer, sourceTexture.NativePipelineStageMask | destinationParent.NativePipelineStageMask, DependencyFlags.None, 0, null, bufferBarrierCount, bufferBarriers, imageBarrierCount, imageBarriers);
}
else
{

0 comments on commit 4249625

Please sign in to comment.
You can’t perform that action at this time.