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 GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "gl_in_process_context_export.h" | 13 #include "gl_in_process_context_export.h" |
14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
15 #include "gpu/command_buffer/service/in_process_command_buffer.h" | 15 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
18 #include "ui/gl/gpu_preference.h" | 18 #include "ui/gl/gpu_preference.h" |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class Size; | 21 class Size; |
22 } | 22 } |
23 | 23 |
24 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
25 namespace gfx { | 25 namespace gl { |
26 class SurfaceTexture; | 26 class SurfaceTexture; |
27 } | 27 } |
28 #endif | 28 #endif |
29 | 29 |
30 namespace gpu { | 30 namespace gpu { |
31 struct SharedMemoryLimits; | 31 struct SharedMemoryLimits; |
32 | 32 |
33 namespace gles2 { | 33 namespace gles2 { |
34 class GLES2Implementation; | 34 class GLES2Implementation; |
35 } | 35 } |
36 | 36 |
37 class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { | 37 class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { |
38 public: | 38 public: |
39 virtual ~GLInProcessContext() {} | 39 virtual ~GLInProcessContext() {} |
40 | 40 |
41 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an | 41 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an |
42 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list | 42 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list |
43 // of attribute/value pairs. | 43 // of attribute/value pairs. |
44 // If |surface| is not NULL, then it must match |is_offscreen| and |size|, | 44 // If |surface| is not NULL, then it must match |is_offscreen| and |size|, |
45 // |window| must be gfx::kNullAcceleratedWidget, and the command buffer | 45 // |window| must be gfx::kNullAcceleratedWidget, and the command buffer |
46 // service must run on the same thread as this client because GLSurface is | 46 // service must run on the same thread as this client because GLSurface is |
47 // not thread safe. If |surface| is NULL, then the other parameters are used | 47 // not thread safe. If |surface| is NULL, then the other parameters are used |
48 // to correctly create a surface. | 48 // to correctly create a surface. |
49 static GLInProcessContext* Create( | 49 static GLInProcessContext* Create( |
50 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, | 50 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
51 scoped_refptr<gfx::GLSurface> surface, | 51 scoped_refptr<gl::GLSurface> surface, |
52 bool is_offscreen, | 52 bool is_offscreen, |
53 gfx::AcceleratedWidget window, | 53 gfx::AcceleratedWidget window, |
54 const gfx::Size& size, | 54 const gfx::Size& size, |
55 GLInProcessContext* share_context, | 55 GLInProcessContext* share_context, |
56 const gpu::gles2::ContextCreationAttribHelper& attribs, | 56 const gpu::gles2::ContextCreationAttribHelper& attribs, |
57 gfx::GpuPreference gpu_preference, | 57 gl::GpuPreference gpu_preference, |
58 const SharedMemoryLimits& memory_limits, | 58 const SharedMemoryLimits& memory_limits, |
59 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 59 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
60 ImageFactory* image_factory); | 60 ImageFactory* image_factory); |
61 | 61 |
62 // Allows direct access to the GLES2 implementation so a GLInProcessContext | 62 // Allows direct access to the GLES2 implementation so a GLInProcessContext |
63 // can be used without making it current. | 63 // can be used without making it current. |
64 virtual gles2::GLES2Implementation* GetImplementation() = 0; | 64 virtual gles2::GLES2Implementation* GetImplementation() = 0; |
65 | 65 |
66 virtual void SetLock(base::Lock* lock) = 0; | 66 virtual void SetLock(base::Lock* lock) = 0; |
67 }; | 67 }; |
68 | 68 |
69 } // namespace gpu | 69 } // namespace gpu |
70 | 70 |
71 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ | 71 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ |
OLD | NEW |