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

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

Issue 2149523002: Make invalidateFramebuffer no-op for DEPTH_STENCIL attachment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bugs found by Ken Created 4 years, 5 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 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 GLenum attachment) const { 403 GLenum attachment) const {
404 AttachmentMap::const_iterator it = 404 AttachmentMap::const_iterator it =
405 attachments_.find(attachment); 405 attachments_.find(attachment);
406 if (it != attachments_.end()) { 406 if (it != attachments_.end()) {
407 const Attachment* attachment = it->second.get(); 407 const Attachment* attachment = it->second.get();
408 return !attachment->cleared(); 408 return !attachment->cleared();
409 } 409 }
410 return false; 410 return false;
411 } 411 }
412 412
413 bool Framebuffer::HasDepthStencilFormatAttachment(
414 GLenum attachment) const {
415 AttachmentMap::const_iterator it = attachments_.find(attachment);
416 if (it != attachments_.end()) {
417 const Attachment* attachment = it->second.get();
418 GLenum internal_format = attachment->internal_format();
419 return TextureManager::ExtractFormatFromStorageFormat(internal_format) ==
420 GL_DEPTH_STENCIL;
421 }
422 return false;
423 }
424
413 bool Framebuffer::HasUnclearedColorAttachments() const { 425 bool Framebuffer::HasUnclearedColorAttachments() const {
414 for (AttachmentMap::const_iterator it = attachments_.begin(); 426 for (AttachmentMap::const_iterator it = attachments_.begin();
415 it != attachments_.end(); ++it) { 427 it != attachments_.end(); ++it) {
416 if (it->first >= GL_COLOR_ATTACHMENT0 && 428 if (it->first >= GL_COLOR_ATTACHMENT0 &&
417 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { 429 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) {
418 const Attachment* attachment = it->second.get(); 430 const Attachment* attachment = it->second.get();
419 if (!attachment->cleared()) 431 if (!attachment->cleared())
420 return true; 432 return true;
421 } 433 }
422 } 434 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (attachment->IsPartiallyCleared() || attachment->Is3D() || 564 if (attachment->IsPartiallyCleared() || attachment->Is3D() ||
553 GLES2Util::IsIntegerFormat(attachment->internal_format())) { 565 GLES2Util::IsIntegerFormat(attachment->internal_format())) {
554 texture_manager->ClearTextureLevel(decoder, 566 texture_manager->ClearTextureLevel(decoder,
555 attachment->texture(), 567 attachment->texture(),
556 attachment->target(), 568 attachment->target(),
557 attachment->level()); 569 attachment->level());
558 } 570 }
559 } 571 }
560 } 572 }
561 573
574 // TODO(Jiawei): when the texture or the renderbuffer in format
Ken Russell (switch to Gerrit) 2016/07/20 23:36:06 Use full email address please.
575 // DEPTH_STENCIL, mark the specific part (depth or stencil) of it as
576 // cleared or uncleared instead of the whole one.
562 void Framebuffer::MarkAttachmentAsCleared( 577 void Framebuffer::MarkAttachmentAsCleared(
563 RenderbufferManager* renderbuffer_manager, 578 RenderbufferManager* renderbuffer_manager,
564 TextureManager* texture_manager, 579 TextureManager* texture_manager,
565 GLenum attachment, 580 GLenum attachment,
566 bool cleared) { 581 bool cleared) {
567 AttachmentMap::iterator it = attachments_.find(attachment); 582 AttachmentMap::iterator it = attachments_.find(attachment);
568 if (it != attachments_.end()) { 583 if (it != attachments_.end()) {
569 Attachment* a = it->second.get(); 584 Attachment* a = it->second.get();
570 if (a->cleared() != cleared) { 585 if (a->cleared() != cleared) {
571 a->SetCleared(renderbuffer_manager, 586 a->SetCleared(renderbuffer_manager,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 GLenum result = glCheckFramebufferStatusEXT(target); 768 GLenum result = glCheckFramebufferStatusEXT(target);
754 769
755 if (result == GL_FRAMEBUFFER_COMPLETE) { 770 if (result == GL_FRAMEBUFFER_COMPLETE) {
756 manager_->GetFramebufferComboCompleteCache()->SetComplete(signature); 771 manager_->GetFramebufferComboCompleteCache()->SetComplete(signature);
757 } 772 }
758 773
759 return result; 774 return result;
760 } 775 }
761 776
762 bool Framebuffer::IsCleared() const { 777 bool Framebuffer::IsCleared() const {
763 // are all the attachments cleaared? 778 // are all the attachments cleared?
764 for (AttachmentMap::const_iterator it = attachments_.begin(); 779 for (AttachmentMap::const_iterator it = attachments_.begin();
765 it != attachments_.end(); ++it) { 780 it != attachments_.end(); ++it) {
766 Attachment* attachment = it->second.get(); 781 Attachment* attachment = it->second.get();
767 if (!attachment->cleared()) { 782 if (!attachment->cleared()) {
768 return false; 783 return false;
769 } 784 }
770 } 785 }
771 return true; 786 return true;
772 } 787 }
773 788
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1019
1005 bool FramebufferManager::IsComplete( 1020 bool FramebufferManager::IsComplete(
1006 Framebuffer* framebuffer) { 1021 Framebuffer* framebuffer) {
1007 DCHECK(framebuffer); 1022 DCHECK(framebuffer);
1008 return framebuffer->framebuffer_complete_state_count_id() == 1023 return framebuffer->framebuffer_complete_state_count_id() ==
1009 framebuffer_state_change_count_; 1024 framebuffer_state_change_count_;
1010 } 1025 }
1011 1026
1012 } // namespace gles2 1027 } // namespace gles2
1013 } // namespace gpu 1028 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698