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

Unified Diff: ui/gl/gl_context_egl.cc

Issue 2497503004: Revert of Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month 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 1ac7d017dde589d071114432decbee55a72919ae..b1ea4e6a77040716cc441e2287edb1267613fd76 100644
--- a/ui/gl/gl_context_egl.cc
+++ b/ui/gl/gl_context_egl.cc
@@ -22,16 +22,6 @@
}
#endif
-#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
-#define EGL_CHROMIUM_create_context_bind_generates_resource 1
-#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD
-#endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
-
-#ifndef EGL_ANGLE_create_context_webgl_compatibility
-#define EGL_ANGLE_create_context_webgl_compatibility 1
-#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC
-#endif /* EGL_ANGLE_create_context_webgl_compatibility */
-
using ui::GetLastEGLErrorString;
namespace gl {
@@ -45,8 +35,8 @@
swap_interval_(1) {
}
-bool GLContextEGL::Initialize(GLSurface* compatible_surface,
- const GLContextAttribs& attribs) {
+bool GLContextEGL::Initialize(
+ GLSurface* compatible_surface, GpuPreference gpu_preference) {
DCHECK(compatible_surface);
DCHECK(!context_);
@@ -68,19 +58,26 @@
context_client_version = 3;
}
- std::vector<EGLint> context_attributes;
- context_attributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
- context_attributes.push_back(context_client_version);
-
+ const EGLint kContextAttributes[] = {
+ EGL_CONTEXT_CLIENT_VERSION, context_client_version,
+ EGL_NONE
+ };
+ const EGLint kContextRobustnessAttributes[] = {
+ EGL_CONTEXT_CLIENT_VERSION, context_client_version,
+ EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
+ EGL_LOSE_CONTEXT_ON_RESET_EXT,
+ EGL_NONE
+ };
+
+ const EGLint* context_attributes = nullptr;
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.push_back(
- EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT);
- context_attributes.push_back(EGL_LOSE_CONTEXT_ON_RESET_EXT);
+ context_attributes = kContextAttributes;
}
if (!eglBindAPI(EGL_OPENGL_ES_API)) {
@@ -89,29 +86,11 @@
return false;
}
- if (GLSurfaceEGL::IsCreateContextBindGeneratesResourceSupported()) {
- context_attributes.push_back(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM);
- context_attributes.push_back(attribs.bind_generates_resource ? EGL_TRUE
- : EGL_FALSE);
- } else {
- DCHECK(attribs.bind_generates_resource);
- }
-
- if (GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()) {
- context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
- context_attributes.push_back(
- attribs.webgl_compatibility_context ? EGL_TRUE : EGL_FALSE);
- } else {
- DCHECK(!attribs.webgl_compatibility_context);
- }
-
- // Append final EGL_NONE to signal the context attributes are finished
- context_attributes.push_back(EGL_NONE);
- context_attributes.push_back(EGL_NONE);
-
context_ = eglCreateContext(
- display_, config_, share_group() ? share_group()->GetHandle() : nullptr,
- context_attributes.data());
+ display_,
+ config_,
+ share_group() ? share_group()->GetHandle() : nullptr,
+ context_attributes);
if (!context_) {
LOG(ERROR) << "eglCreateContext failed with error "
« 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