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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 DCHECK(feature_info_); | 113 DCHECK(feature_info_); |
114 if (!mailbox_manager_.get()) | 114 if (!mailbox_manager_.get()) |
115 mailbox_manager_ = new MailboxManagerImpl; | 115 mailbox_manager_ = new MailboxManagerImpl; |
116 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); | 116 transfer_buffer_manager_ = new TransferBufferManager(memory_tracker_.get()); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 bool ContextGroup::Initialize(GLES2Decoder* decoder, | 120 bool ContextGroup::Initialize(GLES2Decoder* decoder, |
121 ContextType context_type, | 121 ContextType context_type, |
122 const DisallowedFeatures& disallowed_features) { | 122 const DisallowedFeatures& disallowed_features) { |
123 if (!gpu_preferences_.enable_es3_apis && | 123 bool enable_es3 = context_type == CONTEXT_TYPE_OPENGLES3 || |
124 (context_type == CONTEXT_TYPE_OPENGLES3 || | 124 context_type == CONTEXT_TYPE_WEBGL2; |
125 context_type == CONTEXT_TYPE_WEBGL2)) { | 125 if (!gpu_preferences_.enable_es3_apis && enable_es3) { |
126 DLOG(ERROR) << "ContextGroup::Initialize failed because ES3 APIs are " | 126 DLOG(ERROR) << "ContextGroup::Initialize failed because ES3 APIs are " |
127 << "not available."; | 127 << "not available."; |
128 return false; | 128 return false; |
129 } | 129 } |
130 if (HaveContexts()) { | 130 if (HaveContexts()) { |
131 if (context_type != feature_info_->context_type()) { | 131 if (context_type != feature_info_->context_type()) { |
132 DLOG(ERROR) << "ContextGroup::Initialize failed because the type of " | 132 DLOG(ERROR) << "ContextGroup::Initialize failed because the type of " |
133 << "the context does not fit with the group."; | 133 << "the context does not fit with the group."; |
134 return false; | 134 return false; |
135 } | 135 } |
(...skipping 27 matching lines...) Expand all Loading... |
163 if (feature_info_->feature_flags().chromium_framebuffer_multisample || | 163 if (feature_info_->feature_flags().chromium_framebuffer_multisample || |
164 feature_info_->feature_flags().multisampled_render_to_texture) { | 164 feature_info_->feature_flags().multisampled_render_to_texture) { |
165 if (feature_info_->feature_flags( | 165 if (feature_info_->feature_flags( |
166 ).use_img_for_multisampled_render_to_texture) { | 166 ).use_img_for_multisampled_render_to_texture) { |
167 glGetIntegerv(GL_MAX_SAMPLES_IMG, &max_samples); | 167 glGetIntegerv(GL_MAX_SAMPLES_IMG, &max_samples); |
168 } else { | 168 } else { |
169 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); | 169 glGetIntegerv(GL_MAX_SAMPLES, &max_samples); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 if (feature_info_->feature_flags().ext_draw_buffers) { | 173 if (enable_es3 || feature_info_->feature_flags().ext_draw_buffers) { |
174 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); | 174 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); |
175 if (max_color_attachments_ < 1) | 175 if (max_color_attachments_ < 1) |
176 max_color_attachments_ = 1; | 176 max_color_attachments_ = 1; |
177 if (max_color_attachments_ > 16) | 177 if (max_color_attachments_ > 16) |
178 max_color_attachments_ = 16; | 178 max_color_attachments_ = 16; |
179 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); | 179 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); |
180 if (max_draw_buffers_ < 1) | 180 if (max_draw_buffers_ < 1) |
181 max_draw_buffers_ = 1; | 181 max_draw_buffers_ = 1; |
182 if (max_draw_buffers_ > 16) | 182 if (max_draw_buffers_ > 16) |
183 max_draw_buffers_ = 16; | 183 max_draw_buffers_ = 16; |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 GLuint client_id, GLuint* service_id) const { | 628 GLuint client_id, GLuint* service_id) const { |
629 Buffer* buffer = buffer_manager_->GetBuffer(client_id); | 629 Buffer* buffer = buffer_manager_->GetBuffer(client_id); |
630 if (!buffer) | 630 if (!buffer) |
631 return false; | 631 return false; |
632 *service_id = buffer->service_id(); | 632 *service_id = buffer->service_id(); |
633 return true; | 633 return true; |
634 } | 634 } |
635 | 635 |
636 } // namespace gles2 | 636 } // namespace gles2 |
637 } // namespace gpu | 637 } // namespace gpu |
OLD | NEW |