OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 class Service; | 77 class Service; |
78 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); | 78 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); |
79 ~InProcessCommandBuffer() override; | 79 ~InProcessCommandBuffer() override; |
80 | 80 |
81 // If |surface| is not null, use it directly; in this case, the command | 81 // If |surface| is not null, use it directly; in this case, the command |
82 // buffer gpu thread must be the same as the client thread. Otherwise create | 82 // buffer gpu thread must be the same as the client thread. Otherwise create |
83 // a new GLSurface. | 83 // a new GLSurface. |
84 bool Initialize(scoped_refptr<gl::GLSurface> surface, | 84 bool Initialize(scoped_refptr<gl::GLSurface> surface, |
85 bool is_offscreen, | 85 bool is_offscreen, |
86 gfx::AcceleratedWidget window, | 86 gfx::AcceleratedWidget window, |
| 87 const gfx::Size& size, |
87 const gles2::ContextCreationAttribHelper& attribs, | 88 const gles2::ContextCreationAttribHelper& attribs, |
| 89 gl::GpuPreference gpu_preference, |
88 InProcessCommandBuffer* share_group, | 90 InProcessCommandBuffer* share_group, |
89 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 91 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
90 ImageFactory* image_factory); | 92 ImageFactory* image_factory); |
91 | 93 |
92 // CommandBuffer implementation: | 94 // CommandBuffer implementation: |
93 State GetLastState() override; | 95 State GetLastState() override; |
94 int32_t GetLastToken() override; | 96 int32_t GetLastToken() override; |
95 void Flush(int32_t put_offset) override; | 97 void Flush(int32_t put_offset) override; |
96 void OrderingBarrier(int32_t put_offset) override; | 98 void OrderingBarrier(int32_t put_offset) override; |
97 void WaitForTokenInRange(int32_t start, int32_t end) override; | 99 void WaitForTokenInRange(int32_t start, int32_t end) override; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; | 166 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; |
165 scoped_refptr<gl::GLShareGroup> share_group_; | 167 scoped_refptr<gl::GLShareGroup> share_group_; |
166 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 168 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
167 std::unique_ptr<gpu::gles2::ProgramCache> program_cache_; | 169 std::unique_ptr<gpu::gles2::ProgramCache> program_cache_; |
168 }; | 170 }; |
169 | 171 |
170 private: | 172 private: |
171 struct InitializeOnGpuThreadParams { | 173 struct InitializeOnGpuThreadParams { |
172 bool is_offscreen; | 174 bool is_offscreen; |
173 gfx::AcceleratedWidget window; | 175 gfx::AcceleratedWidget window; |
| 176 const gfx::Size& size; |
174 const gles2::ContextCreationAttribHelper& attribs; | 177 const gles2::ContextCreationAttribHelper& attribs; |
| 178 gl::GpuPreference gpu_preference; |
175 gpu::Capabilities* capabilities; // Ouptut. | 179 gpu::Capabilities* capabilities; // Ouptut. |
176 InProcessCommandBuffer* context_group; | 180 InProcessCommandBuffer* context_group; |
177 ImageFactory* image_factory; | 181 ImageFactory* image_factory; |
178 | 182 |
179 InitializeOnGpuThreadParams( | 183 InitializeOnGpuThreadParams( |
180 bool is_offscreen, | 184 bool is_offscreen, |
181 gfx::AcceleratedWidget window, | 185 gfx::AcceleratedWidget window, |
| 186 const gfx::Size& size, |
182 const gles2::ContextCreationAttribHelper& attribs, | 187 const gles2::ContextCreationAttribHelper& attribs, |
| 188 gl::GpuPreference gpu_preference, |
183 gpu::Capabilities* capabilities, | 189 gpu::Capabilities* capabilities, |
184 InProcessCommandBuffer* share_group, | 190 InProcessCommandBuffer* share_group, |
185 ImageFactory* image_factory) | 191 ImageFactory* image_factory) |
186 : is_offscreen(is_offscreen), | 192 : is_offscreen(is_offscreen), |
187 window(window), | 193 window(window), |
| 194 size(size), |
188 attribs(attribs), | 195 attribs(attribs), |
| 196 gpu_preference(gpu_preference), |
189 capabilities(capabilities), | 197 capabilities(capabilities), |
190 context_group(share_group), | 198 context_group(share_group), |
191 image_factory(image_factory) {} | 199 image_factory(image_factory) {} |
192 }; | 200 }; |
193 | 201 |
194 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); | 202 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); |
195 void Destroy(); | 203 void Destroy(); |
196 bool DestroyOnGpuThread(); | 204 bool DestroyOnGpuThread(); |
197 void FlushOnGpuThread(int32_t put_offset, uint32_t order_num); | 205 void FlushOnGpuThread(int32_t put_offset, uint32_t order_num); |
198 void ScheduleDelayedWorkOnGpuThread(); | 206 void ScheduleDelayedWorkOnGpuThread(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 318 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
311 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 319 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
312 framebuffer_completeness_cache_; | 320 framebuffer_completeness_cache_; |
313 | 321 |
314 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 322 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
315 }; | 323 }; |
316 | 324 |
317 } // namespace gpu | 325 } // namespace gpu |
318 | 326 |
319 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 327 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |