RHI: Add DescriptorSet abstraction for D3D12 and OpenGL backends
- Add RHIDescriptorSet base class with Update/UpdateSampler/GetNativeHandle - Add RHIDescriptorPool with AllocateSet/FreeSet methods - Add SetGraphicsDescriptorSets/SetComputeDescriptorSets to RHICommandList - Implement D3D12DescriptorSet using descriptor heap allocation - Implement OpenGLDescriptorSet using TextureUnitAllocator - Add CreateDescriptorPool/CreateDescriptorSet factory methods to RHIDevice - Fix unit test SetVertexBuffer -> SetVertexBuffers API - Add SetVertexBuffer convenience method for D3D12 backward compatibility - Update CMakeLists.txt with new source files
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "XCEngine/RHI/D3D12/D3D12CommandAllocator.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12Fence.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12DescriptorHeap.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12DescriptorSet.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12QueryHeap.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12RootSignature.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12PipelineLayout.h"
|
||||
@@ -324,6 +325,24 @@ RHISampler* D3D12Device::CreateSampler(const SamplerDesc& desc) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RHIDescriptorPool* D3D12Device::CreateDescriptorPool(const DescriptorPoolDesc& desc) {
|
||||
auto* pool = new D3D12DescriptorHeap();
|
||||
DescriptorPoolDesc poolDesc = desc;
|
||||
poolDesc.device = m_device.Get();
|
||||
if (pool->Initialize(poolDesc)) {
|
||||
return pool;
|
||||
}
|
||||
delete pool;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RHIDescriptorSet* D3D12Device::CreateDescriptorSet(RHIDescriptorPool* pool, const DescriptorSetLayoutDesc& layout) {
|
||||
if (pool == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return pool->AllocateSet(layout);
|
||||
}
|
||||
|
||||
RHIFence* D3D12Device::CreateFence(const FenceDesc& desc) {
|
||||
auto* fence = new D3D12Fence();
|
||||
if (fence->Initialize(m_device.Get(), desc.initialValue)) {
|
||||
|
||||
Reference in New Issue
Block a user