Skip to content
Permalink
Browse files

[Vulkan] UpdateSubresource: Fixed memory barrier

  • Loading branch information
xen2 committed Jul 26, 2019
1 parent 4e1bd31 commit ab96eab76ef8168fe5855938a05d9a18515a1d35
Showing with 2 additions and 2 deletions.
  1. +2 −2 sources/engine/Xenko.Graphics/Vulkan/CommandList.Vulkan.cs
@@ -1184,7 +1184,7 @@ internal unsafe void UpdateSubresource(GraphicsResource resource, int subResourc
var subresourceRange = new ImageSubresourceRange(ImageAspectFlags.Color, (uint)arraySlice, 1, (uint)mipSlice, 1);

var memoryBarrier = new ImageMemoryBarrier(texture.NativeImage, texture.NativeLayout, ImageLayout.TransferDestinationOptimal, texture.NativeAccessMask, AccessFlags.TransferWrite, subresourceRange);
currentCommandList.NativeCommandBuffer.PipelineBarrier(texture.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, 1, &uploadBufferMemoryBarrier, 1, &memoryBarrier);
currentCommandList.NativeCommandBuffer.PipelineBarrier(texture.NativePipelineStageMask | PipelineStageFlags.Host, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, 1, &uploadBufferMemoryBarrier, 1, &memoryBarrier);

// TODO VULKAN: Handle depth-stencil (NOTE: only supported on graphics queue)
// TODO VULKAN: Handle non-packed pitches
@@ -1218,7 +1218,7 @@ internal unsafe void UpdateSubresource(GraphicsResource resource, int subResourc

memoryBarriers[0] = uploadBufferMemoryBarrier;
memoryBarriers[1] = new BufferMemoryBarrier(buffer.NativeBuffer, buffer.NativeAccessMask, AccessFlags.TransferWrite, bufferCopy.DestinationOffset, bufferCopy.Size);
currentCommandList.NativeCommandBuffer.PipelineBarrier(buffer.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, 2, memoryBarriers, 0, null);
currentCommandList.NativeCommandBuffer.PipelineBarrier(buffer.NativePipelineStageMask | PipelineStageFlags.Host, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, 2, memoryBarriers, 0, null);

currentCommandList.NativeCommandBuffer.CopyBuffer(uploadResource, buffer.NativeBuffer, 1, &bufferCopy);

0 comments on commit ab96eab

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