[mtl surface] don't re-acquire drawable if there's already a valid one acquired

This commit is contained in:
Martin Fouilleul 2023-03-15 18:51:50 +01:00
parent bd8e31c535
commit f14f397c99
1 changed files with 11 additions and 6 deletions

View File

@ -64,14 +64,19 @@ void mg_mtl_surface_acquire_drawable_and_command_buffer(mg_mtl_surface* surface)
*/
//NOTE: returned drawable could be nil if we stall for more than 1s, although that never seem to happen in practice?
if(surface->drawable == nil)
{
surface->drawable = [surface->mtlLayer nextDrawable];
if(surface->drawable)
{
[surface->drawable retain];
}
}
if(surface->commandBuffer == nil)
{
surface->commandBuffer = [surface->commandQueue commandBuffer];
[surface->commandBuffer retain];
}
}}
void mg_mtl_surface_prepare(mg_surface_data* interface)