| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include "VideoBackends/D3D12/Common.h" |
| 8 |
#include "VideoBackends/D3D12/D3D12StreamBuffer.h" |
| 9 |
#include "VideoBackends/D3D12/DescriptorHeapManager.h" |
| 10 |
|
| 11 |
#include "VideoCommon/BoundingBox.h" |
| 12 |
|
| 13 |
namespace DX12 |
| 14 |
{ |
| 15 |
class D3D12BoundingBox final : public BoundingBox |
| 16 |
{ |
| 17 |
public: |
| 18 |
~D3D12BoundingBox() override; |
| 19 |
|
| 20 |
bool Initialize() override; |
| 21 |
|
| 22 |
protected: |
| 23 |
std::vector<BBoxType> Read(u32 index, u32 length) override; |
| 24 |
void Write(u32 index, std::span<const BBoxType> values) override; |
| 25 |
|
| 26 |
private: |
| 27 |
static constexpr u32 BUFFER_SIZE = sizeof(BBoxType) * NUM_BBOX_VALUES; |
| 28 |
static constexpr u32 MAX_UPDATES_PER_FRAME = 128; |
| 29 |
static constexpr u32 STREAM_BUFFER_SIZE = BUFFER_SIZE * MAX_UPDATES_PER_FRAME; |
| 30 |
|
| 31 |
bool CreateBuffers(); |
| 32 |
|
| 33 |
|
| 34 |
ComPtr<ID3D12Resource> m_gpu_buffer; |
| 35 |
ComPtr<ID3D12Resource> m_readback_buffer; |
| 36 |
StreamBuffer m_upload_buffer; |
| 37 |
DescriptorHandle m_gpu_descriptor{}; |
| 38 |
}; |
| 39 |
|
| 40 |
} |