mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-20 07:15:38 +00:00
MetalDevice: Defer release of layer drawables
This commit is contained in:
parent
f4fb069216
commit
9e82c18559
|
@ -394,11 +394,12 @@ void MetalDevice::RenderBlankFrame()
|
||||||
|
|
||||||
@autoreleasepool
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
id<MTLDrawable> drawable = [m_layer nextDrawable];
|
id<MTLDrawable> drawable = [[m_layer nextDrawable] retain];
|
||||||
m_layer_pass_desc.colorAttachments[0].texture = [drawable texture];
|
m_layer_pass_desc.colorAttachments[0].texture = [drawable texture];
|
||||||
id<MTLRenderCommandEncoder> encoder = [m_render_cmdbuf renderCommandEncoderWithDescriptor:m_layer_pass_desc];
|
id<MTLRenderCommandEncoder> encoder = [m_render_cmdbuf renderCommandEncoderWithDescriptor:m_layer_pass_desc];
|
||||||
[encoder endEncoding];
|
[encoder endEncoding];
|
||||||
[m_render_cmdbuf presentDrawable:drawable];
|
[m_render_cmdbuf presentDrawable:drawable];
|
||||||
|
DeferRelease(drawable);
|
||||||
SubmitCommandBuffer();
|
SubmitCommandBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2019,7 +2020,7 @@ void MetalDevice::EndPresent()
|
||||||
EndAnyEncoding();
|
EndAnyEncoding();
|
||||||
|
|
||||||
[m_render_cmdbuf presentDrawable:m_layer_drawable];
|
[m_render_cmdbuf presentDrawable:m_layer_drawable];
|
||||||
[m_layer_drawable release];
|
DeferRelease(m_layer_drawable);
|
||||||
m_layer_drawable = nil;
|
m_layer_drawable = nil;
|
||||||
SubmitCommandBuffer();
|
SubmitCommandBuffer();
|
||||||
TrimTexturePool();
|
TrimTexturePool();
|
||||||
|
|
Loading…
Reference in a new issue