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

Class BufferAllocation

framework/buffer_pool.h:32–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 */
31template <vkb::BindingType bindingType>
32class BufferAllocation
33{
34 public:
35 using DeviceSizeType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceSize, VkDeviceSize>::type;
36
37 public:
38 BufferAllocation() = default;
39 BufferAllocation(const BufferAllocation &) = default;
40 BufferAllocation(BufferAllocation &&) = default;
41 BufferAllocation &operator=(const BufferAllocation &) = default;
42 BufferAllocation &operator=(BufferAllocation &&) = default;
43
44 BufferAllocation(vkb::core::Buffer<bindingType> &buffer, DeviceSizeType size, DeviceSizeType offset);
45
46 bool empty() const;
47 vkb::core::Buffer<bindingType> &get_buffer();
48 DeviceSizeType get_offset() const;
49 DeviceSizeType get_size() const;
50 void update(const std::vector<uint8_t> &data, uint32_t offset = 0);
51 template <typename T>
52 void update(const T &value, uint32_t offset = 0);
53
54 private:
55 vkb::core::BufferCpp *buffer = nullptr;
56 vk::DeviceSize offset = 0;
57 vk::DeviceSize size = 0;
58};
59
60using BufferAllocationC = BufferAllocation<vkb::BindingType::C>;
61using BufferAllocationCpp = BufferAllocation<vkb::BindingType::Cpp>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected