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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "gl_in_process_context_export.h" | 10 #include "gl_in_process_context_export.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class SurfaceTexture; | 23 class SurfaceTexture; |
24 } | 24 } |
25 #endif | 25 #endif |
26 | 26 |
27 namespace gpu { | 27 namespace gpu { |
28 | 28 |
29 namespace gles2 { | 29 namespace gles2 { |
30 class GLES2Implementation; | 30 class GLES2Implementation; |
31 } | 31 } |
32 | 32 |
| 33 struct GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContextSharedMemoryLimits { |
| 34 GLInProcessContextSharedMemoryLimits(); |
| 35 |
| 36 size_t command_buffer_size; |
| 37 size_t start_transfer_buffer_size; |
| 38 size_t min_transfer_buffer_size; |
| 39 size_t max_transfer_buffer_size; |
| 40 size_t mapped_memory_reclaim_limit; |
| 41 }; |
| 42 |
33 class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { | 43 class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { |
34 public: | 44 public: |
35 virtual ~GLInProcessContext() {} | 45 virtual ~GLInProcessContext() {} |
36 | 46 |
37 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an | 47 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an |
38 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list | 48 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list |
39 // of attribute/value pairs. | 49 // of attribute/value pairs. |
40 // If |surface| is not NULL, then it must match |is_offscreen| and |size|, | 50 // If |surface| is not NULL, then it must match |is_offscreen| and |size|, |
41 // |window| must be gfx::kNullAcceleratedWidget, and the command buffer | 51 // |window| must be gfx::kNullAcceleratedWidget, and the command buffer |
42 // service must run on the same thread as this client because GLSurface is | 52 // service must run on the same thread as this client because GLSurface is |
43 // not thread safe. If |surface| is NULL, then the other parameters are used | 53 // not thread safe. If |surface| is NULL, then the other parameters are used |
44 // to correctly create a surface. | 54 // to correctly create a surface. |
45 // Only one of |share_context| and |use_global_share_group| can be used at | 55 // Only one of |share_context| and |use_global_share_group| can be used at |
46 // the same time. | 56 // the same time. |
47 static GLInProcessContext* Create( | 57 static GLInProcessContext* Create( |
48 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, | 58 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
49 scoped_refptr<gfx::GLSurface> surface, | 59 scoped_refptr<gfx::GLSurface> surface, |
50 bool is_offscreen, | 60 bool is_offscreen, |
51 gfx::AcceleratedWidget window, | 61 gfx::AcceleratedWidget window, |
52 const gfx::Size& size, | 62 const gfx::Size& size, |
53 GLInProcessContext* share_context, | 63 GLInProcessContext* share_context, |
54 bool use_global_share_group, | 64 bool use_global_share_group, |
55 const gpu::gles2::ContextCreationAttribHelper& attribs, | 65 const gpu::gles2::ContextCreationAttribHelper& attribs, |
56 gfx::GpuPreference gpu_preference); | 66 gfx::GpuPreference gpu_preference, |
| 67 const GLInProcessContextSharedMemoryLimits& memory_limits); |
57 | 68 |
58 virtual void SetContextLostCallback(const base::Closure& callback) = 0; | 69 virtual void SetContextLostCallback(const base::Closure& callback) = 0; |
59 | 70 |
60 // Allows direct access to the GLES2 implementation so a GLInProcessContext | 71 // Allows direct access to the GLES2 implementation so a GLInProcessContext |
61 // can be used without making it current. | 72 // can be used without making it current. |
62 virtual gles2::GLES2Implementation* GetImplementation() = 0; | 73 virtual gles2::GLES2Implementation* GetImplementation() = 0; |
63 | 74 |
| 75 virtual size_t GetMappedMemoryLimit() = 0; |
| 76 |
64 #if defined(OS_ANDROID) | 77 #if defined(OS_ANDROID) |
65 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 78 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
66 uint32 stream_id) = 0; | 79 uint32 stream_id) = 0; |
67 #endif | 80 #endif |
68 }; | 81 }; |
69 | 82 |
70 } // namespace gpu | 83 } // namespace gpu |
71 | 84 |
72 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ | 85 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ |
OLD | NEW |