Move D3D12 cpp files to src/RHI/D3D12/ subdirectory

This commit is contained in:
2026-03-15 20:50:06 +08:00
parent 4af4326767
commit dfbd218435
21 changed files with 20 additions and 20 deletions

View File

@@ -0,0 +1,35 @@
#include "XCEngine/RHI/D3D12/D3D12ConstantBufferView.h"
namespace XCEngine {
namespace RHI {
D3D12ConstantBufferView::D3D12ConstantBufferView()
: m_handle({0})
, m_resource(nullptr) {
}
D3D12ConstantBufferView::~D3D12ConstantBufferView() {
Shutdown();
}
void D3D12ConstantBufferView::Initialize(ID3D12Device* device, ID3D12Resource* buffer, const D3D12_CONSTANT_BUFFER_VIEW_DESC* desc) {
m_resource = buffer;
m_handle = {};
if (desc) {
device->CreateConstantBufferView(desc, m_handle);
} else {
D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc = {};
cbvDesc.BufferLocation = buffer->GetGPUVirtualAddress();
cbvDesc.SizeInBytes = static_cast<UINT>(buffer->GetDesc().Width);
device->CreateConstantBufferView(&cbvDesc, m_handle);
}
}
void D3D12ConstantBufferView::Shutdown() {
m_handle = {};
m_resource = nullptr;
}
} // namespace RHI
} // namespace XCEngine