RavEngine
Loading...
Searching...
No Matches
VkBuffer.hpp
1#pragma once
2#include <RGL/Types.hpp>
3#include <RGL/Buffer.hpp>
4#include <memory>
5#include <span>
6#include <volk.h>
7#include <limits>
8#ifndef NDEBUG
9#include <string>
10#endif
11
12struct VmaAllocation_T;
13
14namespace RGL {
15 struct DeviceVk;
16
17 struct BufferVk : public IBuffer {
18 const std::shared_ptr<DeviceVk> owningDevice;
19 VkBuffer buffer = VK_NULL_HANDLE;
20 VmaAllocation_T* allocation = VK_NULL_HANDLE;
21 const RGL::BufferAccess accessType;
22
23 MutableSpan mappedMemory;
24 size_t stride = 0;
25
26 constexpr static uint32_t unallocated = std::numeric_limits<uint32_t>::max();
27 uint32_t globalDescriptorIndex = unallocated;
28
29 BufferVk(decltype(owningDevice), const BufferConfig&);
30 virtual ~BufferVk();
31
32 void MapMemory() final;
33 void UnmapMemory() final;
34 void UpdateBufferData(untyped_span newData, decltype(BufferConfig::nElements) offset = 0) final;
35 void SetBufferData(untyped_span data, decltype(BufferConfig::nElements) offset = 0) final;
36 decltype(BufferConfig::nElements) getBufferSize() const final;
37
38 void SignalRangeChanged(const Range&) final;
39
40 void* GetMappedDataPtr() final;
41
42 uint32_t GetReadonlyBindlessGPUHandle() const final;
43 uint32_t GetReadwriteBindlessGPUHandle() const final;
44
45#ifndef NDEBUG
46 std::string debugName;
47#endif
48 };
49}
Definition Span.hpp:11
Definition Buffer.hpp:21
Definition VkBuffer.hpp:17
void UpdateBufferData(untyped_span newData, decltype(BufferConfig::nElements) offset=0) final
void SetBufferData(untyped_span data, decltype(BufferConfig::nElements) offset=0) final
void UnmapMemory() final
void MapMemory() final
Definition Buffer.hpp:50
Definition Span.hpp:6
Definition Buffer.hpp:45