Overte C++ Documentation
VKBuffer.h
1 //
2 // Created by Bradley Austin Davis on 2016/08/07
3 // Adapted for Vulkan in 2022-2025 by dr Karol Suprynowicz.
4 // Copyright 2013-2018 High Fidelity, Inc.
5 // Copyright 2023-2025 Overte e.V.
6 //
7 // Distributed under the Apache License, Version 2.0.
8 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9 // SPDX-License-Identifier: Apache-2.0
10 //
11 #ifndef hifi_gpu_vk_VKBuffer_h
12 #define hifi_gpu_vk_VKBuffer_h
13 
14 #include "VKForward.h"
15 #include "VKShared.h"
16 
17 namespace gpu { namespace vk {
18 
19 class VKBuffer : public VKObject<gpu::Buffer>, public vks::Allocation {
20 public:
21  static VKBuffer* sync(VKBackend& backend, const gpu::Buffer& buffer);
22  static VkBuffer getBuffer(VKBackend& backend, const gpu::Buffer& buffer);
23  void transfer();
24 
25  ~VKBuffer() override;
26 
27  VkBuffer buffer{ VK_NULL_HANDLE };
28 protected:
29  VKBuffer(VKBackend& backend, const gpu::Buffer& buffer);
30  const Stamp _stamp{ 0 };
31  // Local copy of buffer data. Updates are copied into it before transfer.
32  std::vector<uint8_t> _localData;
33 };
34 
35 } }
36 
37 #endif