| 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" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 17 #include "gpu/command_buffer/service/feature_info.h" | 17 #include "gpu/command_buffer/service/feature_info.h" |
| 18 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 18 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| 19 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 19 #include "gpu/gpu_export.h" | 20 #include "gpu/gpu_export.h" |
| 20 | 21 |
| 21 namespace gpu { | 22 namespace gpu { |
| 22 | 23 |
| 23 class IdAllocatorInterface; | 24 class IdAllocatorInterface; |
| 24 class TransferBufferManagerInterface; | 25 class TransferBufferManagerInterface; |
| 25 | 26 |
| 26 namespace gles2 { | 27 namespace gles2 { |
| 27 | 28 |
| 28 class ProgramCache; | 29 class ProgramCache; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 struct DisallowedFeatures; | 40 struct DisallowedFeatures; |
| 40 | 41 |
| 41 // A Context Group helps manage multiple GLES2Decoders that share | 42 // A Context Group helps manage multiple GLES2Decoders that share |
| 42 // resources. | 43 // resources. |
| 43 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 44 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
| 44 public: | 45 public: |
| 45 ContextGroup( | 46 ContextGroup( |
| 46 MailboxManager* mailbox_manager, | 47 MailboxManager* mailbox_manager, |
| 47 ImageManager* image_manager, | 48 ImageManager* image_manager, |
| 48 MemoryTracker* memory_tracker, | 49 MemoryTracker* memory_tracker, |
| 50 ShaderTranslatorCache* shader_translator_cache, |
| 49 FeatureInfo* feature_info, | 51 FeatureInfo* feature_info, |
| 50 bool bind_generates_resource); | 52 bool bind_generates_resource); |
| 51 | 53 |
| 52 // This should only be called by GLES2Decoder. This must be paired with a | 54 // This should only be called by GLES2Decoder. This must be paired with a |
| 53 // call to destroy if it succeeds. | 55 // call to destroy if it succeeds. |
| 54 bool Initialize( | 56 bool Initialize( |
| 55 GLES2Decoder* decoder, | 57 GLES2Decoder* decoder, |
| 56 const DisallowedFeatures& disallowed_features); | 58 const DisallowedFeatures& disallowed_features); |
| 57 | 59 |
| 58 // Destroys all the resources when called for the last context in the group. | 60 // Destroys all the resources when called for the last context in the group. |
| 59 // It should only be called by GLES2Decoder. | 61 // It should only be called by GLES2Decoder. |
| 60 void Destroy(GLES2Decoder* decoder, bool have_context); | 62 void Destroy(GLES2Decoder* decoder, bool have_context); |
| 61 | 63 |
| 62 MailboxManager* mailbox_manager() const { | 64 MailboxManager* mailbox_manager() const { |
| 63 return mailbox_manager_.get(); | 65 return mailbox_manager_.get(); |
| 64 } | 66 } |
| 65 | 67 |
| 66 ImageManager* image_manager() const { | 68 ImageManager* image_manager() const { |
| 67 return image_manager_.get(); | 69 return image_manager_.get(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 MemoryTracker* memory_tracker() const { | 72 MemoryTracker* memory_tracker() const { |
| 71 return memory_tracker_.get(); | 73 return memory_tracker_.get(); |
| 72 } | 74 } |
| 73 | 75 |
| 76 ShaderTranslatorCache* shader_translator_cache() const { |
| 77 return shader_translator_cache_.get(); |
| 78 } |
| 79 |
| 74 bool bind_generates_resource() { | 80 bool bind_generates_resource() { |
| 75 return bind_generates_resource_; | 81 return bind_generates_resource_; |
| 76 } | 82 } |
| 77 | 83 |
| 78 uint32 max_vertex_attribs() const { | 84 uint32 max_vertex_attribs() const { |
| 79 return max_vertex_attribs_; | 85 return max_vertex_attribs_; |
| 80 } | 86 } |
| 81 | 87 |
| 82 uint32 max_texture_units() const { | 88 uint32 max_texture_units() const { |
| 83 return max_texture_units_; | 89 return max_texture_units_; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 178 |
| 173 bool CheckGLFeature(GLint min_required, GLint* v); | 179 bool CheckGLFeature(GLint min_required, GLint* v); |
| 174 bool CheckGLFeatureU(GLint min_required, uint32* v); | 180 bool CheckGLFeatureU(GLint min_required, uint32* v); |
| 175 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 181 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
| 176 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 182 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
| 177 bool HaveContexts(); | 183 bool HaveContexts(); |
| 178 | 184 |
| 179 scoped_refptr<MailboxManager> mailbox_manager_; | 185 scoped_refptr<MailboxManager> mailbox_manager_; |
| 180 scoped_refptr<ImageManager> image_manager_; | 186 scoped_refptr<ImageManager> image_manager_; |
| 181 scoped_refptr<MemoryTracker> memory_tracker_; | 187 scoped_refptr<MemoryTracker> memory_tracker_; |
| 188 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; |
| 182 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 189 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 183 | 190 |
| 184 bool enforce_gl_minimums_; | 191 bool enforce_gl_minimums_; |
| 185 bool bind_generates_resource_; | 192 bool bind_generates_resource_; |
| 186 | 193 |
| 187 uint32 max_vertex_attribs_; | 194 uint32 max_vertex_attribs_; |
| 188 uint32 max_texture_units_; | 195 uint32 max_texture_units_; |
| 189 uint32 max_texture_image_units_; | 196 uint32 max_texture_image_units_; |
| 190 uint32 max_vertex_texture_image_units_; | 197 uint32 max_vertex_texture_image_units_; |
| 191 uint32 max_fragment_uniform_vectors_; | 198 uint32 max_fragment_uniform_vectors_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 219 | 226 |
| 220 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 227 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
| 221 }; | 228 }; |
| 222 | 229 |
| 223 } // namespace gles2 | 230 } // namespace gles2 |
| 224 } // namespace gpu | 231 } // namespace gpu |
| 225 | 232 |
| 226 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 233 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
| 227 | 234 |
| 228 | 235 |
| OLD | NEW |