Vulkan: Fix indirect buffer barrier (#3798)

This commit is contained in:
gdkchan 2022-10-26 14:53:11 -03:00 committed by GitHub
parent 9719b6a112
commit 28ba55598d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 7 deletions

View file

@ -12,13 +12,12 @@ namespace Ryujinx.Graphics.Vulkan
private const int MaxUpdateBufferSize = 0x10000; private const int MaxUpdateBufferSize = 0x10000;
public const AccessFlags DefaultAccessFlags = public const AccessFlags DefaultAccessFlags =
AccessFlags.AccessIndirectCommandReadBit |
AccessFlags.AccessShaderReadBit | AccessFlags.AccessShaderReadBit |
AccessFlags.AccessShaderWriteBit | AccessFlags.AccessShaderWriteBit |
AccessFlags.AccessTransferReadBit | AccessFlags.AccessTransferReadBit |
AccessFlags.AccessTransferWriteBit | AccessFlags.AccessTransferWriteBit |
AccessFlags.AccessUniformReadBit | AccessFlags.AccessUniformReadBit;
AccessFlags.AccessShaderReadBit |
AccessFlags.AccessShaderWriteBit;
private readonly VulkanRenderer _gd; private readonly VulkanRenderer _gd;
private readonly Device _device; private readonly Device _device;

View file

@ -228,10 +228,26 @@ namespace Ryujinx.Graphics.Vulkan
Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect); Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
} }
public void CommandBufferBarrier() public unsafe void CommandBufferBarrier()
{ {
// TODO: More specific barrier? MemoryBarrier memoryBarrier = new MemoryBarrier()
Barrier(); {
SType = StructureType.MemoryBarrier,
SrcAccessMask = BufferHolder.DefaultAccessFlags,
DstAccessMask = AccessFlags.AccessIndirectCommandReadBit
};
Gd.Api.CmdPipelineBarrier(
CommandBuffer,
PipelineStageFlags.PipelineStageAllCommandsBit,
PipelineStageFlags.PipelineStageDrawIndirectBit,
0,
1,
memoryBarrier,
0,
null,
0,
null);
} }
public void CopyBuffer(BufferHandle source, BufferHandle destination, int srcOffset, int dstOffset, int size) public void CopyBuffer(BufferHandle source, BufferHandle destination, int srcOffset, int dstOffset, int size)
@ -824,7 +840,7 @@ namespace Ryujinx.Graphics.Vulkan
if (range.Handle != BufferHandle.Null) if (range.Handle != BufferHandle.Null)
{ {
_transformFeedbackBuffers[i] = _transformFeedbackBuffers[i] =
new BufferState(Gd.BufferManager.GetBuffer(CommandBuffer, range.Handle, range.Offset, range.Size, true), range.Offset, range.Size); new BufferState(Gd.BufferManager.GetBuffer(CommandBuffer, range.Handle, range.Offset, range.Size, true), range.Offset, range.Size);
_transformFeedbackBuffers[i].BindTransformFeedbackBuffer(Gd, Cbs, (uint)i); _transformFeedbackBuffers[i].BindTransformFeedbackBuffer(Gd, Cbs, (uint)i);
} }