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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 } | 138 } |
138 | 139 |
139 if (feature_info_->feature_flags().ext_draw_buffers) { | 140 if (feature_info_->feature_flags().ext_draw_buffers) { |
140 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); | 141 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); |
141 if (max_color_attachments_ < 1) | 142 if (max_color_attachments_ < 1) |
142 max_color_attachments_ = 1; | 143 max_color_attachments_ = 1; |
143 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); | 144 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); |
144 if (max_draw_buffers_ < 1) | 145 if (max_draw_buffers_ < 1) |
145 max_draw_buffers_ = 1; | 146 max_draw_buffers_ = 1; |
146 } | 147 } |
148 if (feature_info_->feature_flags().ext_blend_func_extended) { | |
149 GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, | |
150 &max_dual_source_draw_buffers_); | |
151 if (max_dual_source_draw_buffers_ < 1) | |
152 max_dual_source_draw_buffers_ = 0; | |
Mark Kilgard
2015/08/28 19:53:24
Context: just to set expectations, the value of GL
| |
153 } | |
147 | 154 |
148 buffer_manager_.reset( | 155 buffer_manager_.reset( |
149 new BufferManager(memory_tracker_.get(), feature_info_.get())); | 156 new BufferManager(memory_tracker_.get(), feature_info_.get())); |
150 framebuffer_manager_.reset( | 157 framebuffer_manager_.reset( |
151 new FramebufferManager(max_draw_buffers_, max_color_attachments_, | 158 new FramebufferManager(max_draw_buffers_, max_color_attachments_, |
152 context_type, framebuffer_completeness_cache_)); | 159 context_type, framebuffer_completeness_cache_)); |
153 renderbuffer_manager_.reset(new RenderbufferManager( | 160 renderbuffer_manager_.reset(new RenderbufferManager( |
154 memory_tracker_.get(), max_renderbuffer_size, max_samples, | 161 memory_tracker_.get(), max_renderbuffer_size, max_samples, |
155 feature_info_.get())); | 162 feature_info_.get())); |
156 shader_manager_.reset(new ShaderManager()); | 163 shader_manager_.reset(new ShaderManager()); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 } | 290 } |
284 if (feature_info_->workarounds().max_vertex_uniform_vectors) { | 291 if (feature_info_->workarounds().max_vertex_uniform_vectors) { |
285 max_vertex_uniform_vectors_ = | 292 max_vertex_uniform_vectors_ = |
286 std::min(max_vertex_uniform_vectors_, | 293 std::min(max_vertex_uniform_vectors_, |
287 static_cast<uint32>( | 294 static_cast<uint32>( |
288 feature_info_->workarounds().max_vertex_uniform_vectors)); | 295 feature_info_->workarounds().max_vertex_uniform_vectors)); |
289 } | 296 } |
290 | 297 |
291 path_manager_.reset(new PathManager()); | 298 path_manager_.reset(new PathManager()); |
292 | 299 |
293 program_manager_.reset(new ProgramManager( | 300 program_manager_.reset( |
294 program_cache_, max_varying_vectors_, feature_info_.get())); | 301 new ProgramManager(program_cache_, max_varying_vectors_, |
302 max_dual_source_draw_buffers_, feature_info_.get())); | |
295 | 303 |
296 if (!texture_manager_->Initialize()) { | 304 if (!texture_manager_->Initialize()) { |
297 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " | 305 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " |
298 << "failed to initialize."; | 306 << "failed to initialize."; |
299 return false; | 307 return false; |
300 } | 308 } |
301 | 309 |
302 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 310 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
303 return true; | 311 return true; |
304 } | 312 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 GLuint client_id, GLuint* service_id) const { | 454 GLuint client_id, GLuint* service_id) const { |
447 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 455 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
448 if (!buffer) | 456 if (!buffer) |
449 return false; | 457 return false; |
450 *service_id = buffer->service_id(); | 458 *service_id = buffer->service_id(); |
451 return true; | 459 return true; |
452 } | 460 } |
453 | 461 |
454 } // namespace gles2 | 462 } // namespace gles2 |
455 } // namespace gpu | 463 } // namespace gpu |
OLD | NEW |