[mtl surface] don't re-acquire drawable if there's already a valid one acquired
This commit is contained in:
parent
bd8e31c535
commit
f14f397c99
|
@ -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?
|
//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];
|
surface->drawable = [surface->mtlLayer nextDrawable];
|
||||||
if(surface->drawable)
|
if(surface->drawable)
|
||||||
{
|
{
|
||||||
[surface->drawable retain];
|
[surface->drawable retain];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(surface->commandBuffer == nil)
|
||||||
|
{
|
||||||
surface->commandBuffer = [surface->commandQueue commandBuffer];
|
surface->commandBuffer = [surface->commandQueue commandBuffer];
|
||||||
[surface->commandBuffer retain];
|
[surface->commandBuffer retain];
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
void mg_mtl_surface_prepare(mg_surface_data* interface)
|
void mg_mtl_surface_prepare(mg_surface_data* interface)
|
||||||
|
|
Loading…
Reference in New Issue