34 lines
879 B
C++
34 lines
879 B
C++
#pragma once
|
|
|
|
#include <d3d12.h>
|
|
#include <wrl/client.h>
|
|
|
|
#include "D3D12Enum.h"
|
|
|
|
using Microsoft::WRL::ComPtr;
|
|
|
|
namespace XCEngine {
|
|
namespace RHI {
|
|
|
|
class D3D12Buffer {
|
|
public:
|
|
D3D12Buffer();
|
|
~D3D12Buffer();
|
|
|
|
bool Initialize(ID3D12Device* device, uint64_t size, D3D12_RESOURCE_STATES initialState = D3D12_RESOURCE_STATE_COMMON, D3D12_HEAP_TYPE heapType = D3D12_HEAP_TYPE_DEFAULT);
|
|
bool InitializeFromExisting(ID3D12Resource* resource);
|
|
void Shutdown();
|
|
|
|
ID3D12Resource* GetResource() const { return m_resource.Get(); }
|
|
D3D12_RESOURCE_DESC GetDesc() const { return m_resource->GetDesc(); }
|
|
|
|
uint64_t GetSize() const { return GetDesc().Width; }
|
|
D3D12_GPU_VIRTUAL_ADDRESS GetGPUVirtualAddress() const { return m_resource->GetGPUVirtualAddress(); }
|
|
|
|
private:
|
|
ComPtr<ID3D12Resource> m_resource;
|
|
};
|
|
|
|
} // namespace RHI
|
|
} // namespace XCEngine
|