Implement support for GPU-side constant buffer updating

Previously constant buffer updates would be handled on the CPU and only the end result would be synced to the GPU before execute. This caused issues as if the constant buffer contents was changed between each draw in a renderpass (e.g. text rendering) the draws themselves would only see the final resulting constant buffer. Fix this by updating cbufs on the GPU/CPU seperately, only ever syncing them back at the start or after a guest side CPU write, at the moment only a single word is updated at a time however this can be optimised in the future to batch all consecutive updates into one large one.
This commit is contained in:
Billy Laws
2022-04-13 22:06:36 +01:00
committed by PixelyIon
parent 036faedabd
commit d79635772f
3 changed files with 19 additions and 7 deletions

View File

@ -171,8 +171,9 @@ namespace skyline::gpu {
/**
* @brief Writes data at the specified offset in the buffer
* @param skipCleanHostWrite Skip writing to the host buffer if it's clean, assumes the buffer data will be synchronised externally
*/
void Write(span<u8> data, vk::DeviceSize offset);
void Write(span<u8> data, vk::DeviceSize offset, bool skipCleanHostWrite = false);
/**
* @return A cached or newly created view into this buffer with the supplied attributes
@ -250,7 +251,8 @@ namespace skyline::gpu {
/**
* @brief Writes data at the specified offset in the view
* @note The view **must** be locked prior to calling this
* @param skipCleanHostWrite Skip writing to the host buffer if it's clean, assumes the buffer data will be synchronised externally
*/
void Write(span<u8> data, vk::DeviceSize offset) const;
void Write(span<u8> data, vk::DeviceSize offset, bool skipCleanHostWrite = false) const;
};
}