Commit 79f2fd00 authored by Felix Paul Kühne's avatar Felix Paul Kühne

iOS vout: re-use existing OpenGL context if available and compatible

parent 6cc21d0e
...@@ -612,7 +612,16 @@ static void ZeroCopyDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *su ...@@ -612,7 +612,16 @@ static void ZeroCopyDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *su
layer.drawableProperties = [NSDictionary dictionaryWithObject:kEAGLColorFormatRGBA8 forKey: kEAGLDrawablePropertyColorFormat]; layer.drawableProperties = [NSDictionary dictionaryWithObject:kEAGLColorFormatRGBA8 forKey: kEAGLDrawablePropertyColorFormat];
layer.opaque = YES; layer.opaque = YES;
_eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; /* a client app may have already created a rendering context,
* so re-use it if it is valid */
EAGLContext *existingContext = [EAGLContext currentContext];
if (existingContext) {
if ([existingContext API] == kEAGLRenderingAPIOpenGLES2)
_eaglContext = [EAGLContext currentContext];
}
if (!_eaglContext)
_eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (unlikely(!_eaglContext)) if (unlikely(!_eaglContext))
return nil; return nil;
if (unlikely(![EAGLContext setCurrentContext:_eaglContext])) if (unlikely(![EAGLContext setCurrentContext:_eaglContext]))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment