Files
GhostEngine/Ghost.Graphics/GPUResourceLeakException.cs
Misaki 0720444c2c Refactor and enhance resource management and rendering
Updated multiple components to improve encapsulation, maintainability, and performance. Key changes include:

- Upgraded package dependencies in project files.
- Refactored `Mesh` and `RenderingContext` to use properties and added support for per-object constant buffers.
- Improved resource management in `D3D12CommandBuffer`, `D3D12CommandQueue`, and `D3D12ResourceAllocator` with better encapsulation and disposal handling.
- Added validation for constant buffer sizes in `D3D12PipelineLibrary`.
- Simplified `MeshBuilder` methods to accept allocators and removed hardcoded values.
- Enhanced debugging with `GPUResourceLeakException` and resource tracking updates.
- Updated shaders and rendering logic for testing, including hardcoded triangle rendering.
- Removed redundant base classes and interfaces for cleaner code structure.
2025-11-26 01:48:24 +09:00

19 lines
805 B
C#

using Misaki.HighPerformance.LowLevel;
namespace Ghost.Graphics;
internal unsafe class GPUResourceLeakException : Exception
{
public GPUResourceLeakException(uint refCount, void* address, string name)
: base($"GPU resource leak detected! Resource '{name}' at address {(UIntPtr)address} has a reference count of {refCount} when it should be 0. This indicates that the resource was not properly released before being destroyed, which can lead to memory leaks and other issues. Please ensure that all references to this resource are released appropriately.")
{
}
public static void ThrowIfRefCountNonZero(uint refCount, void* address, string name)
{
if (refCount != 0)
{
throw new GPUResourceLeakException(refCount, address, name);
}
}
}