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, | |
88 const gles2::ContextCreationAttribHelper& attribs, | 87 const gles2::ContextCreationAttribHelper& attribs, |
89 gl::GpuPreference gpu_preference, | |
90 InProcessCommandBuffer* share_group, | 88 InProcessCommandBuffer* share_group, |
91 GpuMemoryBufferManager* gpu_memory_buffer_manager, | 89 GpuMemoryBufferManager* gpu_memory_buffer_manager, |
92 ImageFactory* image_factory); | 90 ImageFactory* image_factory); |
93 | 91 |
94 // CommandBuffer implementation: | 92 // CommandBuffer implementation: |
95 State GetLastState() override; | 93 State GetLastState() override; |
96 int32_t GetLastToken() override; | 94 int32_t GetLastToken() override; |
97 void Flush(int32_t put_offset) override; | 95 void Flush(int32_t put_offset) override; |
98 void OrderingBarrier(int32_t put_offset) override; | 96 void OrderingBarrier(int32_t put_offset) override; |
99 void WaitForTokenInRange(int32_t start, int32_t end) override; | 97 void WaitForTokenInRange(int32_t start, int32_t end) override; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; | 164 const GpuDriverBugWorkarounds gpu_driver_bug_workarounds_; |
167 scoped_refptr<gl::GLShareGroup> share_group_; | 165 scoped_refptr<gl::GLShareGroup> share_group_; |
168 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 166 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
169 std::unique_ptr<gpu::gles2::ProgramCache> program_cache_; | 167 std::unique_ptr<gpu::gles2::ProgramCache> program_cache_; |
170 }; | 168 }; |
171 | 169 |
172 private: | 170 private: |
173 struct InitializeOnGpuThreadParams { | 171 struct InitializeOnGpuThreadParams { |
174 bool is_offscreen; | 172 bool is_offscreen; |
175 gfx::AcceleratedWidget window; | 173 gfx::AcceleratedWidget window; |
176 const gfx::Size& size; | |
177 const gles2::ContextCreationAttribHelper& attribs; | 174 const gles2::ContextCreationAttribHelper& attribs; |
178 gl::GpuPreference gpu_preference; | |
179 gpu::Capabilities* capabilities; // Ouptut. | 175 gpu::Capabilities* capabilities; // Ouptut. |
180 InProcessCommandBuffer* context_group; | 176 InProcessCommandBuffer* context_group; |
181 ImageFactory* image_factory; | 177 ImageFactory* image_factory; |
182 | 178 |
183 InitializeOnGpuThreadParams( | 179 InitializeOnGpuThreadParams( |
184 bool is_offscreen, | 180 bool is_offscreen, |
185 gfx::AcceleratedWidget window, | 181 gfx::AcceleratedWidget window, |
186 const gfx::Size& size, | |
187 const gles2::ContextCreationAttribHelper& attribs, | 182 const gles2::ContextCreationAttribHelper& attribs, |
188 gl::GpuPreference gpu_preference, | |
189 gpu::Capabilities* capabilities, | 183 gpu::Capabilities* capabilities, |
190 InProcessCommandBuffer* share_group, | 184 InProcessCommandBuffer* share_group, |
191 ImageFactory* image_factory) | 185 ImageFactory* image_factory) |
192 : is_offscreen(is_offscreen), | 186 : is_offscreen(is_offscreen), |
193 window(window), | 187 window(window), |
194 size(size), | |
195 attribs(attribs), | 188 attribs(attribs), |
196 gpu_preference(gpu_preference), | |
197 capabilities(capabilities), | 189 capabilities(capabilities), |
198 context_group(share_group), | 190 context_group(share_group), |
199 image_factory(image_factory) {} | 191 image_factory(image_factory) {} |
200 }; | 192 }; |
201 | 193 |
202 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); | 194 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); |
203 void Destroy(); | 195 void Destroy(); |
204 bool DestroyOnGpuThread(); | 196 bool DestroyOnGpuThread(); |
205 void FlushOnGpuThread(int32_t put_offset, uint32_t order_num); | 197 void FlushOnGpuThread(int32_t put_offset, uint32_t order_num); |
206 void ScheduleDelayedWorkOnGpuThread(); | 198 void ScheduleDelayedWorkOnGpuThread(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; | 310 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; |
319 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> | 311 scoped_refptr<gpu::gles2::FramebufferCompletenessCache> |
320 framebuffer_completeness_cache_; | 312 framebuffer_completeness_cache_; |
321 | 313 |
322 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); | 314 DISALLOW_COPY_AND_ASSIGN(GpuInProcessThread); |
323 }; | 315 }; |
324 | 316 |
325 } // namespace gpu | 317 } // namespace gpu |
326 | 318 |
327 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 319 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
OLD | NEW |