mirror of https://github.com/mpv-player/mpv
cocoa: handle failure on pixel format creation
This didn't make any difference on with OpenGL 2.1, but with the introduction of OpenGL3.2 it's possible for the pixel format creation to fail (if OpenGL3.2 is not supported). This code handles the failure case accordingly.
This commit is contained in:
parent
5fe14d5bf1
commit
4a2bd440dd
|
@ -257,6 +257,12 @@ int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
|
||||||
attr[i] = (NSOpenGLPixelFormatAttribute)0;
|
attr[i] = (NSOpenGLPixelFormatAttribute)0;
|
||||||
|
|
||||||
s->pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease];
|
s->pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease];
|
||||||
|
if (!s->pixelFormat) {
|
||||||
|
mp_msg(MSGT_VO, MSGL_ERR,
|
||||||
|
"[cocoa] Invalid pixel format attribute "
|
||||||
|
"(GL3 not supported?)\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
s->glContext = [[NSOpenGLContext alloc] initWithFormat:s->pixelFormat shareContext:nil];
|
s->glContext = [[NSOpenGLContext alloc] initWithFormat:s->pixelFormat shareContext:nil];
|
||||||
|
|
||||||
create_menu();
|
create_menu();
|
||||||
|
|
Loading…
Reference in New Issue