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_SERVICE_CONTEXT_GROUP_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 23 matching lines...) Expand all Loading... | |
34 class BufferManager; | 34 class BufferManager; |
35 class GLES2Decoder; | 35 class GLES2Decoder; |
36 class FramebufferManager; | 36 class FramebufferManager; |
37 class MailboxManager; | 37 class MailboxManager; |
38 class RenderbufferManager; | 38 class RenderbufferManager; |
39 class PathManager; | 39 class PathManager; |
40 class ProgramManager; | 40 class ProgramManager; |
41 class SamplerManager; | 41 class SamplerManager; |
42 class ShaderManager; | 42 class ShaderManager; |
43 class TextureManager; | 43 class TextureManager; |
44 class TransformFeedbackManager; | |
44 class MemoryTracker; | 45 class MemoryTracker; |
45 struct DisallowedFeatures; | 46 struct DisallowedFeatures; |
46 | 47 |
47 // A Context Group helps manage multiple GLES2Decoders that share | 48 // A Context Group helps manage multiple GLES2Decoders that share |
48 // resources. | 49 // resources. |
49 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 50 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
50 public: | 51 public: |
51 ContextGroup( | 52 ContextGroup( |
52 const GpuPreferences& gpu_preferences, | 53 const GpuPreferences& gpu_preferences, |
53 const scoped_refptr<MailboxManager>& mailbox_manager, | 54 const scoped_refptr<MailboxManager>& mailbox_manager, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 } | 185 } |
185 | 186 |
186 TransferBufferManager* transfer_buffer_manager() const { | 187 TransferBufferManager* transfer_buffer_manager() const { |
187 return transfer_buffer_manager_.get(); | 188 return transfer_buffer_manager_.get(); |
188 } | 189 } |
189 | 190 |
190 SamplerManager* sampler_manager() const { | 191 SamplerManager* sampler_manager() const { |
191 return sampler_manager_.get(); | 192 return sampler_manager_.get(); |
192 } | 193 } |
193 | 194 |
195 TransformFeedbackManager* transform_feedback_manager() const { | |
196 return transform_feedback_manager_.get(); | |
197 } | |
198 | |
194 uint32_t GetMemRepresented() const; | 199 uint32_t GetMemRepresented() const; |
195 | 200 |
196 // Loses all the context associated with this group. | 201 // Loses all the context associated with this group. |
197 void LoseContexts(error::ContextLostReason reason); | 202 void LoseContexts(error::ContextLostReason reason); |
198 | 203 |
199 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; | 204 bool GetBufferServiceId(GLuint client_id, GLuint* service_id) const; |
200 | 205 |
201 void AddTransformFeedbackId(GLuint client_id, GLuint service_id) { | |
202 transformfeedbacks_id_map_[client_id] = service_id; | |
203 } | |
204 | |
205 bool GetTransformFeedbackServiceId( | |
206 GLuint client_id, GLuint* service_id) const { | |
207 if (client_id == 0) { | |
208 // Default one. | |
209 if (service_id) | |
210 *service_id = 0; | |
211 return true; | |
212 } | |
213 base::hash_map<GLuint, GLuint>::const_iterator iter = | |
214 transformfeedbacks_id_map_.find(client_id); | |
215 if (iter == transformfeedbacks_id_map_.end()) | |
216 return false; | |
217 if (service_id) | |
218 *service_id = iter->second; | |
219 return true; | |
220 } | |
221 | |
222 void RemoveTransformFeedbackId(GLuint client_id) { | |
223 transformfeedbacks_id_map_.erase(client_id); | |
224 } | |
225 | |
226 void AddSyncId(GLuint client_id, GLsync service_id) { | 206 void AddSyncId(GLuint client_id, GLsync service_id) { |
227 syncs_id_map_[client_id] = service_id; | 207 syncs_id_map_[client_id] = service_id; |
228 } | 208 } |
229 | 209 |
230 bool GetSyncServiceId(GLuint client_id, GLsync* service_id) const { | 210 bool GetSyncServiceId(GLuint client_id, GLsync* service_id) const { |
231 base::hash_map<GLuint, GLsync>::const_iterator iter = | 211 base::hash_map<GLuint, GLsync>::const_iterator iter = |
232 syncs_id_map_.find(client_id); | 212 syncs_id_map_.find(client_id); |
233 if (iter == syncs_id_map_.end()) | 213 if (iter == syncs_id_map_.end()) |
234 return false; | 214 return false; |
235 if (service_id) | 215 if (service_id) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 std::unique_ptr<TextureManager> texture_manager_; | 272 std::unique_ptr<TextureManager> texture_manager_; |
293 | 273 |
294 std::unique_ptr<PathManager> path_manager_; | 274 std::unique_ptr<PathManager> path_manager_; |
295 | 275 |
296 std::unique_ptr<ProgramManager> program_manager_; | 276 std::unique_ptr<ProgramManager> program_manager_; |
297 | 277 |
298 std::unique_ptr<ShaderManager> shader_manager_; | 278 std::unique_ptr<ShaderManager> shader_manager_; |
299 | 279 |
300 std::unique_ptr<SamplerManager> sampler_manager_; | 280 std::unique_ptr<SamplerManager> sampler_manager_; |
301 | 281 |
282 std::unique_ptr<TransformFeedbackManager> transform_feedback_manager_; | |
piman
2016/04/28 01:38:47
So, actually, transform feedback objects are not s
Zhenyao Mo
2016/04/29 21:07:54
Done.
| |
283 | |
302 scoped_refptr<FeatureInfo> feature_info_; | 284 scoped_refptr<FeatureInfo> feature_info_; |
303 | 285 |
304 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; | 286 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; |
305 | 287 |
306 // Mappings from client side IDs to service side IDs. | 288 // Mappings from client side IDs to service side IDs. |
307 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; | |
308 base::hash_map<GLuint, GLsync> syncs_id_map_; | 289 base::hash_map<GLuint, GLsync> syncs_id_map_; |
309 | 290 |
310 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 291 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
311 }; | 292 }; |
312 | 293 |
313 } // namespace gles2 | 294 } // namespace gles2 |
314 } // namespace gpu | 295 } // namespace gpu |
315 | 296 |
316 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 297 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
OLD | NEW |