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 } |
41 if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) { | 53 if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) { |
42 DVLOG(1) << "GLX_ARB_create_context_robustness supported."; | 54 DVLOG(1) << "GLX_ARB_create_context_robustness supported."; |
43 attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); | 55 attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); |
44 attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB); | 56 attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB); |
45 } | 57 } |
46 attribs.push_back(0); | 58 attribs.push_back(0); |
47 context_ = glXCreateContextAttribsARB( | 59 context_ = glXCreateContextAttribsARB( |
48 display_, | 60 display_, |
49 static_cast<GLXFBConfig>(compatible_surface->GetConfig()), | 61 static_cast<GLXFBConfig>(compatible_surface->GetConfig()), |
50 share_handle, | 62 share_handle, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 218 |
207 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { | 219 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { |
208 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); | 220 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); |
209 } | 221 } |
210 | 222 |
211 GLContextGLX::~GLContextGLX() { | 223 GLContextGLX::~GLContextGLX() { |
212 Destroy(); | 224 Destroy(); |
213 } | 225 } |
214 | 226 |
215 } // namespace gfx | 227 } // namespace gfx |
OLD | NEW |