timing refactor
This commit is contained in:
@@ -57,32 +57,29 @@ void TestAcquirePublishesAndSchedules()
|
||||
Expect(metrics.scheduledFrames == 1, "scheduled metric is counted");
|
||||
}
|
||||
|
||||
void TestAcquireDropsOldestCompletedUnscheduled()
|
||||
void TestAcquirePreservesCompletedFrames()
|
||||
{
|
||||
SystemFrameExchange exchange(MakeConfig(2));
|
||||
|
||||
SystemFrame first;
|
||||
SystemFrame second;
|
||||
SystemFrame third;
|
||||
Expect(exchange.AcquireForRender(first), "first frame can be acquired");
|
||||
Expect(exchange.AcquireForRender(first), "first preserving frame can be acquired");
|
||||
first.frameIndex = 1;
|
||||
Expect(exchange.PublishCompleted(first), "first frame can be completed");
|
||||
Expect(exchange.AcquireForRender(second), "second frame can be acquired");
|
||||
Expect(exchange.PublishCompleted(first), "first preserving frame can be completed");
|
||||
Expect(exchange.AcquireForRender(second), "second preserving frame can be acquired");
|
||||
second.frameIndex = 2;
|
||||
Expect(exchange.PublishCompleted(second), "second frame can be completed");
|
||||
Expect(exchange.PublishCompleted(second), "second preserving frame can be completed");
|
||||
|
||||
Expect(exchange.AcquireForRender(third), "third acquire drops the oldest completed frame");
|
||||
Expect(third.index == first.index, "oldest completed slot is reused");
|
||||
Expect(!exchange.AcquireForRender(third), "render acquire refuses to drop completed frames");
|
||||
|
||||
SystemFrame scheduled;
|
||||
Expect(exchange.ConsumeCompletedForSchedule(scheduled), "remaining completed frame can be scheduled");
|
||||
Expect(scheduled.index == second.index, "newer completed frame survives drop");
|
||||
Expect(scheduled.frameIndex == 2, "newer frame index survives drop");
|
||||
Expect(exchange.ConsumeCompletedForSchedule(scheduled), "oldest completed frame survives acquire miss");
|
||||
Expect(scheduled.frameIndex == 1, "preserving acquire keeps FIFO output continuity");
|
||||
|
||||
SystemFrameExchangeMetrics metrics = exchange.Metrics();
|
||||
Expect(metrics.completedDrops == 1, "drop metric is counted");
|
||||
Expect(metrics.renderingCount == 1, "reused slot is rendering");
|
||||
Expect(metrics.scheduledCount == 1, "consumed slot is scheduled");
|
||||
Expect(metrics.completedDrops == 0, "preserving acquire does not count completed drops");
|
||||
Expect(metrics.acquireMisses == 1, "preserving acquire miss is counted");
|
||||
}
|
||||
|
||||
void TestScheduledFramesAreNotDropped()
|
||||
@@ -179,7 +176,7 @@ void TestStableCompletedDepthTimesOut()
|
||||
int main()
|
||||
{
|
||||
TestAcquirePublishesAndSchedules();
|
||||
TestAcquireDropsOldestCompletedUnscheduled();
|
||||
TestAcquirePreservesCompletedFrames();
|
||||
TestScheduledFramesAreNotDropped();
|
||||
TestGenerationValidationRejectsStaleFrames();
|
||||
TestPixelFormatAwareSizing();
|
||||
|
||||
Reference in New Issue
Block a user