Vulkan: Buffer Mirrors for MacOS performance (#4899)
* Initial implementation of buffer mirrors Generally slower right now, goal is to reduce render passes in games that do inline updates Fix support buffer mirrors Reintroduce vertex buffer mirror Add storage buffer support Optimisation part 1 More optimisation Avoid useless data copies. Remove unused cbIndex stuff Properly set write flag for storage buffers. Fix minor issues Not sure why this was here. Fix BufferRangeList Fix some big issues Align storage buffers rather than getting full buffer as a range Improves mirrorability of read-only storage buffers Increase staging buffer size, as it now contains mirrors Fix some issues with buffers not updating Fix buffer SetDataUnchecked offset for one of the paths when using mirrors Fix buffer mirrors interaction with buffer textures Fix mirror rebinding Move GetBuffer calls on indirect draws before BeginRenderPass to avoid draws without render pass Fix mirrors rebase Fix rebase 2023 * Fix crash when using stale vertex buffer Similar to `Get` with a size that's too large, just treat it as a clamp. * Explicitly set support buffer as mirrorable * Address feedback * Remove unused fragment of MVK workaround * Replace logging for staging buffer OOM * Address format issues * Address more format issues * Mini cleanup * Address more things * Rename BufferRangeList * Support bounding range for ClearMirrors and UploadPendingData * Add maximum size for vertex buffer mirrors * Enable index buffer mirrors Enabled on all platforms for the IbStreamer. * Feedback * Remove mystery BufferCache change Probably macos related? * Fix mirrors not creating when staging buffer is empty. * Change log level to debug
This commit is contained in:
parent
550fd4a733
commit
492a046335
27 changed files with 1285 additions and 136 deletions
|
@ -127,24 +127,24 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
ReleaseImpl();
|
||||
}
|
||||
|
||||
public BufferView GetBufferView(CommandBufferScoped cbs)
|
||||
public BufferView GetBufferView(CommandBufferScoped cbs, bool write)
|
||||
{
|
||||
_bufferView ??= _gd.BufferManager.CreateView(_bufferHandle, VkFormat, _offset, _size, ReleaseImpl);
|
||||
|
||||
return _bufferView?.Get(cbs, _offset, _size).Value ?? default;
|
||||
return _bufferView?.Get(cbs, _offset, _size, write).Value ?? default;
|
||||
}
|
||||
|
||||
public BufferView GetBufferView(CommandBufferScoped cbs, Format format)
|
||||
public BufferView GetBufferView(CommandBufferScoped cbs, Format format, bool write)
|
||||
{
|
||||
var vkFormat = FormatTable.GetFormat(format);
|
||||
if (vkFormat == VkFormat)
|
||||
{
|
||||
return GetBufferView(cbs);
|
||||
return GetBufferView(cbs, write);
|
||||
}
|
||||
|
||||
if (_selfManagedViews != null && _selfManagedViews.TryGetValue(format, out var bufferView))
|
||||
{
|
||||
return bufferView.Get(cbs, _offset, _size).Value;
|
||||
return bufferView.Get(cbs, _offset, _size, write).Value;
|
||||
}
|
||||
|
||||
bufferView = _gd.BufferManager.CreateView(_bufferHandle, vkFormat, _offset, _size, ReleaseImpl);
|
||||
|
@ -154,7 +154,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
(_selfManagedViews ??= new Dictionary<Format, Auto<DisposableBufferView>>()).Add(format, bufferView);
|
||||
}
|
||||
|
||||
return bufferView?.Get(cbs, _offset, _size).Value ?? default;
|
||||
return bufferView?.Get(cbs, _offset, _size, write).Value ?? default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue