Add buffer manager support for accelerated copies

These will be sequenced on the GPU/CPU depending on what's optimal and avoid any serialisation
This commit is contained in:
Billy Laws
2022-10-25 21:03:29 +01:00
parent cac287d9fd
commit 37ff0ab814
2 changed files with 50 additions and 0 deletions

View File

@ -290,6 +290,12 @@ namespace skyline::gpu {
*/
bool Write(span<u8> data, vk::DeviceSize offset, const std::function<void()> &gpuCopyCallback = {});
/**
* @brief Copies a region of the src buffer into a region of this buffer
* @note The src/dst buffers **must** be locked prior to calling this
*/
void CopyFrom(vk::DeviceSize dstOffset, Buffer *src, vk::DeviceSize srcOffset, vk::DeviceSize size, const std::function<void()> &gpuCopyCallback);
/**
* @return A view into this buffer with the supplied attributes
* @note The buffer **must** be locked prior to calling this
@ -451,6 +457,12 @@ namespace skyline::gpu {
*/
span<u8> GetReadOnlyBackingSpan(bool isFirstUsage, const std::function<void()> &flushHostCallback);
/**
* @brief Copies the contents of one view into this one
* @note The src/dst views **must** be locked prior to calling this
*/
void CopyFrom(BufferView src, const std::function<void()> &gpuCopyCallback);
constexpr operator bool() {
return delegate != nullptr;
}