dolphin/Source/Core/VideoBackends/D3D12/D3D12BoundingBox.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
C
Raw Permalink Normal View History

2019-03-28 10:35:46 +00:00
// Copyright 2019 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2019-03-28 10:35:46 +00:00
#pragma once
2019-03-28 10:35:46 +00:00
#include <memory>
#include "VideoBackends/D3D12/Common.h"
#include "VideoBackends/D3D12/D3D12StreamBuffer.h"
2019-03-28 10:35:46 +00:00
#include "VideoBackends/D3D12/DescriptorHeapManager.h"
#include "VideoCommon/BoundingBox.h"
2019-03-28 10:35:46 +00:00
namespace DX12
{
class D3D12BoundingBox final : public BoundingBox
2019-03-28 10:35:46 +00:00
{
public:
~D3D12BoundingBox() override;
2019-03-28 10:35:46 +00:00
bool Initialize() override;
2019-03-28 10:35:46 +00:00
protected:
std::vector<BBoxType> Read(u32 index, u32 length) override;
void Write(u32 index, std::span<const BBoxType> values) override;
2019-03-28 10:35:46 +00:00
private:
static constexpr u32 BUFFER_SIZE = sizeof(BBoxType) * NUM_BBOX_VALUES;
static constexpr u32 MAX_UPDATES_PER_FRAME = 128;
static constexpr u32 STREAM_BUFFER_SIZE = BUFFER_SIZE * MAX_UPDATES_PER_FRAME;
2019-03-28 10:35:46 +00:00
bool CreateBuffers();
// Three buffers: GPU for read/write, CPU for reading back, and CPU for staging changes.
ComPtr<ID3D12Resource> m_gpu_buffer;
ComPtr<ID3D12Resource> m_readback_buffer;
StreamBuffer m_upload_buffer;
DescriptorHandle m_gpu_descriptor{};
2019-03-28 10:35:46 +00:00
};
} // namespace DX12