Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: ui/gl/gl_context_egl.cc

Issue 10822029: Use EXT_robustness where available on GLES2 platforms to detect and respond to resets of the graphi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review feedback. Rebuilt and re-tested. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_context_egl.h ('k') | ui/gl/gl_context_glx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context_egl.cc
diff --git a/ui/gl/gl_context_egl.cc b/ui/gl/gl_context_egl.cc
index a5c61e877b74421180bc224558f74da71060f482..dc406f47a7a6c24ea9fa86ffb6c5a33f1fec195e 100644
--- a/ui/gl/gl_context_egl.cc
+++ b/ui/gl/gl_context_egl.cc
@@ -9,8 +9,9 @@
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "third_party/angle/include/EGL/egl.h"
+#include "third_party/angle/include/EGL/eglext.h"
#include "ui/gl/egl_util.h"
-#include "ui/gl/gl_surface.h"
+#include "ui/gl/gl_surface_egl.h"
// This header must come after the above third-party include, as
// it brings in #defines that cause conflicts.
@@ -40,15 +41,33 @@ bool GLContextEGL::Initialize(
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
+ static const EGLint kContextRobustnessAttributes[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
+ EGL_LOSE_CONTEXT_ON_RESET_EXT,
+ EGL_NONE
+ };
display_ = compatible_surface->GetDisplay();
config_ = compatible_surface->GetConfig();
+ const EGLint* context_attributes = NULL;
+ if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) {
+ DVLOG(1) << "EGL_EXT_create_context_robustness supported.";
+ context_attributes = kContextRobustnessAttributes;
+ } else {
+ // At some point we should require the presence of the robustness
+ // extension and remove this code path.
+ DVLOG(1) << "EGL_EXT_create_context_robustness NOT supported.";
+ context_attributes = kContextAttributes;
+ }
+
context_ = eglCreateContext(
display_,
config_,
share_group() ? share_group()->GetHandle() : NULL,
- kContextAttributes);
+ context_attributes);
+
if (!context_) {
LOG(ERROR) << "eglCreateContext failed with error "
<< GetLastEGLErrorString();
@@ -155,6 +174,10 @@ std::string GLContextEGL::GetExtensions() {
return GLContext::GetExtensions() + " " + extensions;
}
+bool GLContextEGL::WasAllocatedUsingRobustnessExtension() {
+ return GLSurfaceEGL::IsCreateContextRobustnessSupported();
+}
+
GLContextEGL::~GLContextEGL() {
Destroy();
}
« no previous file with comments | « ui/gl/gl_context_egl.h ('k') | ui/gl/gl_context_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698