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_GLX_H_ | 5 #ifndef UI_GL_GL_CONTEXT_VIRTUAL_H_ |
6 #define UI_GL_GL_CONTEXT_GLX_H_ | 6 #define UI_GL_GL_CONTEXT_VIRTUAL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ui/base/x/x11_util.h" | |
12 #include "ui/gl/gl_context.h" | 11 #include "ui/gl/gl_context.h" |
13 #include "ui/gl/gl_export.h" | 12 #include "ui/gl/gl_export.h" |
14 | 13 |
| 14 namespace gpu { |
| 15 namespace gles2 { |
| 16 class GLES2Decoder; |
| 17 } |
| 18 } |
| 19 |
15 namespace gfx { | 20 namespace gfx { |
16 | 21 |
| 22 class Display; |
17 class GLSurface; | 23 class GLSurface; |
| 24 class VirtualGL; |
18 | 25 |
19 // Encapsulates a GLX OpenGL context. | 26 // Encapsulates a virtual OpenGL context. |
20 class GL_EXPORT GLContextGLX : public GLContext { | 27 class GL_EXPORT GLContextVirtual : public GLContext { |
21 public: | 28 public: |
22 explicit GLContextGLX(GLShareGroup* share_group); | 29 explicit GLContextVirtual( |
| 30 GLShareGroup* share_group, |
| 31 GLContext* shared_context, |
| 32 const gpu::gles2::GLES2Decoder* decoder); |
23 | 33 |
24 Display* display(); | 34 Display* display(); |
25 | 35 |
26 // Implement GLContext. | 36 // Implement GLContext. |
27 virtual bool Initialize( | 37 virtual bool Initialize( |
28 GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE; | 38 GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE; |
29 virtual void Destroy() OVERRIDE; | 39 virtual void Destroy() OVERRIDE; |
30 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; | 40 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; |
31 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; | 41 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; |
32 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; | 42 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; |
33 virtual void* GetHandle() OVERRIDE; | 43 virtual void* GetHandle() OVERRIDE; |
| 44 virtual const gpu::gles2::GLES2Decoder* GetDecoder() OVERRIDE; |
34 virtual void SetSwapInterval(int interval) OVERRIDE; | 45 virtual void SetSwapInterval(int interval) OVERRIDE; |
35 virtual std::string GetExtensions() OVERRIDE; | 46 virtual std::string GetExtensions() OVERRIDE; |
36 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; | 47 virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; |
37 virtual bool WasAllocatedUsingRobustnessExtension() OVERRIDE; | 48 virtual bool WasAllocatedUsingRobustnessExtension() OVERRIDE; |
38 | 49 |
39 protected: | 50 protected: |
40 virtual ~GLContextGLX(); | 51 virtual ~GLContextVirtual(); |
41 | 52 |
42 private: | 53 private: |
43 void* context_; | 54 GLContext* shared_context_; |
44 Display* display_; | 55 Display* display_; |
| 56 const gpu::gles2::GLES2Decoder* decoder_; |
45 | 57 |
46 DISALLOW_COPY_AND_ASSIGN(GLContextGLX); | 58 DISALLOW_COPY_AND_ASSIGN(GLContextVirtual); |
47 }; | 59 }; |
48 | 60 |
49 } // namespace gfx | 61 } // namespace gfx |
50 | 62 |
51 #endif // UI_GL_GL_CONTEXT_GLX_H_ | 63 #endif // UI_GL_GL_CONTEXT_VIRTUAL_H_ |
OLD | NEW |