Skip to content

Commit aa2145b

Browse files
committed
WIP
1 parent de0d9a9 commit aa2145b

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

extensions/pl_graphics_metal.m

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@
395395
if(ptDesc->ptSwapchain)
396396
{
397397
uCount = ptDesc->ptSwapchain->uImageCount;
398+
pl_sb_reset(gptGraphics->sbtMainRenderPassHandles);
398399
pl_sb_push(gptGraphics->sbtMainRenderPassHandles, tHandle);
399400
}
400401

@@ -1765,7 +1766,7 @@
17651766

17661767
bool bMSAAChange = ptSwap->tInfo.tSampleCount != ptInit->tSampleCount;
17671768

1768-
gptGraphics->uCurrentFrameIndex = 0;
1769+
// gptGraphics->uCurrentFrameIndex = 0;
17691770
ptSwap->tInfo.bVSync = ptInit->bVSync;
17701771
ptSwap->tInfo.uWidth = ptInit->uWidth;
17711772
ptSwap->tInfo.uHeight = ptInit->uHeight;
@@ -1775,13 +1776,13 @@
17751776

17761777
if(bMSAAChange)
17771778
{
1778-
uint32_t uNextFrameIndex = (gptGraphics->uCurrentFrameIndex + 1) % gptGraphics->uFramesInFlight;
1779-
plFrameContext* ptFrame1 = &ptSwap->ptDevice->sbtFrames[uNextFrameIndex];
1779+
// uint32_t uNextFrameIndex = (gptGraphics->uCurrentFrameIndex + 1) % gptGraphics->uFramesInFlight;
1780+
// plFrameContext* ptFrame1 = &ptSwap->ptDevice->sbtFrames[uNextFrameIndex];
17801781
plFrameContext* ptFrame0 = pl__get_frame_resources(ptSwap->ptDevice);
17811782
// dispatch_semaphore_wait(ptFrame->tFrameBoundarySemaphore, DISPATCH_TIME_FOREVER);
17821783

17831784
dispatch_semaphore_signal(ptFrame0->tFrameBoundarySemaphore);
1784-
dispatch_semaphore_signal(ptFrame1->tFrameBoundarySemaphore);
1785+
// // dispatch_semaphore_signal(ptFrame1->tFrameBoundarySemaphore);
17851786
}
17861787
}
17871788

@@ -1860,6 +1861,7 @@
18601861

18611862
// Wait until the inflight command buffer has completed its work
18621863
// gptGraphics->tSwapchain.uCurrentImageIndex = gptGraphics->uCurrentFrameIndex;
1864+
gptGraphics->uCurrentFrameIndex = (gptGraphics->uCurrentFrameIndex + 1) % gptGraphics->uFramesInFlight;
18631865
plFrameContext* ptFrame = pl__get_frame_resources(ptDevice);
18641866

18651867
dispatch_semaphore_wait(ptFrame->tFrameBoundarySemaphore, DISPATCH_TIME_FOREVER);
@@ -1971,7 +1973,6 @@
19711973

19721974
[ptCommandBuffer->tCmdBuffer commit];
19731975

1974-
gptGraphics->uCurrentFrameIndex = (gptGraphics->uCurrentFrameIndex + 1) % gptGraphics->uFramesInFlight;
19751976
return true;
19761977
}
19771978

@@ -3346,7 +3347,9 @@
33463347
pl_sb_push(ptDevice->sbtSamplerFreeIndices, iResourceIndex);
33473348
}
33483349

3349-
for(uint32_t i = 0; i < pl_sb_size(ptGarbage->sbtTextures); i++)
3350+
3351+
const uint32_t uTextureCount = pl_sb_size(ptGarbage->sbtTextures);
3352+
for(uint32_t i = 0; i < uTextureCount; i++)
33503353
{
33513354
const uint16_t uTextureIndex = ptGarbage->sbtTextures[i].uIndex;
33523355
plMetalTexture* ptMetalTexture = &ptDevice->sbtTexturesHot[uTextureIndex];

extensions/pl_renderer_internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2484,7 +2484,7 @@ pl__renderer_create_probe_data(plScene* ptScene, plEntity tProbeHandle)
24842484
.uMips = 1,
24852485
.tType = PL_TEXTURE_TYPE_CUBE,
24862486
.tUsage = PL_TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT | PL_TEXTURE_USAGE_SAMPLED | PL_TEXTURE_USAGE_INPUT_ATTACHMENT,
2487-
.pcDebugName = "offscreen depth texture"
2487+
.pcDebugName = "offscreen depth texture probe"
24882488
};
24892489

24902490
const plTextureDesc tEmmissiveTexDesc = {

extensions/pl_starter_ext.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ pl_starter_resize(void)
350350
plBlitEncoder* ptEncoder = NULL;
351351
if(gptStarterCtx->tFlags & PL_STARTER_FLAGS_DEPTH_BUFFER || gptStarterCtx->tFlags & PL_STARTER_FLAGS_MSAA)
352352
{
353-
ptCommandBuffer = gptGfx->request_command_buffer(gptStarterCtx->atCmdPools[0]);
353+
ptCommandBuffer = gptGfx->request_command_buffer(gptStarterCtx->atCmdPools[gptGfx->get_current_frame_index()]);
354354
gptGfx->begin_command_recording(ptCommandBuffer, NULL);
355355

356356
// begin blit pass, copy buffer, end pass
@@ -1379,7 +1379,7 @@ pl__starter_create_render_pass_with_depth(void)
13791379
.ptSwapchain = gptStarterCtx->ptSwapchain
13801380
};
13811381

1382-
plCommandBuffer* ptCommandBuffer = gptGfx->request_command_buffer(gptStarterCtx->atCmdPools[0]);
1382+
plCommandBuffer* ptCommandBuffer = gptGfx->request_command_buffer(gptStarterCtx->atCmdPools[gptGfx->get_current_frame_index()]);
13831383
gptGfx->begin_command_recording(ptCommandBuffer, NULL);
13841384

13851385
// begin blit pass, copy buffer, end pass
@@ -1478,7 +1478,7 @@ pl__starter_create_render_pass_with_msaa_and_depth(void)
14781478
.ptSwapchain = gptStarterCtx->ptSwapchain
14791479
};
14801480

1481-
plCommandBuffer* ptCommandBuffer = gptGfx->request_command_buffer(gptStarterCtx->atCmdPools[0]);
1481+
plCommandBuffer* ptCommandBuffer = gptGfx->request_command_buffer(gptStarterCtx->atCmdPools[gptGfx->get_current_frame_index()]);
14821482
gptGfx->begin_command_recording(ptCommandBuffer, NULL);
14831483

14841484
// begin blit pass, copy buffer, end pass

0 commit comments

Comments
 (0)