| 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 extern "C" { | 5 extern "C" { |
| 6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
| 7 } | 7 } |
| 8 | 8 |
| 9 #include "ui/gl/gl_context_glx.h" | 9 #include "ui/gl/gl_context_glx.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 bool GLContextGLX::Initialize( | 31 bool GLContextGLX::Initialize( |
| 32 GLSurface* compatible_surface, GpuPreference gpu_preference) { | 32 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
| 33 display_ = static_cast<XDisplay*>(compatible_surface->GetDisplay()); | 33 display_ = static_cast<XDisplay*>(compatible_surface->GetDisplay()); |
| 34 | 34 |
| 35 GLXContext share_handle = static_cast<GLXContext>( | 35 GLXContext share_handle = static_cast<GLXContext>( |
| 36 share_group() ? share_group()->GetHandle() : NULL); | 36 share_group() ? share_group()->GetHandle() : NULL); |
| 37 | 37 |
| 38 if (GLSurfaceGLX::IsCreateContextSupported()) { | 38 if (GLSurfaceGLX::IsCreateContextSupported()) { |
| 39 DVLOG(1) << "GLX_ARB_create_context supported."; | 39 DVLOG(1) << "GLX_ARB_create_context supported."; |
| 40 std::vector<int> attribs; | 40 std::vector<int> attribs; |
| 41 if (gfx::GetGLImplementation() == | |
| 42 gfx::kGLImplementationDesktopGLCoreProfile) { | |
| 43 // TODO(kbr): NVIDIA's driver doesn't return a later context | |
| 44 // version if any version later than 3.1 is requested. We | |
| 45 // explicitly want to request a 3.2+ context with no support for | |
| 46 // the compatibility profile. WebGL 2.0 support currently | |
| 47 // requires a 4.2 context. crbug.com/473427 | |
| 48 attribs.push_back(GLX_CONTEXT_MAJOR_VERSION_ARB); | |
| 49 attribs.push_back(4); | |
| 50 attribs.push_back(GLX_CONTEXT_MINOR_VERSION_ARB); | |
| 51 attribs.push_back(2); | |
| 52 } | |
| 53 if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) { | 41 if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) { |
| 54 DVLOG(1) << "GLX_ARB_create_context_robustness supported."; | 42 DVLOG(1) << "GLX_ARB_create_context_robustness supported."; |
| 55 attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); | 43 attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); |
| 56 attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB); | 44 attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB); |
| 57 } | 45 } |
| 58 attribs.push_back(0); | 46 attribs.push_back(0); |
| 59 context_ = glXCreateContextAttribsARB( | 47 context_ = glXCreateContextAttribsARB( |
| 60 display_, | 48 display_, |
| 61 static_cast<GLXFBConfig>(compatible_surface->GetConfig()), | 49 static_cast<GLXFBConfig>(compatible_surface->GetConfig()), |
| 62 share_handle, | 50 share_handle, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 206 |
| 219 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { | 207 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { |
| 220 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); | 208 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); |
| 221 } | 209 } |
| 222 | 210 |
| 223 GLContextGLX::~GLContextGLX() { | 211 GLContextGLX::~GLContextGLX() { |
| 224 Destroy(); | 212 Destroy(); |
| 225 } | 213 } |
| 226 | 214 |
| 227 } // namespace gfx | 215 } // namespace gfx |
| OLD | NEW |