浏览代码

fix mac crash issue

/siyaoH-1.17-PlatformMessage
xingwei.zhu 4 年前
当前提交
f263082c
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 14
      engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.mm

14
engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.mm


};
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
gl_context_ = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
gl_resource_context_ = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:gl_context_];
//gl_context_ may be created unproperly, we can check this using the relevant gl_resource_context_
//loop until the created gl_context_ is ok, otherwise the program will crash anyway
while(gl_resource_context_ == nil) {
gl_context_ = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
gl_resource_context_ = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:gl_context_];
if (gl_resource_context_ == nil) {
CGLReleaseContext(gl_context_.CGLContextObj);
gl_context_ = nullptr;
}
}
FML_DCHECK(gl_context_ != nullptr);
}

正在加载...
取消
保存