File tree Expand file tree Collapse file tree
src/main/java/git/artdeell/artvk Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -594,16 +594,25 @@ public void copyTextureToTexture(
594594 }
595595 }
596596
597+ public int getPreviousFrameIndex (int past ) {
598+ return Math .floorMod (currentSubmitIndex - past , MAX_SUBMITS_IN_FLIGHT );
599+ }
600+
597601 @ Override
598602 public @ NotNull GpuFence createFence () {
599603 return new GpuFence () {
600- // Don't gaf
601- // Maybe TODO: implement fence for previous frame's submit
604+ private boolean completed = false ;
605+ private final long lastFence = frameFences [ getPreviousFrameIndex ( 1 )]. vkFence ();
602606 @ Override
603- public void close () {}
607+ public void close () {
608+ completed = true ;
609+ }
604610
605611 @ Override
606612 public boolean awaitCompletion (long timeoutNS ) {
613+ if (completed ) return true ;
614+ waitForFences (lastFence );
615+ completed = true ;
607616 return true ;
608617 }
609618 };
You can’t perform that action at this time.
0 commit comments