GPU: Use same read back API as SSBOs

The GPU module has 2 different styles when reading back data from
GPU buffers. The SSBOs used a memcpy to copy the data to a
pre-allocated buffer. IndexBuf/VertBuf gave back a driver/platform
controlled pointer to the memory.

Readback is done for test cases returning mapped pointers is not safe.
For this reason we settled on using the same approach as the SSBO.
Copy the data to a caller pre-allocated buffer.

Reason why this API is currently changed is that the Vulkan API is more
strict on mapping/unmapping buffers that can lead to potential issues
down the road.

Pull Request #104571
This commit is contained in:
2023-02-13 08:34:19 +01:00
parent 86b3073c9e
commit f828ecf4ba
19 changed files with 37 additions and 90 deletions

View File

@@ -94,8 +94,7 @@ class VertBuf {
}
virtual void update_sub(uint start, uint len, const void *data) = 0;
virtual const void *read() const = 0;
virtual void *unmap(const void *mapped_data) const = 0;
virtual void read(void *data) const = 0;
protected:
virtual void acquire_data() = 0;