MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / BufferPool

Class BufferPool

framework/buffer_pool.h:302–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300 */
301template <vkb::BindingType bindingType>
302class BufferPool
303{
304 public:
305 using BufferUsageFlagsType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferUsageFlags, VkBufferUsageFlags>::type;
306 using DeviceSizeType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceSize, VkDeviceSize>::type;
307
308 public:
309 BufferPool(
310 vkb::core::Device<bindingType> &device, DeviceSizeType block_size, BufferUsageFlagsType usage, VmaMemoryUsage memory_usage = VMA_MEMORY_USAGE_CPU_TO_GPU);
311
312 BufferBlock<bindingType> &request_buffer_block(DeviceSizeType minimum_size, bool minimal = false);
313
314 void reset();
315
316 private:
317 vkb::core::DeviceCpp &device;
318 std::vector<std::unique_ptr<BufferBlockCpp>> buffer_blocks; /// List of blocks requested (need to be pointers in order to keep their address constant on vector resizing)
319 vk::DeviceSize block_size = 0; /// Minimum size of the blocks
320 vk::BufferUsageFlags usage;
321 VmaMemoryUsage memory_usage{};
322};
323
324using BufferPoolC = BufferPool<vkb::BindingType::C>;
325using BufferPoolCpp = BufferPool<vkb::BindingType::Cpp>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected