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 #ifndef UI_GL_GL_CONTEXT_CGL_H_ | 5 #ifndef UI_GL_GL_CONTEXT_CGL_H_ |
6 #define UI_GL_GL_CONTEXT_CGL_H_ | 6 #define UI_GL_GL_CONTEXT_CGL_H_ |
7 | 7 |
8 #include <OpenGL/CGLTypes.h> | 8 #include <OpenGL/CGLTypes.h> |
9 | 9 |
10 #include "base/memory/scoped_generic_obj.h" | 10 #include "base/memory/scoped_generic_obj.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual bool Initialize(GLSurface* compatible_surface, | 23 virtual bool Initialize(GLSurface* compatible_surface, |
24 GpuPreference gpu_preference) OVERRIDE; | 24 GpuPreference gpu_preference) OVERRIDE; |
25 virtual void Destroy() OVERRIDE; | 25 virtual void Destroy() OVERRIDE; |
26 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; | 26 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; |
27 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; | 27 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; |
28 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; | 28 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; |
29 virtual void* GetHandle() OVERRIDE; | 29 virtual void* GetHandle() OVERRIDE; |
30 virtual void SetSwapInterval(int interval) OVERRIDE; | 30 virtual void SetSwapInterval(int interval) OVERRIDE; |
31 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; | 31 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; |
32 | 32 |
| 33 // Helper for dual-GPU support on systems where this is necessary |
| 34 // for stability reasons. |
| 35 static void ForceUseOfDiscreteGPU(); |
| 36 |
33 protected: | 37 protected: |
34 virtual ~GLContextCGL(); | 38 virtual ~GLContextCGL(); |
35 | 39 |
36 private: | 40 private: |
37 GpuPreference GetGpuPreference(); | 41 GpuPreference GetGpuPreference(); |
38 | 42 |
39 void* context_; | 43 void* context_; |
40 GpuPreference gpu_preference_; | 44 GpuPreference gpu_preference_; |
41 | 45 |
42 CGLPixelFormatObj discrete_pixelformat_; | 46 CGLPixelFormatObj discrete_pixelformat_; |
43 | 47 |
44 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); | 48 DISALLOW_COPY_AND_ASSIGN(GLContextCGL); |
45 }; | 49 }; |
46 | 50 |
47 class ScopedCGLDestroyRendererInfo { | 51 class ScopedCGLDestroyRendererInfo { |
48 public: | 52 public: |
49 void operator()(CGLRendererInfoObj x) const; | 53 void operator()(CGLRendererInfoObj x) const; |
50 }; | 54 }; |
51 | 55 |
52 typedef ScopedGenericObj<CGLRendererInfoObj, ScopedCGLDestroyRendererInfo> | 56 typedef ScopedGenericObj<CGLRendererInfoObj, ScopedCGLDestroyRendererInfo> |
53 ScopedCGLRendererInfoObj; | 57 ScopedCGLRendererInfoObj; |
54 | 58 |
55 } // namespace gfx | 59 } // namespace gfx |
56 | 60 |
57 #endif // UI_GL_GL_CONTEXT_CGL_H_ | 61 #endif // UI_GL_GL_CONTEXT_CGL_H_ |
OLD | NEW |