forked from Misaki/GhostEngine
Refactor error handling and improve type safety
Refactored error handling across the codebase by replacing exceptions with `Result`-based error handling for better robustness and consistency. - Updated `ResultExtensions` to use `EqualityComparer` for comparisons. - Enhanced `RenderingContext` with `GetValueOrThrow` for resource validation and added type constraints for texture methods. - Introduced `CommandError` and `RecordError` in `D3D12CommandBuffer` for improved error tracking. - Refactored `D3D12ResourceDatabase` to use `Result` objects for resource queries. - Updated `ICommandBuffer` and `IResourceDatabase` interfaces to return `Result` objects. - Improved type safety by replacing `int` with `uint` where appropriate. - Simplified texture handling in `MeshRenderPass` with new `CreateTexture` logic. - Cleaned up project files by removing unused and redundant entries. These changes enhance code maintainability, improve error reporting, and ensure type safety throughout the project.
This commit is contained in:
@@ -263,8 +263,8 @@ public struct RectDesc
|
||||
public struct SubResourceData
|
||||
{
|
||||
public unsafe void* pData;
|
||||
public nint rowPitch;
|
||||
public nint slicePitch;
|
||||
public uint rowPitch;
|
||||
public uint slicePitch;
|
||||
}
|
||||
|
||||
public struct PassRenderTargetDesc
|
||||
@@ -303,7 +303,7 @@ public struct PassDepthStencilDesc
|
||||
|
||||
public struct BarrierDesc
|
||||
{
|
||||
public Handle<GraphicsBuffer> Resource
|
||||
public Handle<GPUResource> Resource
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
@@ -681,6 +681,24 @@ public struct BufferDesc
|
||||
}
|
||||
}
|
||||
|
||||
public struct CommandError
|
||||
{
|
||||
public int CommandIndex
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string CommandName
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public ResultStatus Status
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swap chain description
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user