Step 3
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m40s
CI / Windows Release Package (push) Successful in 2m46s

This commit is contained in:
Aiden
2026-05-11 17:41:59 +10:00
parent 0ec5a4cfed
commit 20476bdf63
10 changed files with 460 additions and 53 deletions

View File

@@ -60,14 +60,72 @@ void TestRenderResetScopesCoalesceToStrongestRequest()
Expect(queue.GetMetrics().depth == 0, "none reset request is ignored");
}
void TestInputUploadRequestUsesLatestValue()
{
int firstPixel = 1;
int secondPixel = 2;
RenderCommandQueue queue;
RenderInputUploadRequest firstRequest;
firstRequest.inputFrame.bytes = &firstPixel;
firstRequest.inputFrame.width = 1920;
firstRequest.videoState.captureTextureWidth = 1920;
queue.RequestInputUpload(firstRequest);
RenderInputUploadRequest secondRequest;
secondRequest.inputFrame.bytes = &secondPixel;
secondRequest.inputFrame.width = 1280;
secondRequest.videoState.captureTextureWidth = 1280;
queue.RequestInputUpload(secondRequest);
const RenderCommandQueueMetrics metrics = queue.GetMetrics();
Expect(metrics.depth == 1, "input upload requests coalesce to one pending command");
Expect(metrics.enqueuedCount == 1, "first input upload request is counted as enqueued");
Expect(metrics.coalescedCount == 1, "second input upload request is counted as coalesced");
RenderInputUploadRequest request;
Expect(queue.TryTakeInputUpload(request), "input upload request can be consumed");
Expect(request.inputFrame.bytes == &secondPixel, "latest input upload bytes pointer wins");
Expect(request.inputFrame.width == 1280, "latest input upload frame wins");
Expect(request.videoState.captureTextureWidth == 1280, "latest input upload state wins");
Expect(!queue.TryTakeInputUpload(request), "input upload request is removed after consume");
}
void TestOutputFrameRequestsAreFifo()
{
RenderCommandQueue queue;
RenderOutputFrameRequest firstRequest;
firstRequest.videoState.outputFrameSize.width = 1920;
firstRequest.completion.result = VideoIOCompletionResult::Completed;
queue.RequestOutputFrame(firstRequest);
RenderOutputFrameRequest secondRequest;
secondRequest.videoState.outputFrameSize.width = 1280;
secondRequest.completion.result = VideoIOCompletionResult::Dropped;
queue.RequestOutputFrame(secondRequest);
Expect(queue.GetMetrics().depth == 2, "output frame requests are queued independently");
RenderOutputFrameRequest request;
Expect(queue.TryTakeOutputFrame(request), "first output request can be consumed");
Expect(request.videoState.outputFrameSize.width == 1920, "first output request is consumed first");
Expect(request.completion.result == VideoIOCompletionResult::Completed, "first output completion is preserved");
Expect(queue.TryTakeOutputFrame(request), "second output request can be consumed");
Expect(request.videoState.outputFrameSize.width == 1280, "second output request is consumed second");
Expect(request.completion.result == VideoIOCompletionResult::Dropped, "second output completion is preserved");
Expect(!queue.TryTakeOutputFrame(request), "output queue is empty after consuming all requests");
}
void TestIndependentCommandKindsShareDepth()
{
RenderCommandQueue queue;
queue.RequestPreviewPresent({ 1, 2 });
queue.RequestScreenshotCapture({ 3, 4 });
queue.RequestInputUpload({});
queue.RequestOutputFrame({});
queue.RequestRenderReset(RenderCommandResetScope::TemporalHistoryOnly);
Expect(queue.GetMetrics().depth == 3, "independent command kinds each contribute to depth");
Expect(queue.GetMetrics().depth == 5, "independent command kinds each contribute to depth");
}
}
@@ -76,6 +134,8 @@ int main()
TestPreviewRequestUsesLatestValue();
TestScreenshotRequestUsesLatestValue();
TestRenderResetScopesCoalesceToStrongestRequest();
TestInputUploadRequestUsesLatestValue();
TestOutputFrameRequestsAreFifo();
TestIndependentCommandKindsShareDepth();
if (gFailures != 0)