Major architecture upgrade: - Add native render pass merging (hardware pass grouping, load/store op inference) - Implement heap-based aliasing for textures & buffers (D3D12-style) - Unify resource model: buffers and textures in one registry - Extend builder API for buffer creation/usage, access flags, hints - Improve barrier/state tracking (buffer hints, indirect argument state) - Update caching, hashing, and debug output for new model - Add enums/structs: AttachmentLoadOp, StoreOp, BufferHint, etc. - D3D12 backend: support named resources, temp upload buffers, correct heap usage - Update docs, benchmarks, and project files for new features Brings render graph closer to AAA engine standards, enabling efficient memory usage, lower driver overhead, and a more flexible API.
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using Ghost.RenderGraph.Concept;
|
|
using Ghost.RenderGraph.Concept.Benchmark;
|
|
|
|
#if !DEBUG
|
|
|
|
BenchmarkDotNet.Running.BenchmarkRunner.Run<RenderGraphBenchmark>();
|
|
return;
|
|
|
|
var renderGraph = new RenderGraph();
|
|
const int _ITERATION = 500000;
|
|
for (var i = 0; i < _ITERATION; i++)
|
|
{
|
|
RenderGraphBenchmark.ExecuteGraph(renderGraph);
|
|
renderGraph.Reset();
|
|
}
|
|
|
|
GC.Collect();
|
|
GC.WaitForPendingFinalizers();
|
|
Thread.Sleep(1000); // Leave a gap in visual studio allocations timeline
|
|
var sw = new System.Diagnostics.Stopwatch();
|
|
var gcBefore = GC.GetAllocatedBytesForCurrentThread();
|
|
sw.Start();
|
|
|
|
for (var i = 0; i < _ITERATION; i++)
|
|
{
|
|
RenderGraphBenchmark.ExecuteGraph(renderGraph);
|
|
renderGraph.Reset();
|
|
}
|
|
|
|
sw.Stop();
|
|
var gcAfter = GC.GetAllocatedBytesForCurrentThread();
|
|
|
|
Console.WriteLine($"{sw.Elapsed.TotalNanoseconds / _ITERATION} ns (per iteration)");
|
|
Console.WriteLine($"GC Allocated Bytes: {(gcAfter - gcBefore) / _ITERATION} bytes (per iteration)");
|
|
#else
|
|
var renderGraph = new RenderGraph();
|
|
|
|
// Run twice to demonstrate cache hit
|
|
Console.WriteLine("=== FRAME 1 (Cache Miss Expected) ===");
|
|
RenderGraphBenchmark.ExecuteGraph(renderGraph);
|
|
|
|
//Thread.Sleep(5000);
|
|
|
|
//renderGraph.Reset();
|
|
//Console.WriteLine("\n\n=== FRAME 2 (Cache Hit Expected) ===");
|
|
//RenderGraphBenchmark.ExecuteGraph(renderGraph);
|
|
#endif
|