From 9495a52d59ef7dd064a080b835cbc8f739fa2f0e Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 16 Apr 2018 16:41:45 -0700 Subject: [PATCH] On iOS, try to use ES3, then fall back to ES2. (#5006) --- shell/platform/darwin/ios/ios_gl_context.mm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/shell/platform/darwin/ios/ios_gl_context.mm b/shell/platform/darwin/ios/ios_gl_context.mm index 77a124e64a2..92647c5d54c 100644 --- a/shell/platform/darwin/ios/ios_gl_context.mm +++ b/shell/platform/darwin/ios/ios_gl_context.mm @@ -14,14 +14,21 @@ namespace shell { IOSGLContext::IOSGLContext(fml::scoped_nsobject layer) : layer_(std::move(layer)), - context_([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]), - resource_context_([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 - sharegroup:context_.get().sharegroup]), framebuffer_(GL_NONE), colorbuffer_(GL_NONE), storage_size_width_(0), storage_size_height_(0), valid_(false) { + context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]); + if (context_ != nullptr) { + resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 + sharegroup:context_.get().sharegroup]); + } else { + context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]); + resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 + sharegroup:context_.get().sharegroup]); + } + FXL_DCHECK(layer_ != nullptr); FXL_DCHECK(context_ != nullptr); FXL_DCHECK(resource_context_ != nullptr);