mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-21 01:02:01 +00:00
Vulkan: Add missing barriers for texture to buffer copy (#7092)
This barrier has always been missing, but it only became apparent when #7012 merged. I also added some barriers in case the target buffer used here is used by other commands, though right now it isn't. Fixes a regression where water would turn white on AMD GPUs with the proprietary driver. May fix other issues on this driver.
This commit is contained in:
parent
95d252b7b8
commit
ccd330ba0f
1 changed files with 41 additions and 0 deletions
|
@ -667,8 +667,36 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (PrepareOutputBuffer(cbs, hostSize, buffer, out VkBuffer copyToBuffer, out BufferHolder tempCopyHolder))
|
if (PrepareOutputBuffer(cbs, hostSize, buffer, out VkBuffer copyToBuffer, out BufferHolder tempCopyHolder))
|
||||||
{
|
{
|
||||||
|
// No barrier necessary, as this is a temporary copy buffer.
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BufferHolder.InsertBufferBarrier(
|
||||||
|
_gd,
|
||||||
|
cbs.CommandBuffer,
|
||||||
|
copyToBuffer,
|
||||||
|
BufferHolder.DefaultAccessFlags,
|
||||||
|
AccessFlags.TransferWriteBit,
|
||||||
|
PipelineStageFlags.AllCommandsBit,
|
||||||
|
PipelineStageFlags.TransferBit,
|
||||||
|
offset,
|
||||||
|
outSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
InsertImageBarrier(
|
||||||
|
_gd.Api,
|
||||||
|
cbs.CommandBuffer,
|
||||||
|
image,
|
||||||
|
TextureStorage.DefaultAccessMask,
|
||||||
|
AccessFlags.TransferReadBit,
|
||||||
|
PipelineStageFlags.AllCommandsBit,
|
||||||
|
PipelineStageFlags.TransferBit,
|
||||||
|
Info.Format.ConvertAspectFlags(),
|
||||||
|
FirstLayer + layer,
|
||||||
|
FirstLevel + level,
|
||||||
|
1,
|
||||||
|
1);
|
||||||
|
|
||||||
CopyFromOrToBuffer(cbs.CommandBuffer, copyToBuffer, image, hostSize, true, layer, level, 1, 1, singleSlice: true, offset, stride);
|
CopyFromOrToBuffer(cbs.CommandBuffer, copyToBuffer, image, hostSize, true, layer, level, 1, 1, singleSlice: true, offset, stride);
|
||||||
|
|
||||||
|
@ -677,6 +705,19 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
CopyDataToOutputBuffer(cbs, tempCopyHolder, autoBuffer, hostSize, range.Offset);
|
CopyDataToOutputBuffer(cbs, tempCopyHolder, autoBuffer, hostSize, range.Offset);
|
||||||
tempCopyHolder.Dispose();
|
tempCopyHolder.Dispose();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BufferHolder.InsertBufferBarrier(
|
||||||
|
_gd,
|
||||||
|
cbs.CommandBuffer,
|
||||||
|
copyToBuffer,
|
||||||
|
AccessFlags.TransferWriteBit,
|
||||||
|
BufferHolder.DefaultAccessFlags,
|
||||||
|
PipelineStageFlags.TransferBit,
|
||||||
|
PipelineStageFlags.AllCommandsBit,
|
||||||
|
offset,
|
||||||
|
outSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReadOnlySpan<byte> GetData(CommandBufferPool cbp, PersistentFlushBuffer flushBuffer)
|
private ReadOnlySpan<byte> GetData(CommandBufferPool cbp, PersistentFlushBuffer flushBuffer)
|
||||||
|
|
Loading…
Reference in a new issue