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