| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 14 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 15 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 15 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| 16 #include "gpu/command_buffer/service/feature_info.h" | 16 #include "gpu/command_buffer/service/feature_info.h" |
| 17 #include "gpu/gpu_export.h" | 17 #include "gpu/gpu_export.h" |
| 18 | 18 |
| 19 namespace gpu { | 19 namespace gpu { |
| 20 | 20 |
| 21 class IdAllocatorInterface; | 21 class IdAllocatorInterface; |
| 22 class TransferBufferManagerInterface; |
| 22 | 23 |
| 23 namespace gles2 { | 24 namespace gles2 { |
| 24 | 25 |
| 25 class BufferManager; | 26 class BufferManager; |
| 26 class GLES2Decoder; | 27 class GLES2Decoder; |
| 27 class FramebufferManager; | 28 class FramebufferManager; |
| 28 class MailboxManager; | 29 class MailboxManager; |
| 29 class RenderbufferManager; | 30 class RenderbufferManager; |
| 30 class ProgramManager; | 31 class ProgramManager; |
| 31 class ShaderManager; | 32 class ShaderManager; |
| 32 class TextureManager; | 33 class TextureManager; |
| 33 struct DisallowedFeatures; | 34 struct DisallowedFeatures; |
| 34 | 35 |
| 35 // A Context Group helps manage multiple GLES2Decoders that share | 36 // A Context Group helps manage multiple GLES2Decoders that share |
| 36 // resources. | 37 // resources. |
| 37 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 38 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
| 38 public: | 39 public: |
| 39 typedef scoped_refptr<ContextGroup> Ref; | 40 typedef scoped_refptr<ContextGroup> Ref; |
| 40 | 41 |
| 41 explicit ContextGroup(MailboxManager* mailbox_manager, | 42 ContextGroup( |
| 42 bool bind_generates_resource); | 43 MailboxManager* mailbox_manager, |
| 44 bool bind_generates_resource); |
| 43 | 45 |
| 44 // This should only be called by GLES2Decoder. This must be paired with a | 46 // This should only be called by GLES2Decoder. This must be paired with a |
| 45 // call to destroy if it succeeds. | 47 // call to destroy if it succeeds. |
| 46 bool Initialize(const DisallowedFeatures& disallowed_features, | 48 bool Initialize(const DisallowedFeatures& disallowed_features, |
| 47 const char* allowed_features); | 49 const char* allowed_features); |
| 48 | 50 |
| 49 // Destroys all the resources when called for the last context in the group. | 51 // Destroys all the resources when called for the last context in the group. |
| 50 // It should only be called by GLES2Decoder. | 52 // It should only be called by GLES2Decoder. |
| 51 void Destroy(bool have_context); | 53 void Destroy(bool have_context); |
| 52 | 54 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 109 } |
| 108 | 110 |
| 109 ProgramManager* program_manager() const { | 111 ProgramManager* program_manager() const { |
| 110 return program_manager_.get(); | 112 return program_manager_.get(); |
| 111 } | 113 } |
| 112 | 114 |
| 113 ShaderManager* shader_manager() const { | 115 ShaderManager* shader_manager() const { |
| 114 return shader_manager_.get(); | 116 return shader_manager_.get(); |
| 115 } | 117 } |
| 116 | 118 |
| 119 TransferBufferManagerInterface* transfer_buffer_manager() const { |
| 120 return transfer_buffer_manager_.get(); |
| 121 } |
| 122 |
| 117 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); | 123 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); |
| 118 | 124 |
| 119 private: | 125 private: |
| 120 friend class base::RefCounted<ContextGroup>; | 126 friend class base::RefCounted<ContextGroup>; |
| 121 ~ContextGroup(); | 127 ~ContextGroup(); |
| 122 | 128 |
| 123 bool CheckGLFeature(GLint min_required, GLint* v); | 129 bool CheckGLFeature(GLint min_required, GLint* v); |
| 124 bool CheckGLFeatureU(GLint min_required, uint32* v); | 130 bool CheckGLFeatureU(GLint min_required, uint32* v); |
| 125 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 131 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
| 126 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 132 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
| 127 | 133 |
| 128 scoped_refptr<MailboxManager> mailbox_manager_; | 134 scoped_refptr<MailboxManager> mailbox_manager_; |
| 135 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 129 | 136 |
| 130 // Whether or not this context is initialized. | 137 // Whether or not this context is initialized. |
| 131 int num_contexts_; | 138 int num_contexts_; |
| 132 bool enforce_gl_minimums_; | 139 bool enforce_gl_minimums_; |
| 133 bool bind_generates_resource_; | 140 bool bind_generates_resource_; |
| 134 | 141 |
| 135 uint32 max_vertex_attribs_; | 142 uint32 max_vertex_attribs_; |
| 136 uint32 max_texture_units_; | 143 uint32 max_texture_units_; |
| 137 uint32 max_texture_image_units_; | 144 uint32 max_texture_image_units_; |
| 138 uint32 max_vertex_texture_image_units_; | 145 uint32 max_vertex_texture_image_units_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 159 | 166 |
| 160 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 167 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
| 161 }; | 168 }; |
| 162 | 169 |
| 163 } // namespace gles2 | 170 } // namespace gles2 |
| 164 } // namespace gpu | 171 } // namespace gpu |
| 165 | 172 |
| 166 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 173 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
| 167 | 174 |
| 168 | 175 |
| OLD | NEW |