Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 class TextureManager; | 37 class TextureManager; |
| 38 class SubscriptionRefSet; | 38 class SubscriptionRefSet; |
| 39 class ValuebufferManager; | 39 class ValuebufferManager; |
| 40 class MemoryTracker; | 40 class MemoryTracker; |
| 41 struct DisallowedFeatures; | 41 struct DisallowedFeatures; |
| 42 | 42 |
| 43 // A Context Group helps manage multiple GLES2Decoders that share | 43 // A Context Group helps manage multiple GLES2Decoders that share |
| 44 // resources. | 44 // resources. |
| 45 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 45 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
| 46 public: | 46 public: |
| 47 enum ContextType { | |
| 48 kContextTypeWebGL1, | |
|
piman
2015/06/09 02:19:37
nit: CONTEXT_TYPE_WEBGL1 etc. per style guide.
Zhenyao Mo
2015/06/09 03:50:23
Actually the new style guide prefers the constant
| |
| 49 kContextTypeWebGL2, | |
| 50 kContextTypeOther, | |
| 51 kContextTypeUndefined | |
| 52 }; | |
| 53 | |
| 54 static ContextType GetContextType(unsigned webgl_version); | |
| 55 | |
| 47 ContextGroup( | 56 ContextGroup( |
| 48 const scoped_refptr<MailboxManager>& mailbox_manager, | 57 const scoped_refptr<MailboxManager>& mailbox_manager, |
| 49 const scoped_refptr<MemoryTracker>& memory_tracker, | 58 const scoped_refptr<MemoryTracker>& memory_tracker, |
| 50 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 59 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
| 51 const scoped_refptr<FeatureInfo>& feature_info, | 60 const scoped_refptr<FeatureInfo>& feature_info, |
| 52 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, | 61 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, |
| 53 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, | 62 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, |
| 54 bool bind_generates_resource); | 63 bool bind_generates_resource); |
| 55 | 64 |
| 56 // This should only be called by GLES2Decoder. This must be paired with a | 65 // This should only be called by GLES2Decoder. This must be paired with a |
| 57 // call to destroy if it succeeds. | 66 // call to destroy if it succeeds. |
| 58 bool Initialize( | 67 bool Initialize( |
| 59 GLES2Decoder* decoder, | 68 GLES2Decoder* decoder, |
| 69 ContextType context_type, | |
| 60 const DisallowedFeatures& disallowed_features); | 70 const DisallowedFeatures& disallowed_features); |
| 61 | 71 |
| 62 // Destroys all the resources when called for the last context in the group. | 72 // Destroys all the resources when called for the last context in the group. |
| 63 // It should only be called by GLES2Decoder. | 73 // It should only be called by GLES2Decoder. |
| 64 void Destroy(GLES2Decoder* decoder, bool have_context); | 74 void Destroy(GLES2Decoder* decoder, bool have_context); |
| 65 | 75 |
| 66 MailboxManager* mailbox_manager() const { | 76 MailboxManager* mailbox_manager() const { |
| 67 return mailbox_manager_.get(); | 77 return mailbox_manager_.get(); |
| 68 } | 78 } |
| 69 | 79 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 private: | 252 private: |
| 243 friend class base::RefCounted<ContextGroup>; | 253 friend class base::RefCounted<ContextGroup>; |
| 244 ~ContextGroup(); | 254 ~ContextGroup(); |
| 245 | 255 |
| 246 bool CheckGLFeature(GLint min_required, GLint* v); | 256 bool CheckGLFeature(GLint min_required, GLint* v); |
| 247 bool CheckGLFeatureU(GLint min_required, uint32* v); | 257 bool CheckGLFeatureU(GLint min_required, uint32* v); |
| 248 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 258 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
| 249 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 259 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
| 250 bool HaveContexts(); | 260 bool HaveContexts(); |
| 251 | 261 |
| 262 ContextType context_type_; | |
| 263 | |
| 252 scoped_refptr<MailboxManager> mailbox_manager_; | 264 scoped_refptr<MailboxManager> mailbox_manager_; |
| 253 scoped_refptr<MemoryTracker> memory_tracker_; | 265 scoped_refptr<MemoryTracker> memory_tracker_; |
| 254 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; | 266 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; |
| 255 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 267 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 256 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; | 268 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; |
| 257 scoped_refptr<ValueStateMap> pending_valuebuffer_state_; | 269 scoped_refptr<ValueStateMap> pending_valuebuffer_state_; |
| 258 | 270 |
| 259 bool enforce_gl_minimums_; | 271 bool enforce_gl_minimums_; |
| 260 bool bind_generates_resource_; | 272 bool bind_generates_resource_; |
| 261 | 273 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 | 310 |
| 299 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 311 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
| 300 }; | 312 }; |
| 301 | 313 |
| 302 } // namespace gles2 | 314 } // namespace gles2 |
| 303 } // namespace gpu | 315 } // namespace gpu |
| 304 | 316 |
| 305 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 317 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
| 306 | 318 |
| 307 | 319 |
| OLD | NEW |