Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 bind_generates_resource_(bind_generates_resource), | 61 bind_generates_resource_(bind_generates_resource), |
| 62 max_vertex_attribs_(0u), | 62 max_vertex_attribs_(0u), |
| 63 max_texture_units_(0u), | 63 max_texture_units_(0u), |
| 64 max_texture_image_units_(0u), | 64 max_texture_image_units_(0u), |
| 65 max_vertex_texture_image_units_(0u), | 65 max_vertex_texture_image_units_(0u), |
| 66 max_fragment_uniform_vectors_(0u), | 66 max_fragment_uniform_vectors_(0u), |
| 67 max_varying_vectors_(0u), | 67 max_varying_vectors_(0u), |
| 68 max_vertex_uniform_vectors_(0u), | 68 max_vertex_uniform_vectors_(0u), |
| 69 max_color_attachments_(1u), | 69 max_color_attachments_(1u), |
| 70 max_draw_buffers_(1u), | 70 max_draw_buffers_(1u), |
| 71 max_dual_source_draw_buffers_(0u), | |
| 71 program_cache_(NULL), | 72 program_cache_(NULL), |
| 72 feature_info_(feature_info) { | 73 feature_info_(feature_info) { |
| 73 { | 74 { |
| 74 if (!mailbox_manager_.get()) | 75 if (!mailbox_manager_.get()) |
| 75 mailbox_manager_ = new MailboxManagerImpl; | 76 mailbox_manager_ = new MailboxManagerImpl; |
| 76 if (!subscription_ref_set_.get()) | 77 if (!subscription_ref_set_.get()) |
| 77 subscription_ref_set_ = new SubscriptionRefSet(); | 78 subscription_ref_set_ = new SubscriptionRefSet(); |
| 78 if (!pending_valuebuffer_state_.get()) | 79 if (!pending_valuebuffer_state_.get()) |
| 79 pending_valuebuffer_state_ = new ValueStateMap(); | 80 pending_valuebuffer_state_ = new ValueStateMap(); |
| 80 if (!feature_info.get()) | 81 if (!feature_info.get()) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 } | 137 } |
| 137 | 138 |
| 138 if (feature_info_->feature_flags().ext_draw_buffers) { | 139 if (feature_info_->feature_flags().ext_draw_buffers) { |
| 139 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); | 140 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); |
| 140 if (max_color_attachments_ < 1) | 141 if (max_color_attachments_ < 1) |
| 141 max_color_attachments_ = 1; | 142 max_color_attachments_ = 1; |
| 142 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); | 143 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); |
| 143 if (max_draw_buffers_ < 1) | 144 if (max_draw_buffers_ < 1) |
| 144 max_draw_buffers_ = 1; | 145 max_draw_buffers_ = 1; |
| 145 } | 146 } |
| 147 if (feature_info_->feature_flags().ext_blend_func_extended) { | |
| 148 GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, | |
|
Zhenyao Mo
2015/08/31 21:12:30
GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT, or on some ma
Kimmo Kinnunen
2015/09/24 13:16:27
Done.
| |
| 149 &max_dual_source_draw_buffers_); | |
| 150 DCHECK(max_dual_source_draw_buffers_ >= 1); | |
| 151 } | |
| 146 | 152 |
| 147 buffer_manager_.reset( | 153 buffer_manager_.reset( |
| 148 new BufferManager(memory_tracker_.get(), feature_info_.get())); | 154 new BufferManager(memory_tracker_.get(), feature_info_.get())); |
| 149 framebuffer_manager_.reset( | 155 framebuffer_manager_.reset( |
| 150 new FramebufferManager(max_draw_buffers_, max_color_attachments_, | 156 new FramebufferManager(max_draw_buffers_, max_color_attachments_, |
| 151 context_type, framebuffer_completeness_cache_)); | 157 context_type, framebuffer_completeness_cache_)); |
| 152 renderbuffer_manager_.reset(new RenderbufferManager( | 158 renderbuffer_manager_.reset(new RenderbufferManager( |
| 153 memory_tracker_.get(), max_renderbuffer_size, max_samples, | 159 memory_tracker_.get(), max_renderbuffer_size, max_samples, |
| 154 feature_info_.get())); | 160 feature_info_.get())); |
| 155 shader_manager_.reset(new ShaderManager()); | 161 shader_manager_.reset(new ShaderManager()); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 } | 288 } |
| 283 if (feature_info_->workarounds().max_vertex_uniform_vectors) { | 289 if (feature_info_->workarounds().max_vertex_uniform_vectors) { |
| 284 max_vertex_uniform_vectors_ = | 290 max_vertex_uniform_vectors_ = |
| 285 std::min(max_vertex_uniform_vectors_, | 291 std::min(max_vertex_uniform_vectors_, |
| 286 static_cast<uint32>( | 292 static_cast<uint32>( |
| 287 feature_info_->workarounds().max_vertex_uniform_vectors)); | 293 feature_info_->workarounds().max_vertex_uniform_vectors)); |
| 288 } | 294 } |
| 289 | 295 |
| 290 path_manager_.reset(new PathManager()); | 296 path_manager_.reset(new PathManager()); |
| 291 | 297 |
| 292 program_manager_.reset(new ProgramManager( | 298 program_manager_.reset( |
| 293 program_cache_, max_varying_vectors_, feature_info_.get())); | 299 new ProgramManager(program_cache_, max_varying_vectors_, |
| 300 max_dual_source_draw_buffers_, feature_info_.get())); | |
| 294 | 301 |
| 295 if (!texture_manager_->Initialize()) { | 302 if (!texture_manager_->Initialize()) { |
| 296 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " | 303 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " |
| 297 << "failed to initialize."; | 304 << "failed to initialize."; |
| 298 return false; | 305 return false; |
| 299 } | 306 } |
| 300 | 307 |
| 301 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 308 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
| 302 return true; | 309 return true; |
| 303 } | 310 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 GLuint client_id, GLuint* service_id) const { | 452 GLuint client_id, GLuint* service_id) const { |
| 446 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 453 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
| 447 if (!buffer) | 454 if (!buffer) |
| 448 return false; | 455 return false; |
| 449 *service_id = buffer->service_id(); | 456 *service_id = buffer->service_id(); |
| 450 return true; | 457 return true; |
| 451 } | 458 } |
| 452 | 459 |
| 453 } // namespace gles2 | 460 } // namespace gles2 |
| 454 } // namespace gpu | 461 } // namespace gpu |
| OLD | NEW |