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

Side by Side Diff: ui/gl/gl_context_egl.cc

Issue 2456213002: WebVR: implement SetSurfaceHandleCHROMIUM extension for gvr_device.
Patch Set: Rebase, set dependency. Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_context_egl.h" 5 #include "ui/gl/gl_context_egl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 14 matching lines...) Expand all
25 #ifndef EGL_CHROMIUM_create_context_bind_generates_resource 25 #ifndef EGL_CHROMIUM_create_context_bind_generates_resource
26 #define EGL_CHROMIUM_create_context_bind_generates_resource 1 26 #define EGL_CHROMIUM_create_context_bind_generates_resource 1
27 #define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD 27 #define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x3AAD
28 #endif /* EGL_CHROMIUM_create_context_bind_generates_resource */ 28 #endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
29 29
30 #ifndef EGL_ANGLE_create_context_webgl_compatibility 30 #ifndef EGL_ANGLE_create_context_webgl_compatibility
31 #define EGL_ANGLE_create_context_webgl_compatibility 1 31 #define EGL_ANGLE_create_context_webgl_compatibility 1
32 #define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC 32 #define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x3AAC
33 #endif /* EGL_ANGLE_create_context_webgl_compatibility */ 33 #endif /* EGL_ANGLE_create_context_webgl_compatibility */
34 34
35 #ifndef EGL_CONTEXT_PRIORITY_LEVEL_IMG
36 #define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
37 #define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
38 #endif /* EGL_CONTEXT_PRIORITY_LEVEL */
39
40
35 using ui::GetLastEGLErrorString; 41 using ui::GetLastEGLErrorString;
36 42
37 namespace gl { 43 namespace gl {
38 44
39 GLContextEGL::GLContextEGL(GLShareGroup* share_group) 45 GLContextEGL::GLContextEGL(GLShareGroup* share_group)
40 : GLContextReal(share_group), 46 : GLContextReal(share_group),
41 context_(nullptr), 47 context_(nullptr),
42 display_(nullptr), 48 display_(nullptr),
43 config_(nullptr), 49 config_(nullptr),
44 unbind_fbo_on_makecurrent_(false), 50 unbind_fbo_on_makecurrent_(false),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 104 }
99 105
100 if (GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()) { 106 if (GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()) {
101 context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE); 107 context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
102 context_attributes.push_back( 108 context_attributes.push_back(
103 attribs.webgl_compatibility_context ? EGL_TRUE : EGL_FALSE); 109 attribs.webgl_compatibility_context ? EGL_TRUE : EGL_FALSE);
104 } else { 110 } else {
105 DCHECK(!attribs.webgl_compatibility_context); 111 DCHECK(!attribs.webgl_compatibility_context);
106 } 112 }
107 113
114 if (attribs.low_priority) {
115 VLOG(1) << __FUNCTION__ << ": setting low priority";
116 context_attributes.push_back(EGL_CONTEXT_PRIORITY_LEVEL_IMG);
117 context_attributes.push_back(EGL_CONTEXT_PRIORITY_LOW_IMG);
118 }
119
108 // Append final EGL_NONE to signal the context attributes are finished 120 // Append final EGL_NONE to signal the context attributes are finished
109 context_attributes.push_back(EGL_NONE); 121 context_attributes.push_back(EGL_NONE);
110 context_attributes.push_back(EGL_NONE); 122 context_attributes.push_back(EGL_NONE);
111 123
112 context_ = eglCreateContext( 124 context_ = eglCreateContext(
113 display_, config_, share_group() ? share_group()->GetHandle() : nullptr, 125 display_, config_, share_group() ? share_group()->GetHandle() : nullptr,
114 context_attributes.data()); 126 context_attributes.data());
115 127
116 if (!context_) { 128 if (!context_) {
117 LOG(ERROR) << "eglCreateContext failed with error " 129 LOG(ERROR) << "eglCreateContext failed with error "
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 256
245 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { 257 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() {
246 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); 258 return GLSurfaceEGL::IsCreateContextRobustnessSupported();
247 } 259 }
248 260
249 GLContextEGL::~GLContextEGL() { 261 GLContextEGL::~GLContextEGL() {
250 Destroy(); 262 Destroy();
251 } 263 }
252 264
253 } // namespace gl 265 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_surface_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698