Refactor render graph error handling and resource APIs

- RenderGraph.Compile/Execute now return Error for better failure detection; error handling is propagated throughout compiler and executor.
- Renamed ScheduleReleaseResource to ReleaseResource for clarity; updated all usages.
- ResourceManager now calls ReleaseResource directly on Mesh, Material, and Shader types.
- Camera exposes Actual/Virtual size properties and Render returns Error.
- RenderingContext now uses IResourceManager for mesh/resource ops.
- Replaced custom BinaryWriter with BufferWriter in RenderGraphHasher.
- Improved variable naming, interface signatures, and code formatting.
- Added Error extension for IsSuccess/IsFailure.
- Minor FMOD/native interop and test code cleanups.
- No breaking API changes except for new Error return values on some methods.
This commit is contained in:
2026-02-25 19:08:54 +09:00
parent 30090f84ab
commit 162b71f309
93 changed files with 537 additions and 593 deletions

View File

@@ -0,0 +1,53 @@
using Misaki.HighPerformance.LowLevel.Buffer;
using Misaki.HighPerformance.LowLevel.Collections;
using System.Runtime.CompilerServices;
namespace Ghost.Core.Utilities;
public struct BufferWriter : IDisposable
{
private UnsafeList<byte> _buffer;
private int _position;
public int Position
{
readonly get => _position;
set => _position = value;
}
public BufferWriter(int initialCapacity, AllocationHandle allocationHandle)
{
_buffer = new UnsafeList<byte>(initialCapacity, allocationHandle);
_position = 0;
}
public unsafe void Write<T>(T value)
where T : unmanaged
{
Unsafe.WriteUnaligned(ref _buffer[_position], value);
_position += sizeof(T);
}
public void WriteBytes(ReadOnlySpan<byte> data)
{
data.CopyTo(_buffer.AsSpan().Slice(_position, data.Length));
_position += data.Length;
}
public Span<byte> ReserveSpan(int length)
{
var span = _buffer.AsSpan().Slice(_position, length);
_position += length;
return span;
}
public readonly Span<byte> AsSpan()
{
return _buffer.AsSpan();
}
public void Dispose()
{
_buffer.Dispose();
}
}