@@ -574,12 +574,20 @@ void FRenderer::renderStandaloneView(FView const* view) {
574
574
1'000'000'000.0 / mDisplayInfo .refreshRate ),
575
575
mFrameId );
576
576
577
- renderInternal (view);
577
+ // because we don't have a "present" call, we use flush so the driver can submit
578
+ // the command buffer; we do this before driver.endFrame() to mimic what would
579
+ // happen with Renderer::beginFrame/endFrame.
580
+ renderInternal (view, true );
578
581
579
582
driver.endFrame (mFrameId );
580
583
581
- // This is a workaround for internal bug b/361822355.
582
- // TODO: properly address the bug and remove this workaround.
584
+ // engine.flush() has already been called by renderInternal(), but we need an extra one
585
+ // for endFrame() above. This operation in actually not too heavy, it just kicks the
586
+ // driver thread, which is mostlikely already running.
587
+ engine.flush ();
588
+
589
+ // FIXME: This is a workaround for internal bug b/361822355.
590
+ // properly address the bug and remove this workaround.
583
591
if (engine.getBackend () == Backend::VULKAN) {
584
592
engine.flushAndWait ();
585
593
}
@@ -600,11 +608,11 @@ void FRenderer::render(FView const* view) {
600
608
assert_invariant (mSwapChain );
601
609
602
610
if (UTILS_LIKELY (view && view->getScene () && view->hasCamera ())) {
603
- renderInternal (view);
611
+ renderInternal (view, false );
604
612
}
605
613
}
606
614
607
- void FRenderer::renderInternal (FView const * view) {
615
+ void FRenderer::renderInternal (FView const * view, bool flush ) {
608
616
FEngine& engine = mEngine ;
609
617
610
618
FILAMENT_CHECK_PRECONDITION (!view->hasPostProcessPass () ||
@@ -621,6 +629,10 @@ void FRenderer::renderInternal(FView const* view) {
621
629
// execute the render pass
622
630
renderJob (rootArenaScope, const_cast <FView&>(*view));
623
631
632
+ if (flush) {
633
+ engine.getDriverApi ().flush ();
634
+ }
635
+
624
636
// make sure to flush the command buffer
625
637
engine.flush ();
626
638
0 commit comments