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