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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 DCHECK(feature_info_); | 111 DCHECK(feature_info_); |
| 112 if (!mailbox_manager_.get()) | 112 if (!mailbox_manager_.get()) |
| 113 mailbox_manager_ = new MailboxManagerImpl; | 113 mailbox_manager_ = new MailboxManagerImpl; |
| 114 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); | 114 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool ContextGroup::Initialize(GLES2Decoder* decoder, | 118 bool ContextGroup::Initialize(GLES2Decoder* decoder, |
| 119 ContextType context_type, | 119 ContextType context_type, |
| 120 const DisallowedFeatures& disallowed_features) { | 120 const DisallowedFeatures& disallowed_features) { |
| 121 if (!gpu_preferences_.enable_unsafe_es3_apis) { | |
| 122 if (context_type == CONTEXT_TYPE_OPENGLES3) { | |
| 123 context_type = CONTEXT_TYPE_OPENGLES2; | |
|
Zhenyao Mo
2016/11/02 22:49:57
You should print out a DLOG as the WEBGL2 case. No
| |
| 124 return false; | |
| 125 } else if (context_type == CONTEXT_TYPE_WEBGL2) { | |
| 126 DLOG(ERROR) << "ContextGroup::Initialize failed because WebGL 2 is not " | |
| 127 << "available."; | |
| 128 return false; | |
| 129 } | |
| 130 } | |
| 121 if (HaveContexts()) { | 131 if (HaveContexts()) { |
| 122 if (context_type != feature_info_->context_type()) { | 132 if (context_type != feature_info_->context_type()) { |
| 123 DLOG(ERROR) << "ContextGroup::Initialize failed because the type of " | 133 DLOG(ERROR) << "ContextGroup::Initialize failed because the type of " |
| 124 << "the context does not fit with the group."; | 134 << "the context does not fit with the group."; |
| 125 return false; | 135 return false; |
| 126 } | 136 } |
| 127 // If we've already initialized the group just add the context. | 137 // If we've already initialized the group just add the context. |
| 128 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 138 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
| 129 return true; | 139 return true; |
| 130 } | 140 } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 GLuint client_id, GLuint* service_id) const { | 627 GLuint client_id, GLuint* service_id) const { |
| 618 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 628 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
| 619 if (!buffer) | 629 if (!buffer) |
| 620 return false; | 630 return false; |
| 621 *service_id = buffer->service_id(); | 631 *service_id = buffer->service_id(); |
| 622 return true; | 632 return true; |
| 623 } | 633 } |
| 624 | 634 |
| 625 } // namespace gles2 | 635 } // namespace gles2 |
| 626 } // namespace gpu | 636 } // namespace gpu |
| OLD | NEW |