forked from Misaki/GhostEngine
Refactor shader pipeline and improve modularity
- Added `generatedCodePath` to `FullPassDescriptor` for better shader code organization. - Removed redundant `IID_PPV_ARGS` method and unused `Misaki.HighPerformance.Unsafe` reference. - Refactored `Material` and `MaterialAccessor` to use `CBuffer` and updated buffer size handling. - Renamed command buffer variables in `RenderingContext` for consistency. - Updated `D3D12PipelineLibrary` to cache compiled shader results and added `ShaderPassKey`. - Refactored `D3D12GraphicsEngine` to integrate `_copyCommandBuffer` lifecycle. - Enhanced `D3D12ResourceAllocator` with shader pass creation using constant buffer info. - Simplified `D3D12ShaderCompiler` with `GENERATED_CODE_PATH` support and improved reflection handling. - Introduced `CBufferPropertyInfo` and `CBufferInfo` structs for better encapsulation. - Updated HLSL shaders to use `g_PerMaterialData` and dynamic includes. - Improved error handling in `SDLCompiler` with try-catch blocks and better messages. - Refactored `test.gshader` to use dynamically generated includes. - Fixed typos, improved code readability, and removed unused code.
This commit is contained in:
@@ -12,9 +12,9 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
#endif
|
||||
|
||||
private readonly D3D12RenderDevice _device;
|
||||
private readonly D3D12PipelineLibrary _pipelineLibrary;
|
||||
private readonly D3D12DescriptorAllocator _descriptorAllocator;
|
||||
private readonly D3D12ResourceDatabase _resourceDatabase;
|
||||
private readonly D3D12PipelineLibrary _pipelineLibrary;
|
||||
private readonly D3D12ResourceAllocator _resourceAllocator;
|
||||
private readonly D3D12CommandBuffer _copyCommandBuffer;
|
||||
|
||||
@@ -37,9 +37,9 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
_descriptorAllocator = new(_device);
|
||||
|
||||
_resourceDatabase = new(_descriptorAllocator);
|
||||
_resourceAllocator = new(renderSystem, _device, _descriptorAllocator, _resourceDatabase);
|
||||
|
||||
_pipelineLibrary = new(_device, _resourceDatabase);
|
||||
_resourceAllocator = new(renderSystem, _device, _descriptorAllocator, _resourceDatabase, _pipelineLibrary);
|
||||
|
||||
_copyCommandBuffer = new(
|
||||
_device,
|
||||
_pipelineLibrary,
|
||||
@@ -112,6 +112,8 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
{
|
||||
renderer.ExecutePendingResize();
|
||||
}
|
||||
|
||||
_copyCommandBuffer.Begin();
|
||||
}
|
||||
|
||||
public void RenderFrame()
|
||||
@@ -127,6 +129,8 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
public void EndFrame()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
_copyCommandBuffer.End();
|
||||
_resourceAllocator.ReleaseTempResources();
|
||||
}
|
||||
|
||||
@@ -138,9 +142,9 @@ internal unsafe class D3D12GraphicsEngine : IGraphicsEngine
|
||||
}
|
||||
|
||||
_copyCommandBuffer.Dispose();
|
||||
_pipelineLibrary.Dispose();
|
||||
|
||||
_resourceAllocator.Dispose();
|
||||
_pipelineLibrary.Dispose();
|
||||
_resourceDatabase.Dispose();
|
||||
|
||||
_descriptorAllocator.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user