Major refactor of graphics infrastructure: - Introduce ICommandAllocator and D3D12CommandAllocator for explicit command buffer management. - Change ICommandBuffer.Begin to require an allocator. - Add IRenderTargetStrategy abstraction with swap chain and texture implementations. - Update IRenderer to use RenderTargetStrategy instead of direct handle. - Add DPI scaling support to swap chains (ScaleX/ScaleY, SetScale). - RenderSystem now supports thread-safe swap chain resize requests. - Remove persistent copy command buffer; use per-frame allocators. - Make Logger public/static and clean up API visibility. - Update .editorconfig and debug layer enablement. These changes improve modularity, DPI-awareness, and future extensibility.
34 lines
925 B
C#
34 lines
925 B
C#
using Ghost.Core.Utilities;
|
|
using Ghost.Graphics.D3D12.Utilities;
|
|
using Ghost.Graphics.RHI;
|
|
using Misaki.HighPerformance.LowLevel;
|
|
using TerraFX.Interop.DirectX;
|
|
|
|
namespace Ghost.Graphics.D3D12;
|
|
|
|
internal unsafe class D3D12CommandAllocator : ICommandAllocator
|
|
{
|
|
private UniquePtr<ID3D12CommandAllocator> _allocator;
|
|
|
|
public SharedPtr<ID3D12CommandAllocator> NativeAllocator => _allocator.Share();
|
|
|
|
public D3D12CommandAllocator(D3D12RenderDevice device, CommandBufferType type)
|
|
{
|
|
ID3D12CommandAllocator* pAllocator = default;
|
|
var commandListType = D3D12Utility.ToCommandListType(type);
|
|
|
|
device.NativeDevice.Get()->CreateCommandAllocator(commandListType, __uuidof(pAllocator), (void**)&pAllocator);
|
|
|
|
_allocator.Attach(pAllocator);
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_allocator.Get()->Reset();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_allocator.Dispose();
|
|
}
|
|
} |