forked from Misaki/GhostEngine
Refactor descriptor handling and shader compilation
Refactored descriptor allocation and release logic by introducing `IDescriptorAllocator` and replacing `DescriptorHeapAllocator` with `D3D12DescriptorHeap`. Updated descriptor structs to include validation properties and improved memory management with `ReadOnlySpan`. Enhanced shader compilation by introducing `ShaderStage` and `CompilerVersion` enums, enabling more flexible and maintainable shader handling. Refactored `Mesh` to use `IBuffer` for vertex and index buffers, added bindless descriptor support, and improved resource cleanup. Updated `RenderSystem` and other components for better initialization, error handling, and disposal logic. General improvements to code readability and maintainability.
This commit is contained in:
@@ -9,16 +9,16 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
#endif
|
||||
|
||||
private readonly D3D12RenderDevice _device;
|
||||
private readonly D3D12PipelineStateController _stateController;
|
||||
private readonly D3D12DescriptorAllocator _descriptorAllocator;
|
||||
private readonly D3D12ResourceAllocator _resourceAllocator;
|
||||
|
||||
private readonly D3D12PipelineStateController _pipelineState;
|
||||
private readonly D3D12DescriptorAllocator _descriptorAllocator;
|
||||
private readonly D3D12PipelineStateController _stateController;
|
||||
|
||||
public IRenderDevice Device => _device;
|
||||
public IPipelineStateController PipelineStateController => _stateController;
|
||||
public IResourceAllocator ResourceAllocator => _resourceAllocator;
|
||||
|
||||
public IPipelineStateController PipelineStateController => _stateController;
|
||||
|
||||
public D3D12GraphicsEngine(RenderSystem renderSystem)
|
||||
{
|
||||
#if DEBUG
|
||||
@@ -26,11 +26,10 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
#endif
|
||||
|
||||
_device = new();
|
||||
_stateController = new(_device);
|
||||
_resourceAllocator = new(_device, renderSystem);
|
||||
|
||||
_pipelineState = new(_device);
|
||||
_descriptorAllocator = new(_device);
|
||||
_resourceAllocator = new(renderSystem, _device, _descriptorAllocator);
|
||||
|
||||
_stateController = new(_device);
|
||||
}
|
||||
|
||||
public IRenderer CreateRenderer()
|
||||
@@ -50,6 +49,7 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_stateController.Dispose();
|
||||
_descriptorAllocator.Dispose();
|
||||
_resourceAllocator.Dispose();
|
||||
_device.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user