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
29 lines
543 B
C++
29 lines
543 B
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2022 Blender Foundation. All rights reserved. */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "gpu_index_buffer_private.hh"
|
|
|
|
namespace blender::gpu {
|
|
|
|
class VKIndexBuffer : public IndexBuf {
|
|
public:
|
|
void upload_data() override;
|
|
|
|
void bind_as_ssbo(uint binding) override;
|
|
|
|
void read(uint32_t *data) const override;
|
|
|
|
void update_sub(uint start, uint len, const void *data) override;
|
|
|
|
private:
|
|
void strip_restart_indices() override;
|
|
};
|
|
|
|
} // namespace blender::gpu
|