| 300 | */ |
| 301 | template <vkb::BindingType bindingType> |
| 302 | class 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 | |
| 324 | using BufferPoolC = BufferPool<vkb::BindingType::C>; |
| 325 | using BufferPoolCpp = BufferPool<vkb::BindingType::Cpp>; |
nothing calls this directly
no outgoing calls
no test coverage detected