Add CreateDesc helper for DescriptorHeap
This commit is contained in:
@@ -31,6 +31,8 @@ public:
|
|||||||
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandleForHeapStart() const;
|
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandleForHeapStart() const;
|
||||||
D3D12_GPU_DESCRIPTOR_HANDLE GetGPUDescriptorHandleForHeapStart() const;
|
D3D12_GPU_DESCRIPTOR_HANDLE GetGPUDescriptorHandleForHeapStart() const;
|
||||||
|
|
||||||
|
static D3D12_DESCRIPTOR_HEAP_DESC CreateDesc(DescriptorHeapType type, uint32_t numDescriptors, bool shaderVisible = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ComPtr<ID3D12DescriptorHeap> m_descriptorHeap;
|
ComPtr<ID3D12DescriptorHeap> m_descriptorHeap;
|
||||||
DescriptorHeapType m_type;
|
DescriptorHeapType m_type;
|
||||||
|
|||||||
@@ -70,5 +70,14 @@ uint32_t D3D12DescriptorHeap::GetDescriptorCount() const {
|
|||||||
return m_numDescriptors;
|
return m_numDescriptors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
D3D12_DESCRIPTOR_HEAP_DESC D3D12DescriptorHeap::CreateDesc(DescriptorHeapType type, uint32_t numDescriptors, bool shaderVisible) {
|
||||||
|
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
|
||||||
|
desc.Type = ToD3D12(type);
|
||||||
|
desc.NumDescriptors = numDescriptors;
|
||||||
|
desc.Flags = shaderVisible ? D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE : D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
|
||||||
|
desc.NodeMask = 0;
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace RHI
|
} // namespace RHI
|
||||||
} // namespace XCEngine
|
} // namespace XCEngine
|
||||||
|
|||||||
Reference in New Issue
Block a user