| 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 #include "gpu/command_buffer/service/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "gpu/command_buffer/common/value_state.h" | 14 #include "gpu/command_buffer/common/value_state.h" |
| 15 #include "gpu/command_buffer/service/buffer_manager.h" | 15 #include "gpu/command_buffer/service/buffer_manager.h" |
| 16 #include "gpu/command_buffer/service/framebuffer_manager.h" | 16 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 17 #include "gpu/command_buffer/service/gpu_switches.h" | 17 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 18 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 18 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
| 19 #include "gpu/command_buffer/service/path_manager.h" | 19 #include "gpu/command_buffer/service/path_manager.h" |
| 20 #include "gpu/command_buffer/service/program_manager.h" | 20 #include "gpu/command_buffer/service/program_manager.h" |
| 21 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 21 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
| 22 #include "gpu/command_buffer/service/sampler_manager.h" | 22 #include "gpu/command_buffer/service/sampler_manager.h" |
| 23 #include "gpu/command_buffer/service/shader_manager.h" | 23 #include "gpu/command_buffer/service/shader_manager.h" |
| 24 #include "gpu/command_buffer/service/texture_manager.h" | 24 #include "gpu/command_buffer/service/texture_manager.h" |
| 25 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 25 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 26 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 26 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
| 27 #include "ui/gl/gl_bindings.h" | 27 #include "ui/gl/gl_bindings.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 adjusted_disallowed_features.chromium_color_buffer_float_rgb = true; | 51 adjusted_disallowed_features.chromium_color_buffer_float_rgb = true; |
| 52 adjusted_disallowed_features.ext_color_buffer_float = true; | 52 adjusted_disallowed_features.ext_color_buffer_float = true; |
| 53 adjusted_disallowed_features.oes_texture_float_linear = true; | 53 adjusted_disallowed_features.oes_texture_float_linear = true; |
| 54 } | 54 } |
| 55 return adjusted_disallowed_features; | 55 return adjusted_disallowed_features; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace anonymous | 58 } // namespace anonymous |
| 59 | 59 |
| 60 ContextGroup::ContextGroup( | 60 ContextGroup::ContextGroup( |
| 61 const GpuPreferences& gpu_preferences, |
| 61 const scoped_refptr<MailboxManager>& mailbox_manager, | 62 const scoped_refptr<MailboxManager>& mailbox_manager, |
| 62 const scoped_refptr<MemoryTracker>& memory_tracker, | 63 const scoped_refptr<MemoryTracker>& memory_tracker, |
| 63 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 64 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
| 64 const scoped_refptr<FramebufferCompletenessCache>& | 65 const scoped_refptr<FramebufferCompletenessCache>& |
| 65 framebuffer_completeness_cache, | 66 framebuffer_completeness_cache, |
| 66 const scoped_refptr<FeatureInfo>& feature_info, | 67 const scoped_refptr<FeatureInfo>& feature_info, |
| 67 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, | 68 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, |
| 68 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, | 69 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, |
| 69 bool bind_generates_resource) | 70 bool bind_generates_resource) |
| 70 : mailbox_manager_(mailbox_manager), | 71 : gpu_preferences_(gpu_preferences), |
| 72 mailbox_manager_(mailbox_manager), |
| 71 memory_tracker_(memory_tracker), | 73 memory_tracker_(memory_tracker), |
| 72 shader_translator_cache_(shader_translator_cache), | 74 shader_translator_cache_(shader_translator_cache), |
| 73 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
| 74 // Framebuffer completeness is not cacheable on OS X because of dynamic | 76 // Framebuffer completeness is not cacheable on OS X because of dynamic |
| 75 // graphics switching. | 77 // graphics switching. |
| 76 // http://crbug.com/180876 | 78 // http://crbug.com/180876 |
| 77 // TODO(tobiasjs): determine whether GPU switching is possible | 79 // TODO(tobiasjs): determine whether GPU switching is possible |
| 78 // programmatically, rather than just hardcoding this behaviour | 80 // programmatically, rather than just hardcoding this behaviour |
| 79 // for OS X. | 81 // for OS X. |
| 80 framebuffer_completeness_cache_(NULL), | 82 framebuffer_completeness_cache_(NULL), |
| 81 #else | 83 #else |
| 82 framebuffer_completeness_cache_(framebuffer_completeness_cache), | 84 framebuffer_completeness_cache_(framebuffer_completeness_cache), |
| 83 #endif | 85 #endif |
| 84 subscription_ref_set_(subscription_ref_set), | 86 subscription_ref_set_(subscription_ref_set), |
| 85 pending_valuebuffer_state_(pending_valuebuffer_state), | 87 pending_valuebuffer_state_(pending_valuebuffer_state), |
| 86 enforce_gl_minimums_( | 88 enforce_gl_minimums_(gpu_preferences_.enforce_gl_minimums), |
| 87 base::CommandLine::InitializedForCurrentProcess() | |
| 88 ? base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 89 switches::kEnforceGLMinimums) | |
| 90 : false), | |
| 91 bind_generates_resource_(bind_generates_resource), | 89 bind_generates_resource_(bind_generates_resource), |
| 92 max_vertex_attribs_(0u), | 90 max_vertex_attribs_(0u), |
| 93 max_texture_units_(0u), | 91 max_texture_units_(0u), |
| 94 max_texture_image_units_(0u), | 92 max_texture_image_units_(0u), |
| 95 max_vertex_texture_image_units_(0u), | 93 max_vertex_texture_image_units_(0u), |
| 96 max_fragment_uniform_vectors_(0u), | 94 max_fragment_uniform_vectors_(0u), |
| 97 max_varying_vectors_(0u), | 95 max_varying_vectors_(0u), |
| 98 max_vertex_uniform_vectors_(0u), | 96 max_vertex_uniform_vectors_(0u), |
| 99 max_color_attachments_(1u), | 97 max_color_attachments_(1u), |
| 100 max_draw_buffers_(1u), | 98 max_draw_buffers_(1u), |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 max_vertex_uniform_vectors_ = | 338 max_vertex_uniform_vectors_ = |
| 341 std::min(max_vertex_uniform_vectors_, | 339 std::min(max_vertex_uniform_vectors_, |
| 342 static_cast<uint32_t>( | 340 static_cast<uint32_t>( |
| 343 feature_info_->workarounds().max_vertex_uniform_vectors)); | 341 feature_info_->workarounds().max_vertex_uniform_vectors)); |
| 344 } | 342 } |
| 345 | 343 |
| 346 path_manager_.reset(new PathManager()); | 344 path_manager_.reset(new PathManager()); |
| 347 | 345 |
| 348 program_manager_.reset( | 346 program_manager_.reset( |
| 349 new ProgramManager(program_cache_, max_varying_vectors_, | 347 new ProgramManager(program_cache_, max_varying_vectors_, |
| 350 max_dual_source_draw_buffers_, feature_info_.get())); | 348 max_dual_source_draw_buffers_, gpu_preferences_, |
| 349 feature_info_.get())); |
| 351 | 350 |
| 352 if (!texture_manager_->Initialize()) { | 351 if (!texture_manager_->Initialize()) { |
| 353 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " | 352 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " |
| 354 << "failed to initialize."; | 353 << "failed to initialize."; |
| 355 return false; | 354 return false; |
| 356 } | 355 } |
| 357 | 356 |
| 358 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 357 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
| 359 return true; | 358 return true; |
| 360 } | 359 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 GLuint client_id, GLuint* service_id) const { | 507 GLuint client_id, GLuint* service_id) const { |
| 509 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 508 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
| 510 if (!buffer) | 509 if (!buffer) |
| 511 return false; | 510 return false; |
| 512 *service_id = buffer->service_id(); | 511 *service_id = buffer->service_id(); |
| 513 return true; | 512 return true; |
| 514 } | 513 } |
| 515 | 514 |
| 516 } // namespace gles2 | 515 } // namespace gles2 |
| 517 } // namespace gpu | 516 } // namespace gpu |
| OLD | NEW |