2016-08-13 12:57:50 +00:00
|
|
|
// Copyright 2016 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2016-08-13 12:57:50 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-10-01 03:07:50 +00:00
|
|
|
#include <array>
|
2016-08-13 12:57:50 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
2023-01-28 02:12:28 +00:00
|
|
|
#include "VideoBackends/Vulkan/StagingBuffer.h"
|
2016-08-13 12:57:50 +00:00
|
|
|
#include "VideoBackends/Vulkan/VulkanLoader.h"
|
|
|
|
|
2021-06-09 11:42:21 +00:00
|
|
|
#include "VideoCommon/BoundingBox.h"
|
|
|
|
|
2016-08-13 12:57:50 +00:00
|
|
|
namespace Vulkan
|
|
|
|
{
|
|
|
|
class StagingBuffer;
|
|
|
|
|
2021-06-09 11:42:21 +00:00
|
|
|
class VKBoundingBox final : public BoundingBox
|
2016-08-13 12:57:50 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-06-09 11:42:21 +00:00
|
|
|
~VKBoundingBox() override;
|
2016-08-13 12:57:50 +00:00
|
|
|
|
2021-06-09 11:42:21 +00:00
|
|
|
bool Initialize() override;
|
2016-08-13 12:57:50 +00:00
|
|
|
|
2021-06-09 11:42:21 +00:00
|
|
|
protected:
|
|
|
|
std::vector<BBoxType> Read(u32 index, u32 length) override;
|
|
|
|
void Write(u32 index, const std::vector<BBoxType>& values) override;
|
2016-08-13 12:57:50 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool CreateGPUBuffer();
|
|
|
|
bool CreateReadbackBuffer();
|
|
|
|
|
|
|
|
VkBuffer m_gpu_buffer = VK_NULL_HANDLE;
|
2022-10-07 21:42:30 +00:00
|
|
|
VmaAllocation m_gpu_allocation = VK_NULL_HANDLE;
|
2016-08-13 12:57:50 +00:00
|
|
|
|
2021-06-09 11:42:21 +00:00
|
|
|
static constexpr size_t BUFFER_SIZE = sizeof(BBoxType) * NUM_BBOX_VALUES;
|
2016-08-13 12:57:50 +00:00
|
|
|
|
|
|
|
std::unique_ptr<StagingBuffer> m_readback_buffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Vulkan
|