Blender V5.3
vk_buffer_pool.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_string_ref.hh"
12
13#include "vk_buffer.hh"
14#include "vk_common.hh"
15
16namespace blender::gpu {
25 StringRefNull name_;
26 VkDeviceSize buffer_offset_;
27 VkDeviceSize default_buffer_size_;
28 VkDeviceSize alignment_;
29 Vector<uint8_t> data_;
30 VkBufferUsageFlags vk_buffer_usage_;
31 VmaMemoryUsage vma_memory_usage_;
32 VmaAllocationCreateFlags vma_allocation_create_flags_;
33 float priority_;
34
35 public:
36 VKBufferPool(VKBufferPool &&other) = default;
38 VkDeviceSize default_buffer_size,
39 VkDeviceSize alignment,
40 VkBufferUsageFlags vk_buffer_usage,
41 VmaMemoryUsage vma_memory_usage,
42 VmaAllocationCreateFlags vma_allocation_create_flags,
43 float priority = 1.0f)
44 : name_(name),
45 default_buffer_size_(default_buffer_size),
46 alignment_(alignment),
47 vk_buffer_usage_(vk_buffer_usage),
48 vma_memory_usage_(vma_memory_usage),
49 vma_allocation_create_flags_(vma_allocation_create_flags),
50 priority_(priority)
51 {
52 data_.resize(default_buffer_size_);
53 }
54 virtual ~VKBufferPool();
55
64
68 void ensure_uploaded();
69
73 void discard();
74
75 private:
76 void finalize_active_buffer();
77};
78} // namespace blender::gpu
A pool of VkBuffers.
void discard()
Discard the current buffers to the discard pool.
void ensure_uploaded()
Ensure that all the data is uploaded.
VKBufferWithOffset append(Span< uint8_t > data)
Append the given data.
VKBufferPool(VKBufferPool &&other)=default
VKBufferPool(StringRefNull name, VkDeviceSize default_buffer_size, VkDeviceSize alignment, VkBufferUsageFlags vk_buffer_usage, VmaMemoryUsage vma_memory_usage, VmaAllocationCreateFlags vma_allocation_create_flags, float priority=1.0f)
BMesh const char void * data