| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <array> |
| 7 |
#include <memory> |
| 8 |
#include <string> |
| 9 |
|
| 10 |
#include "Common/CommonTypes.h" |
| 11 |
#include "VideoBackends/Vulkan/StagingBuffer.h" |
| 12 |
#include "VideoBackends/Vulkan/VulkanLoader.h" |
| 13 |
|
| 14 |
#include "VideoCommon/BoundingBox.h" |
| 15 |
|
| 16 |
namespace Vulkan |
| 17 |
{ |
| 18 |
class StagingBuffer; |
| 19 |
|
| 20 |
class VKBoundingBox final : public BoundingBox |
| 21 |
{ |
| 22 |
public: |
| 23 |
~VKBoundingBox() override; |
| 24 |
|
| 25 |
bool Initialize() override; |
| 26 |
|
| 27 |
protected: |
| 28 |
std::vector<BBoxType> Read(u32 index, u32 length) override; |
| 29 |
void Write(u32 index, std::span<const BBoxType> values) override; |
| 30 |
|
| 31 |
private: |
| 32 |
bool CreateGPUBuffer(); |
| 33 |
bool CreateReadbackBuffer(); |
| 34 |
|
| 35 |
VkBuffer m_gpu_buffer = VK_NULL_HANDLE; |
| 36 |
VmaAllocation m_gpu_allocation = VK_NULL_HANDLE; |
| 37 |
|
| 38 |
static constexpr size_t BUFFER_SIZE = sizeof(BBoxType) * NUM_BBOX_VALUES; |
| 39 |
|
| 40 |
std::unique_ptr<StagingBuffer> m_readback_buffer; |
| 41 |
}; |
| 42 |
|
| 43 |
} |