| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "gpu/command_buffer/common/constants.h" | 17 #include "gpu/command_buffer/common/constants.h" |
| 18 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 19 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 19 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 20 #include "gpu/command_buffer/service/feature_info.h" | 20 #include "gpu/command_buffer/service/feature_info.h" |
| 21 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" | 21 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" |
| 22 #include "gpu/command_buffer/service/gpu_preferences.h" | 22 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 23 #include "gpu/command_buffer/service/shader_translator_cache.h" | 23 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 24 #include "gpu/gpu_export.h" | 24 #include "gpu/gpu_export.h" |
| 25 | 25 |
| 26 namespace gpu { | 26 namespace gpu { |
| 27 | 27 |
| 28 struct GpuPreferences; | 28 struct GpuPreferences; |
| 29 class TransferBufferManager; | 29 class TransferBufferManager; |
| 30 class ValueStateMap; | |
| 31 | 30 |
| 32 namespace gles2 { | 31 namespace gles2 { |
| 33 | 32 |
| 34 class ProgramCache; | 33 class ProgramCache; |
| 35 class BufferManager; | 34 class BufferManager; |
| 36 class GLES2Decoder; | 35 class GLES2Decoder; |
| 37 class FramebufferManager; | 36 class FramebufferManager; |
| 38 class MailboxManager; | 37 class MailboxManager; |
| 39 class RenderbufferManager; | 38 class RenderbufferManager; |
| 40 class PathManager; | 39 class PathManager; |
| 41 class ProgramManager; | 40 class ProgramManager; |
| 42 class SamplerManager; | 41 class SamplerManager; |
| 43 class ShaderManager; | 42 class ShaderManager; |
| 44 class TextureManager; | 43 class TextureManager; |
| 45 class SubscriptionRefSet; | |
| 46 class ValuebufferManager; | |
| 47 class MemoryTracker; | 44 class MemoryTracker; |
| 48 struct DisallowedFeatures; | 45 struct DisallowedFeatures; |
| 49 | 46 |
| 50 // A Context Group helps manage multiple GLES2Decoders that share | 47 // A Context Group helps manage multiple GLES2Decoders that share |
| 51 // resources. | 48 // resources. |
| 52 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 49 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
| 53 public: | 50 public: |
| 54 ContextGroup( | 51 ContextGroup( |
| 55 const GpuPreferences& gpu_preferences, | 52 const GpuPreferences& gpu_preferences, |
| 56 const scoped_refptr<MailboxManager>& mailbox_manager, | 53 const scoped_refptr<MailboxManager>& mailbox_manager, |
| 57 const scoped_refptr<MemoryTracker>& memory_tracker, | 54 const scoped_refptr<MemoryTracker>& memory_tracker, |
| 58 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 55 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
| 59 const scoped_refptr<FramebufferCompletenessCache>& | 56 const scoped_refptr<FramebufferCompletenessCache>& |
| 60 framebuffer_completeness_cache, | 57 framebuffer_completeness_cache, |
| 61 const scoped_refptr<FeatureInfo>& feature_info, | 58 const scoped_refptr<FeatureInfo>& feature_info, |
| 62 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, | |
| 63 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, | |
| 64 bool bind_generates_resource); | 59 bool bind_generates_resource); |
| 65 | 60 |
| 66 // This should only be called by GLES2Decoder. This must be paired with a | 61 // This should only be called by GLES2Decoder. This must be paired with a |
| 67 // call to destroy if it succeeds. | 62 // call to destroy if it succeeds. |
| 68 bool Initialize( | 63 bool Initialize( |
| 69 GLES2Decoder* decoder, | 64 GLES2Decoder* decoder, |
| 70 ContextType context_type, | 65 ContextType context_type, |
| 71 const DisallowedFeatures& disallowed_features); | 66 const DisallowedFeatures& disallowed_features); |
| 72 | 67 |
| 73 // Destroys all the resources when called for the last context in the group. | 68 // Destroys all the resources when called for the last context in the group. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 142 } |
| 148 | 143 |
| 149 FramebufferManager* framebuffer_manager() const { | 144 FramebufferManager* framebuffer_manager() const { |
| 150 return framebuffer_manager_.get(); | 145 return framebuffer_manager_.get(); |
| 151 } | 146 } |
| 152 | 147 |
| 153 RenderbufferManager* renderbuffer_manager() const { | 148 RenderbufferManager* renderbuffer_manager() const { |
| 154 return renderbuffer_manager_.get(); | 149 return renderbuffer_manager_.get(); |
| 155 } | 150 } |
| 156 | 151 |
| 157 ValuebufferManager* valuebuffer_manager() const { | |
| 158 return valuebuffer_manager_.get(); | |
| 159 } | |
| 160 | |
| 161 ValueStateMap* pending_valuebuffer_state() const { | |
| 162 return pending_valuebuffer_state_.get(); | |
| 163 } | |
| 164 | |
| 165 TextureManager* texture_manager() const { | 152 TextureManager* texture_manager() const { |
| 166 return texture_manager_.get(); | 153 return texture_manager_.get(); |
| 167 } | 154 } |
| 168 | 155 |
| 169 PathManager* path_manager() const { return path_manager_.get(); } | 156 PathManager* path_manager() const { return path_manager_.get(); } |
| 170 | 157 |
| 171 ProgramManager* program_manager() const { | 158 ProgramManager* program_manager() const { |
| 172 return program_manager_.get(); | 159 return program_manager_.get(); |
| 173 } | 160 } |
| 174 | 161 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 238 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
| 252 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); | 239 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); |
| 253 bool HaveContexts(); | 240 bool HaveContexts(); |
| 254 | 241 |
| 255 const GpuPreferences& gpu_preferences_; | 242 const GpuPreferences& gpu_preferences_; |
| 256 scoped_refptr<MailboxManager> mailbox_manager_; | 243 scoped_refptr<MailboxManager> mailbox_manager_; |
| 257 scoped_refptr<MemoryTracker> memory_tracker_; | 244 scoped_refptr<MemoryTracker> memory_tracker_; |
| 258 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; | 245 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; |
| 259 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; | 246 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; |
| 260 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; | 247 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; |
| 261 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; | |
| 262 scoped_refptr<ValueStateMap> pending_valuebuffer_state_; | |
| 263 | 248 |
| 264 bool enforce_gl_minimums_; | 249 bool enforce_gl_minimums_; |
| 265 bool bind_generates_resource_; | 250 bool bind_generates_resource_; |
| 266 | 251 |
| 267 uint32_t max_vertex_attribs_; | 252 uint32_t max_vertex_attribs_; |
| 268 uint32_t max_texture_units_; | 253 uint32_t max_texture_units_; |
| 269 uint32_t max_texture_image_units_; | 254 uint32_t max_texture_image_units_; |
| 270 uint32_t max_vertex_texture_image_units_; | 255 uint32_t max_vertex_texture_image_units_; |
| 271 uint32_t max_fragment_uniform_vectors_; | 256 uint32_t max_fragment_uniform_vectors_; |
| 272 uint32_t max_varying_vectors_; | 257 uint32_t max_varying_vectors_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 291 std::unique_ptr<TextureManager> texture_manager_; | 276 std::unique_ptr<TextureManager> texture_manager_; |
| 292 | 277 |
| 293 std::unique_ptr<PathManager> path_manager_; | 278 std::unique_ptr<PathManager> path_manager_; |
| 294 | 279 |
| 295 std::unique_ptr<ProgramManager> program_manager_; | 280 std::unique_ptr<ProgramManager> program_manager_; |
| 296 | 281 |
| 297 std::unique_ptr<ShaderManager> shader_manager_; | 282 std::unique_ptr<ShaderManager> shader_manager_; |
| 298 | 283 |
| 299 std::unique_ptr<SamplerManager> sampler_manager_; | 284 std::unique_ptr<SamplerManager> sampler_manager_; |
| 300 | 285 |
| 301 std::unique_ptr<ValuebufferManager> valuebuffer_manager_; | |
| 302 | |
| 303 scoped_refptr<FeatureInfo> feature_info_; | 286 scoped_refptr<FeatureInfo> feature_info_; |
| 304 | 287 |
| 305 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; | 288 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; |
| 306 | 289 |
| 307 // Mappings from client side IDs to service side IDs. | 290 // Mappings from client side IDs to service side IDs. |
| 308 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; | 291 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; |
| 309 base::hash_map<GLuint, GLsync> syncs_id_map_; | 292 base::hash_map<GLuint, GLsync> syncs_id_map_; |
| 310 | 293 |
| 311 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 294 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
| 312 }; | 295 }; |
| 313 | 296 |
| 314 } // namespace gles2 | 297 } // namespace gles2 |
| 315 } // namespace gpu | 298 } // namespace gpu |
| 316 | 299 |
| 317 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 300 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
| OLD | NEW |