OLD | NEW |
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_glx.h" | 5 #include "ui/gl/gl_context_glx.h" |
6 | 6 |
7 extern "C" { | 7 extern "C" { |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 } | 9 } |
10 #include <memory> | 10 #include <memory> |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 GLContextGLX::GLContextGLX(GLShareGroup* share_group) | 152 GLContextGLX::GLContextGLX(GLShareGroup* share_group) |
153 : GLContextReal(share_group), | 153 : GLContextReal(share_group), |
154 context_(nullptr), | 154 context_(nullptr), |
155 display_(nullptr) { | 155 display_(nullptr) { |
156 } | 156 } |
157 | 157 |
158 XDisplay* GLContextGLX::display() { | 158 XDisplay* GLContextGLX::display() { |
159 return display_; | 159 return display_; |
160 } | 160 } |
161 | 161 |
162 bool GLContextGLX::Initialize(GLSurface* compatible_surface, | 162 bool GLContextGLX::Initialize( |
163 const GLContextAttribs& attribs) { | 163 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
164 // webgl_compatibility_context and disabling bind_generates_resource are not | |
165 // supported. | |
166 DCHECK(!attribs.webgl_compatibility_context && | |
167 attribs.bind_generates_resource); | |
168 | |
169 display_ = static_cast<XDisplay*>(compatible_surface->GetDisplay()); | 164 display_ = static_cast<XDisplay*>(compatible_surface->GetDisplay()); |
170 | 165 |
171 GLXContext share_handle = static_cast<GLXContext>( | 166 GLXContext share_handle = static_cast<GLXContext>( |
172 share_group() ? share_group()->GetHandle() : nullptr); | 167 share_group() ? share_group()->GetHandle() : nullptr); |
173 | 168 |
174 if (GLSurfaceGLX::IsCreateContextSupported()) { | 169 if (GLSurfaceGLX::IsCreateContextSupported()) { |
175 DVLOG(1) << "GLX_ARB_create_context supported."; | 170 DVLOG(1) << "GLX_ARB_create_context supported."; |
176 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 171 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
177 switches::kCreateDefaultGLContext)) { | 172 switches::kCreateDefaultGLContext)) { |
178 context_ = CreateContextAttribs( | 173 context_ = CreateContextAttribs( |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 319 |
325 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { | 320 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { |
326 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); | 321 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); |
327 } | 322 } |
328 | 323 |
329 GLContextGLX::~GLContextGLX() { | 324 GLContextGLX::~GLContextGLX() { |
330 Destroy(); | 325 Destroy(); |
331 } | 326 } |
332 | 327 |
333 } // namespace gl | 328 } // namespace gl |
OLD | NEW |