Support MetalKit view as an option on all platforms
This commit is contained in:
Родитель
449b5b60f0
Коммит
4771d14bc7
|
@ -98,6 +98,7 @@ function bgfxProject(_name, _kind, _defines)
|
|||
"-framework QuartzCore",
|
||||
"-framework OpenGL",
|
||||
"-weak_framework Metal",
|
||||
"-weak_framework MetalKit",
|
||||
}
|
||||
|
||||
configuration { "not nacl", "not linux-steamlink" }
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
#import <Metal/Metal.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
|
||||
#if BX_PLATFORM_IOS
|
||||
# import <UIKit/UIKit.h>
|
||||
|
|
|
@ -378,8 +378,16 @@ namespace bgfx { namespace mtl
|
|||
memset(m_uniforms, 0, sizeof(m_uniforms) );
|
||||
memset(&m_resolution, 0, sizeof(m_resolution) );
|
||||
|
||||
if (NULL != NSClassFromString(@"MTKView")) {
|
||||
MTKView *view = (MTKView *)g_platformData.nwh;
|
||||
if (NULL != view && [view isKindOfClass:NSClassFromString(@"MTKView")]) {
|
||||
m_metalLayer = (CAMetalLayer *)view.layer;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != NSClassFromString(@"CAMetalLayer") )
|
||||
{
|
||||
if (NULL == m_metalLayer)
|
||||
#if BX_PLATFORM_IOS
|
||||
{
|
||||
CAMetalLayer* metalLayer = (CAMetalLayer*)g_platformData.nwh;
|
||||
|
|
Загрузка…
Ссылка в новой задаче