Improve the usability of Result<T, E> and add new job schedule method to EntityQuery.

Added implicate conversion to Result<T, E> and RefResult<T, E>;
Added new ScheduleChunkParallel in EntityQuery;
Remove Ghost.SparseEntity from solution file. It's now completlty replaced by Ghost.Entities;
This commit is contained in:
2025-12-09 21:43:12 +09:00
parent 97d1118caa
commit 99c1a1980e
29 changed files with 646 additions and 553 deletions

View File

@@ -49,7 +49,7 @@ public readonly unsafe ref struct RenderingContext
CommandBufferType.Graphics => _engine.Device.GraphicsQueue,
CommandBufferType.Compute => _engine.Device.ComputeQueue,
CommandBufferType.Copy => _engine.Device.CopyQueue,
_ => throw new ArgumentOutOfRangeException(),
_ => throw new InvalidOperationException("Unknown command buffer type."),
};
queue.Submit(commandBuffer);
@@ -123,8 +123,8 @@ public readonly unsafe ref struct RenderingContext
localToWorld = localToWorld,
worldBoundsMin = meshData.BoundingBox.Min,
worldBoundsMax = meshData.BoundingBox.Max,
vertexBuffer = _engine.ResourceDatabase.GetBindlessIndex(meshData.VertexBuffer.AsResource()).GetValueOrThrow(ResultStatus.Success),
indexBuffer = _engine.ResourceDatabase.GetBindlessIndex(meshData.IndexBuffer.AsResource()).GetValueOrThrow(ResultStatus.Success),
vertexBuffer = _engine.ResourceDatabase.GetBindlessIndex(meshData.VertexBuffer.AsResource()).GetValueOrThrow(),
indexBuffer = _engine.ResourceDatabase.GetBindlessIndex(meshData.IndexBuffer.AsResource()).GetValueOrThrow(),
};
var bufferHandle = meshData.ObjectDataBuffer.AsResource();
@@ -147,7 +147,7 @@ public readonly unsafe ref struct RenderingContext
where T : unmanaged
{
var desc = ResourceDatabase.GetResourceDescription(texture.AsResource())
.GetValueOrThrow(ResultStatus.Success);
.GetValueOrThrow();
if (data.Length * sizeof(T) != desc.TextureDescription.GetTotalBytes())
{
@@ -180,7 +180,7 @@ public readonly unsafe ref struct RenderingContext
var shader = ResourceDatabase.GetShaderReference(materialRef.Shader);
var keyResult = shader.TryGetPassKey(passName, out var passIndex);
if (keyResult.Status != ResultStatus.Success)
if (keyResult.Error != ErrorStatus.None)
{
throw new Exception(keyResult.ToString());
}
@@ -208,4 +208,4 @@ public readonly unsafe ref struct RenderingContext
var threadGroupCountX = ((uint)meshRef.IndexCount + numThreadsX - 1) / numThreadsX;
_directCmd.DispatchMesh(threadGroupCountX, 1, 1);
}
}
}