| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bind_generates_resource_(bind_generates_resource), | 60 bind_generates_resource_(bind_generates_resource), |
| 61 max_vertex_attribs_(0u), | 61 max_vertex_attribs_(0u), |
| 62 max_texture_units_(0u), | 62 max_texture_units_(0u), |
| 63 max_texture_image_units_(0u), | 63 max_texture_image_units_(0u), |
| 64 max_vertex_texture_image_units_(0u), | 64 max_vertex_texture_image_units_(0u), |
| 65 max_fragment_uniform_vectors_(0u), | 65 max_fragment_uniform_vectors_(0u), |
| 66 max_varying_vectors_(0u), | 66 max_varying_vectors_(0u), |
| 67 max_vertex_uniform_vectors_(0u), | 67 max_vertex_uniform_vectors_(0u), |
| 68 max_color_attachments_(1u), | 68 max_color_attachments_(1u), |
| 69 max_draw_buffers_(1u), | 69 max_draw_buffers_(1u), |
| 70 max_dual_source_draw_buffers_(0u), |
| 70 program_cache_(NULL), | 71 program_cache_(NULL), |
| 71 feature_info_(feature_info) { | 72 feature_info_(feature_info) { |
| 72 { | 73 { |
| 73 if (!mailbox_manager_.get()) | 74 if (!mailbox_manager_.get()) |
| 74 mailbox_manager_ = new MailboxManagerImpl; | 75 mailbox_manager_ = new MailboxManagerImpl; |
| 75 if (!subscription_ref_set_.get()) | 76 if (!subscription_ref_set_.get()) |
| 76 subscription_ref_set_ = new SubscriptionRefSet(); | 77 subscription_ref_set_ = new SubscriptionRefSet(); |
| 77 if (!pending_valuebuffer_state_.get()) | 78 if (!pending_valuebuffer_state_.get()) |
| 78 pending_valuebuffer_state_ = new ValueStateMap(); | 79 pending_valuebuffer_state_ = new ValueStateMap(); |
| 79 if (!feature_info.get()) | 80 if (!feature_info.get()) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 133 } |
| 133 | 134 |
| 134 if (feature_info_->feature_flags().ext_draw_buffers) { | 135 if (feature_info_->feature_flags().ext_draw_buffers) { |
| 135 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); | 136 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); |
| 136 if (max_color_attachments_ < 1) | 137 if (max_color_attachments_ < 1) |
| 137 max_color_attachments_ = 1; | 138 max_color_attachments_ = 1; |
| 138 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); | 139 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); |
| 139 if (max_draw_buffers_ < 1) | 140 if (max_draw_buffers_ < 1) |
| 140 max_draw_buffers_ = 1; | 141 max_draw_buffers_ = 1; |
| 141 } | 142 } |
| 143 if (feature_info_->feature_flags().ext_blend_func_extended) { |
| 144 GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT, |
| 145 &max_dual_source_draw_buffers_); |
| 146 DCHECK(max_dual_source_draw_buffers_ >= 1); |
| 147 } |
| 142 | 148 |
| 143 buffer_manager_.reset( | 149 buffer_manager_.reset( |
| 144 new BufferManager(memory_tracker_.get(), feature_info_.get())); | 150 new BufferManager(memory_tracker_.get(), feature_info_.get())); |
| 145 framebuffer_manager_.reset(new FramebufferManager( | 151 framebuffer_manager_.reset(new FramebufferManager( |
| 146 max_draw_buffers_, max_color_attachments_, feature_info_->context_type(), | 152 max_draw_buffers_, max_color_attachments_, feature_info_->context_type(), |
| 147 framebuffer_completeness_cache_)); | 153 framebuffer_completeness_cache_)); |
| 148 renderbuffer_manager_.reset(new RenderbufferManager( | 154 renderbuffer_manager_.reset(new RenderbufferManager( |
| 149 memory_tracker_.get(), max_renderbuffer_size, max_samples, | 155 memory_tracker_.get(), max_renderbuffer_size, max_samples, |
| 150 feature_info_.get())); | 156 feature_info_.get())); |
| 151 shader_manager_.reset(new ShaderManager()); | 157 shader_manager_.reset(new ShaderManager()); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 284 } |
| 279 if (feature_info_->workarounds().max_vertex_uniform_vectors) { | 285 if (feature_info_->workarounds().max_vertex_uniform_vectors) { |
| 280 max_vertex_uniform_vectors_ = | 286 max_vertex_uniform_vectors_ = |
| 281 std::min(max_vertex_uniform_vectors_, | 287 std::min(max_vertex_uniform_vectors_, |
| 282 static_cast<uint32>( | 288 static_cast<uint32>( |
| 283 feature_info_->workarounds().max_vertex_uniform_vectors)); | 289 feature_info_->workarounds().max_vertex_uniform_vectors)); |
| 284 } | 290 } |
| 285 | 291 |
| 286 path_manager_.reset(new PathManager()); | 292 path_manager_.reset(new PathManager()); |
| 287 | 293 |
| 288 program_manager_.reset(new ProgramManager( | 294 program_manager_.reset( |
| 289 program_cache_, max_varying_vectors_, feature_info_.get())); | 295 new ProgramManager(program_cache_, max_varying_vectors_, |
| 296 max_dual_source_draw_buffers_, feature_info_.get())); |
| 290 | 297 |
| 291 if (!texture_manager_->Initialize()) { | 298 if (!texture_manager_->Initialize()) { |
| 292 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " | 299 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " |
| 293 << "failed to initialize."; | 300 << "failed to initialize."; |
| 294 return false; | 301 return false; |
| 295 } | 302 } |
| 296 | 303 |
| 297 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 304 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
| 298 return true; | 305 return true; |
| 299 } | 306 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 GLuint client_id, GLuint* service_id) const { | 448 GLuint client_id, GLuint* service_id) const { |
| 442 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 449 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
| 443 if (!buffer) | 450 if (!buffer) |
| 444 return false; | 451 return false; |
| 445 *service_id = buffer->service_id(); | 452 *service_id = buffer->service_id(); |
| 446 return true; | 453 return true; |
| 447 } | 454 } |
| 448 | 455 |
| 449 } // namespace gles2 | 456 } // namespace gles2 |
| 450 } // namespace gpu | 457 } // namespace gpu |
| OLD | NEW |