Skip to content

Commit 6d2b777

Browse files
committed
fix: metal sync issue
1 parent 7b609ad commit 6d2b777

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

extensions/pl_graphics_metal.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,7 @@
19341934
// Wait until the inflight command buffer has completed its work
19351935
// gptGraphics->tSwapchain.uCurrentImageIndex = gptGraphics->uCurrentFrameIndex;
19361936
plFrameContext* ptFrame = pl__get_frame_resources(ptDevice);
1937+
ptFrame->uCurrentBufferIndex = 0;
19371938
[ptFrame->tFrameBoundaryEvent waitUntilSignaledValue:ptFrame->uNextValue timeoutMS:10000];
19381939

19391940
pl__garbage_collect(ptDevice);
@@ -2017,7 +2018,6 @@
20172018
}
20182019
}
20192020

2020-
ptFrame->uCurrentBufferIndex = 0;
20212021
[ptCommandBuffer->tCmdBuffer encodeSignalEvent:ptFrame->tFrameBoundaryEvent value:++ptFrame->uNextValue];
20222022
[ptCommandBuffer->tCmdBuffer commit];
20232023
gptGraphics->uCurrentFrameIndex = (gptGraphics->uCurrentFrameIndex + 1) % gptGraphics->uFramesInFlight;

extensions/pl_renderer_ext.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,7 +3196,6 @@ pl_renderer_render_view(plView* ptView, plCamera* ptCamera, plCamera* ptCullCame
31963196
.atSignalSempahores = {gptStarter->get_current_timeline_semaphore()},
31973197
.auSignalSemaphoreValues = {gptStarter->increment_current_timeline_value()}
31983198
};
3199-
ptScene->uLastSemValueForShadow = gptStarter->get_current_timeline_value();
32003199
gptGfx->submit_command_buffer(ptSceneCmdBuffer, &tSceneSubmitInfo);
32013200
gptGfx->return_command_buffer(ptSceneCmdBuffer);
32023201

@@ -3427,7 +3426,7 @@ pl_renderer_render_view(plView* ptView, plCamera* ptCamera, plCamera* ptCullCame
34273426
.atSignalSempahores = {gptStarter->get_current_timeline_semaphore()},
34283427
.auSignalSemaphoreValues = {gptStarter->increment_current_timeline_value()}
34293428
};
3430-
3429+
ptScene->uLastSemValueForShadow = gptStarter->get_current_timeline_value();
34313430
gptGfx->submit_command_buffer(ptPostCmdBuffer, &tPostSubmitInfo);
34323431
gptGfx->return_command_buffer(ptPostCmdBuffer);
34333432

0 commit comments

Comments
 (0)