Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: gpu/command_buffer/service/framebuffer_manager.cc

Issue 1325433003: command_buffer: Add support for creating non-WebGL ES 3 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing hunk Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/framebuffer_manager.h" 5 #include "gpu/command_buffer/service/framebuffer_manager.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" 9 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h"
10 #include "gpu/command_buffer/service/renderbuffer_manager.h" 10 #include "gpu/command_buffer/service/renderbuffer_manager.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 DISALLOW_COPY_AND_ASSIGN(TextureAttachment); 238 DISALLOW_COPY_AND_ASSIGN(TextureAttachment);
239 }; 239 };
240 240
241 FramebufferManager::TextureDetachObserver::TextureDetachObserver() {} 241 FramebufferManager::TextureDetachObserver::TextureDetachObserver() {}
242 242
243 FramebufferManager::TextureDetachObserver::~TextureDetachObserver() {} 243 FramebufferManager::TextureDetachObserver::~TextureDetachObserver() {}
244 244
245 FramebufferManager::FramebufferManager( 245 FramebufferManager::FramebufferManager(
246 uint32 max_draw_buffers, 246 uint32 max_draw_buffers,
247 uint32 max_color_attachments, 247 uint32 max_color_attachments,
248 ContextGroup::ContextType context_type, 248 ContextType context_type,
249 const scoped_refptr<FramebufferCompletenessCache>& 249 const scoped_refptr<FramebufferCompletenessCache>&
250 framebuffer_combo_complete_cache) 250 framebuffer_combo_complete_cache)
251 : framebuffer_state_change_count_(1), 251 : framebuffer_state_change_count_(1),
252 framebuffer_count_(0), 252 framebuffer_count_(0),
253 have_context_(true), 253 have_context_(true),
254 max_draw_buffers_(max_draw_buffers), 254 max_draw_buffers_(max_draw_buffers),
255 max_color_attachments_(max_color_attachments), 255 max_color_attachments_(max_color_attachments),
256 context_type_(context_type), 256 context_type_(context_type),
257 framebuffer_combo_complete_cache_(framebuffer_combo_complete_cache) { 257 framebuffer_combo_complete_cache_(framebuffer_combo_complete_cache) {
258 DCHECK_GT(max_draw_buffers_, 0u); 258 DCHECK_GT(max_draw_buffers_, 0u);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (!attachment->ValidForAttachmentType(attachment_type, 484 if (!attachment->ValidForAttachmentType(attachment_type,
485 manager_->max_color_attachments_)) { 485 manager_->max_color_attachments_)) {
486 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; 486 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
487 } 487 }
488 if (width < 0) { 488 if (width < 0) {
489 width = attachment->width(); 489 width = attachment->width();
490 height = attachment->height(); 490 height = attachment->height();
491 if (width == 0 || height == 0) { 491 if (width == 0 || height == 0) {
492 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; 492 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
493 } 493 }
494 } else if (manager_->context_type() != ContextGroup::CONTEXT_TYPE_WEBGL2) { 494 } else if (manager_->context_type() != CONTEXT_TYPE_WEBGL2) {
495 // TODO(zmo): revisit this if we create ES3 contexts for clients other 495 // TODO(zmo): revisit this if we create ES3 contexts for clients other
496 // than WebGL 2. 496 // than WebGL 2.
497 if (attachment->width() != width || attachment->height() != height) { 497 if (attachment->width() != width || attachment->height() != height) {
498 return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT; 498 return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT;
499 } 499 }
500 } 500 }
501 501
502 if (!attachment->CanRenderTo()) { 502 if (!attachment->CanRenderTo()) {
503 return GL_FRAMEBUFFER_UNSUPPORTED; 503 return GL_FRAMEBUFFER_UNSUPPORTED;
504 } 504 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 texture_detach_observers_.begin(); 777 texture_detach_observers_.begin();
778 it != texture_detach_observers_.end(); 778 it != texture_detach_observers_.end();
779 ++it) { 779 ++it) {
780 TextureDetachObserver* observer = *it; 780 TextureDetachObserver* observer = *it;
781 observer->OnTextureRefDetachedFromFramebuffer(texture); 781 observer->OnTextureRefDetachedFromFramebuffer(texture);
782 } 782 }
783 } 783 }
784 784
785 } // namespace gles2 785 } // namespace gles2
786 } // namespace gpu 786 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.h ('k') | gpu/command_buffer/service/framebuffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698