Refactor asset streaming, error handling, and unit tests

- Add new compile-time constants and update package versions
- Refactor AssetEntry upload logic to return Result and propagate errors
- Enhance error handling in ResourceStreamingProcessor uploads
- Make ResourceStreamingContext a readonly struct
- Implement IDisposable and finalizers for resource cleanup
- Overhaul AssetManagerTest with async tests and improved mocks
- Add mock implementations for graphics interfaces for testing
- Refactor MockingCommandBuffer and MockingResourceDatabase for better simulation
- Update internals visibility for unit testing
This commit is contained in:
2026-05-03 17:05:52 +09:00
parent e7fedfd35a
commit d2bf2f12a2
16 changed files with 346 additions and 40 deletions

View File

@@ -0,0 +1,52 @@
using Ghost.Graphics.RHI;
namespace Ghost.UnitTest.MockingEnvironment;
internal class MockingFence : IFence
{
private readonly AutoResetEvent _fenceEvent;
private ulong _currentValue;
public ulong CompletedValue => _currentValue;
public nint WaitHandle => _fenceEvent.SafeWaitHandle.DangerousGetHandle();
public string Name
{
get; set;
} = "MockingFence";
public MockingFence(ulong initialValue)
{
_fenceEvent = new AutoResetEvent(false);
_currentValue = initialValue;
}
public void Signal(ulong value)
{
if (value > _currentValue)
{
_currentValue = value;
_fenceEvent.Set();
}
}
public void WaitForValue(ulong value)
{
if (value > _currentValue)
{
_fenceEvent.WaitOne();
}
}
public Task WaitForValueAsync(ulong value)
{
return Task.Run(() => { WaitForValue(value); });
}
public void Dispose()
{
_fenceEvent.Dispose();
}
}