Use existing metal layer if present on NSWindow
If we create and assign a new metal layer to NSWindow, when another one was already assigned, the window content stays black.
This commit is contained in:
parent
7669f8442c
commit
dd4edb23ed
@ -2868,9 +2868,17 @@ namespace bgfx { namespace mtl
|
||||
else
|
||||
{
|
||||
NSWindow* nsWindow = (NSWindow*)_nwh;
|
||||
[nsWindow.contentView setWantsLayer:YES];
|
||||
m_metalLayer = [CAMetalLayer layer];
|
||||
[nsWindow.contentView setLayer:m_metalLayer];
|
||||
CALayer* layer = nsWindow.contentView.layer;
|
||||
if(NULL != layer && [layer isKindOfClass:NSClassFromString(@"CAMetalLayer")])
|
||||
{
|
||||
m_metalLayer = (CAMetalLayer*)layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
[nsWindow.contentView setWantsLayer:YES];
|
||||
m_metalLayer = [CAMetalLayer layer];
|
||||
[nsWindow.contentView setLayer:m_metalLayer];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BX_PLATFORM_*
|
||||
|
Loading…
Reference in New Issue
Block a user