| 30 | */ |
| 31 | template <vkb::BindingType bindingType> |
| 32 | class 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 | |
| 60 | using BufferAllocationC = BufferAllocation<vkb::BindingType::C>; |
| 61 | using BufferAllocationCpp = BufferAllocation<vkb::BindingType::Cpp>; |
nothing calls this directly
no outgoing calls
no test coverage detected