feat(render): add ECS-based test render pipeline

Introduce TestRenderPipeline and settings, replacing MeshRenderPass.
The new pipeline manages per-frame instance, view, and global data buffers,
and uploads them for each render request. Refactor GraphicsTestWindow to use
ECS World, setting up camera and mesh entities. Remove MeshRenderPass and
related demo code. Add TotalRecordCount to RenderList, new data structs for
buffer uploads, and static masks to RenderingLayerMask. Update project
references and InternalsVisibleTo for Ghost.Graphics.Test access.
This commit is contained in:
2026-03-24 20:14:26 +09:00
parent 92e3d33361
commit 7860e5e341
9 changed files with 308 additions and 354 deletions

View File

@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Ghost.Engine")]
[assembly: InternalsVisibleTo("Ghost.Editor.Core")]
[assembly: InternalsVisibleTo("Ghost.Entities.Test")]
[assembly: InternalsVisibleTo("Ghost.Graphics.Test")]
[assembly: EngineAssembly]

View File

@@ -41,15 +41,29 @@ public static class RootSignatureLayout
public const int ROOT_PARAMETER_COUNT = 1;
}
[StructLayout(LayoutKind.Sequential, Size = 16)]
[StructLayout(LayoutKind.Sequential, Size = 20)]
public struct PushConstantsData
{
public uint globalIndex;
public uint viewIndex;
public uint instanceIndex;
public uint objectIndex;
public uint materialIndex;
}
[StructLayout(LayoutKind.Sequential, Size = 8)]
public struct GlobalFrameData
{
public uint viewBufferIndex;
public uint instanceBufferIndex;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct InstanceData
{
public float4x4 localToWorld;
}
// The size should be 176 bytes (16-byte aligned)
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PerViewData

View File

@@ -63,6 +63,19 @@ public struct RenderList : IDisposable
private UnsafeArray<UnsafeList<RenderRecord>> _threadLocalRecords;
public readonly int ThreadLocalCount => _threadLocalRecords.Length;
public readonly int TotalRecordCount
{
get
{
var count = 0;
for (var i = 0; i < _threadLocalRecords.Length; i++)
{
count += _threadLocalRecords[i].Count;
}
return count;
}
}
public readonly bool IsCreated => _threadLocalRecords.IsCreated;
public RenderList(int maxLevelOfConcurrency, int capacity, AllocationHandle allocationHandle)

View File

@@ -160,8 +160,11 @@ public readonly unsafe ref struct RenderingContext
public void UploadMeshlets(Handle<Mesh> mesh)
{
var r = _resourceManager.GetMeshReference(mesh);
if (r.IsFailure) return;
if (r.IsFailure)
{
return;
}
ref var meshRef = ref r.Value;
ref readonly var meshletData = ref meshRef.MeshletData;

View File

@@ -28,6 +28,9 @@ public readonly struct RenderingLayerMask : IEquatable<RenderingLayerMask>
private readonly uint _value;
public static readonly RenderingLayerMask Empty = new(0);
public static readonly RenderingLayerMask All = new(uint.MaxValue);
public RenderingLayerMask(uint value)
{
_value = value;