Skip to content
Permalink
Browse files

[Vulkan] Fixed mixup between Clear DSV and RT

  • Loading branch information
xen2 committed Jul 26, 2019
1 parent ab96eab commit f70d74cb15ff731c5e7ddf870e04c0d4979ee576
Showing with 2 additions and 2 deletions.
  1. +2 −2 sources/engine/Xenko.Graphics/Vulkan/CommandList.Vulkan.cs
@@ -726,12 +726,12 @@ public unsafe void Clear(Texture renderTarget, Color4 color)
var clearRange = new ImageSubresourceRange(ImageAspectFlags.Color, (uint)renderTarget.ArraySlice, (uint)renderTarget.ArraySize, (uint)renderTarget.MipLevel, (uint)renderTarget.MipLevels);

var memoryBarrier = new ImageMemoryBarrier(renderTarget.NativeImage, renderTarget.NativeLayout, ImageLayout.TransferDestinationOptimal, renderTarget.NativeAccessMask, AccessFlags.TransferWrite, clearRange);
currentCommandList.NativeCommandBuffer.PipelineBarrier(depthStencilBuffer.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, 0, null, 1, &memoryBarrier);
currentCommandList.NativeCommandBuffer.PipelineBarrier(renderTarget.NativePipelineStageMask, PipelineStageFlags.Transfer, DependencyFlags.None, 0, null, 0, null, 1, &memoryBarrier);

currentCommandList.NativeCommandBuffer.ClearColorImage(renderTarget.NativeImage, ImageLayout.TransferDestinationOptimal, ColorHelper.Convert(color), 1, &clearRange);

memoryBarrier = new ImageMemoryBarrier(renderTarget.NativeImage, ImageLayout.TransferDestinationOptimal, renderTarget.NativeLayout, AccessFlags.TransferWrite, renderTarget.NativeAccessMask, clearRange);
currentCommandList.NativeCommandBuffer.PipelineBarrier(PipelineStageFlags.Transfer, depthStencilBuffer.NativePipelineStageMask, DependencyFlags.None, 0, null, 0, null, 1, &memoryBarrier);
currentCommandList.NativeCommandBuffer.PipelineBarrier(PipelineStageFlags.Transfer, renderTarget.NativePipelineStageMask, DependencyFlags.None, 0, null, 0, null, 1, &memoryBarrier);

renderTarget.IsInitialized = true;
}

0 comments on commit f70d74c

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