Add GetDescriptorHandleIncrementSize to D3D12Device and update main.cpp to use wrapper
This commit is contained in:
@@ -27,6 +27,8 @@ public:
|
||||
uint64_t GetSize() const { return GetDesc().Width; }
|
||||
D3D12_GPU_VIRTUAL_ADDRESS GetGPUVirtualAddress() const { return m_resource->GetGPUVirtualAddress(); }
|
||||
|
||||
void UpdateData(const void* data, uint64_t size);
|
||||
|
||||
private:
|
||||
ComPtr<ID3D12Resource> m_resource;
|
||||
};
|
||||
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
|
||||
std::vector<AdapterInfo> EnumerateAdapters();
|
||||
|
||||
UINT GetDescriptorHandleIncrementSize(DescriptorHeapType type) const;
|
||||
|
||||
bool CheckFeatureSupport(D3D12_FEATURE feature, void* featureSupportData, uint32_t featureSupportDataSize);
|
||||
|
||||
void SetDeviceRemoved() { m_isDeviceRemoved = true; }
|
||||
|
||||
@@ -147,5 +147,13 @@ void D3D12Buffer::Shutdown() {
|
||||
m_resource.Reset();
|
||||
}
|
||||
|
||||
void D3D12Buffer::UpdateData(const void* data, uint64_t size) {
|
||||
D3D12_RANGE range = { 0, static_cast<SIZE_T>(size) };
|
||||
unsigned char* pBuffer = nullptr;
|
||||
m_resource->Map(0, &range, reinterpret_cast<void**>(&pBuffer));
|
||||
memcpy(pBuffer, data, static_cast<size_t>(size));
|
||||
m_resource->Unmap(0, nullptr);
|
||||
}
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
|
||||
@@ -165,5 +165,9 @@ std::vector<AdapterInfo> D3D12Device::EnumerateAdapters() {
|
||||
return adapters;
|
||||
}
|
||||
|
||||
UINT D3D12Device::GetDescriptorHandleIncrementSize(DescriptorHeapType type) const {
|
||||
return m_device->GetDescriptorHandleIncrementSize(ToD3D12(type));
|
||||
}
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
|
||||
Reference in New Issue
Block a user