forked from Misaki/GhostEngine
- Added new C# formatting rules in .editorconfig. - Introduced `IKeyType`, `Key<T>`, and `Ptr<T>` structs. - Updated `Result` and `Result<T>` for implicit conversions. - Added AOT compatibility to project files. - Introduced a `Camera` class and refactored namespaces. - Enhanced rendering with bindless support and pipeline state management. - Refactored `D3D12CommandBuffer` for new rendering features. - Improved `D3D12PipelineLibrary` with disk caching methods. - Added support for UAVs and raw buffers in `D3D12ResourceAllocator`. - Improved shader compilation and reflection in `D3D12ShaderCompiler`. - Refactored descriptor heap and swap chain initialization. - Added enums and structs for rendering configurations. - Expanded `ICommandBuffer` and `IPipelineLibrary` interfaces. - Updated `MeshRenderPass` to align with the new pipeline. - Consolidated namespaces and improved code maintainability.
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using TerraFX.Interop.DirectX;
|
|
using TerraFX.Interop.Windows;
|
|
|
|
using static TerraFX.Aliases.DXGI_Alias;
|
|
|
|
namespace Ghost.Graphics.D3D12;
|
|
|
|
internal unsafe class D3D12DebugLayer
|
|
{
|
|
private readonly ComPtr<ID3D12Debug6> _d3d12Debug;
|
|
private readonly ComPtr<IDXGIDebug1> _dxgiDebug;
|
|
private readonly ComPtr<IDXGIInfoQueue> _dxgiInfoQueue;
|
|
|
|
public D3D12DebugLayer()
|
|
{
|
|
ID3D12Debug6* pDebug = default;
|
|
ThrowIfFailed(D3D12GetDebugInterface(__uuidof(pDebug), (void**)&pDebug));
|
|
pDebug->EnableDebugLayer();
|
|
|
|
IDXGIDebug1* pDxgiDebug = default;
|
|
ThrowIfFailed(DXGIGetDebugInterface1(0u, __uuidof(pDxgiDebug), (void**)&pDxgiDebug));
|
|
pDxgiDebug->EnableLeakTrackingForThread();
|
|
|
|
IDXGIInfoQueue* pDxgiInfoQueue = default;
|
|
ThrowIfFailed(DXGIGetDebugInterface1(0u, __uuidof(pDxgiInfoQueue), (void**)&pDxgiInfoQueue));
|
|
ThrowIfFailed(pDxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, true));
|
|
ThrowIfFailed(pDxgiInfoQueue->SetBreakOnSeverity(DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, true));
|
|
|
|
_d3d12Debug.Attach(pDebug);
|
|
_dxgiDebug.Attach(pDxgiDebug);
|
|
_dxgiInfoQueue.Attach(pDxgiInfoQueue);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
ThrowIfFailed(_dxgiDebug.Get()->ReportLiveObjects(DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL | DXGI_DEBUG_RLO_IGNORE_INTERNAL));
|
|
|
|
_d3d12Debug.Dispose();
|
|
_dxgiDebug.Dispose();
|
|
_dxgiInfoQueue.Dispose();
|
|
}
|
|
} |