Commit e7b8b2a2 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Fallback to GLES2 when GLES3 is not supported

The percentage of seeing a GLES2-only device is low but it's still
safer to handle that, given that doing so requires only a few more lines.

Bug: 787224
Change-Id: I63650f3ce4c2afe93492b81e30d7075d7007ebdc
Reviewed-on: https://chromium-review.googlesource.com/780801Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518363}
parent 2d9ed3b5
...@@ -119,10 +119,15 @@ void Core::Initialize() { ...@@ -119,10 +119,15 @@ void Core::Initialize() {
eagl_context_ = [EAGLContext currentContext]; eagl_context_ = [EAGLContext currentContext];
if (!eagl_context_) { if (!eagl_context_) {
// TODO(nicholss): For prod code, make sure to check for ES3 support and
// fall back to ES2 if needed.
eagl_context_ = eagl_context_ =
[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if (!eagl_context_) {
LOG(WARNING) << "Failed to create GLES3 context. Atempting to create "
<< "GLES2 context.";
eagl_context_ =
[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
}
DCHECK(eagl_context_);
[EAGLContext setCurrentContext:eagl_context_]; [EAGLContext setCurrentContext:eagl_context_];
} }
...@@ -130,10 +135,6 @@ void Core::Initialize() { ...@@ -130,10 +135,6 @@ void Core::Initialize() {
renderer_proxy_->Initialize(renderer_->GetWeakPtr()); renderer_proxy_->Initialize(renderer_->GetWeakPtr());
// renderer_.RequestCanvasSize();
// demo_screen_ = new GlDemoScreen();
// renderer_->AddDrawable(demo_screen_->GetWeakPtr());
renderer_->SetDelegate(weak_ptr_); renderer_->SetDelegate(weak_ptr_);
} }
......
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