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/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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 GLenum attachment) const { | 396 GLenum attachment) const { |
397 AttachmentMap::const_iterator it = | 397 AttachmentMap::const_iterator it = |
398 attachments_.find(attachment); | 398 attachments_.find(attachment); |
399 if (it != attachments_.end()) { | 399 if (it != attachments_.end()) { |
400 const Attachment* attachment = it->second.get(); | 400 const Attachment* attachment = it->second.get(); |
401 return !attachment->cleared(); | 401 return !attachment->cleared(); |
402 } | 402 } |
403 return false; | 403 return false; |
404 } | 404 } |
405 | 405 |
406 bool Framebuffer::HasDepthStencilFormatAttachment( | |
407 GLenum attachment) const { | |
408 AttachmentMap::const_iterator it = attachments_.find(attachment); | |
409 if (it != attachments_.end()) { | |
410 const Attachment* attachment = it->second.get(); | |
411 GLenum internal_format = attachment->internal_format(); | |
412 return TextureManager::ExtractFormatFromStorageFormat(internal_format) == | |
413 GL_DEPTH_STENCIL; | |
qiankun
2016/07/18 04:50:09
4 space indent.
| |
414 } | |
415 return false; | |
416 } | |
417 | |
406 bool Framebuffer::HasUnclearedColorAttachments() const { | 418 bool Framebuffer::HasUnclearedColorAttachments() const { |
407 for (AttachmentMap::const_iterator it = attachments_.begin(); | 419 for (AttachmentMap::const_iterator it = attachments_.begin(); |
408 it != attachments_.end(); ++it) { | 420 it != attachments_.end(); ++it) { |
409 if (it->first >= GL_COLOR_ATTACHMENT0 && | 421 if (it->first >= GL_COLOR_ATTACHMENT0 && |
410 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { | 422 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { |
411 const Attachment* attachment = it->second.get(); | 423 const Attachment* attachment = it->second.get(); |
412 if (!attachment->cleared()) | 424 if (!attachment->cleared()) |
413 return true; | 425 return true; |
414 } | 426 } |
415 } | 427 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 if (attachment->IsPartiallyCleared() || attachment->Is3D() || | 528 if (attachment->IsPartiallyCleared() || attachment->Is3D() || |
517 GLES2Util::IsIntegerFormat(attachment->internal_format())) { | 529 GLES2Util::IsIntegerFormat(attachment->internal_format())) { |
518 texture_manager->ClearTextureLevel(decoder, | 530 texture_manager->ClearTextureLevel(decoder, |
519 attachment->texture(), | 531 attachment->texture(), |
520 attachment->target(), | 532 attachment->target(), |
521 attachment->level()); | 533 attachment->level()); |
522 } | 534 } |
523 } | 535 } |
524 } | 536 } |
525 | 537 |
538 // TODO: when the texture or the renderbuffer in format DEPTH_STENCIL, mark | |
539 // the specific part (depth or stencil) of it as cleared or uncleared instead | |
540 // of the whole one. | |
526 void Framebuffer::MarkAttachmentAsCleared( | 541 void Framebuffer::MarkAttachmentAsCleared( |
527 RenderbufferManager* renderbuffer_manager, | 542 RenderbufferManager* renderbuffer_manager, |
528 TextureManager* texture_manager, | 543 TextureManager* texture_manager, |
529 GLenum attachment, | 544 GLenum attachment, |
530 bool cleared) { | 545 bool cleared) { |
531 AttachmentMap::iterator it = attachments_.find(attachment); | 546 AttachmentMap::iterator it = attachments_.find(attachment); |
532 if (it != attachments_.end()) { | 547 if (it != attachments_.end()) { |
533 Attachment* a = it->second.get(); | 548 Attachment* a = it->second.get(); |
534 if (a->cleared() != cleared) { | 549 if (a->cleared() != cleared) { |
535 a->SetCleared(renderbuffer_manager, | 550 a->SetCleared(renderbuffer_manager, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
717 GLenum result = glCheckFramebufferStatusEXT(target); | 732 GLenum result = glCheckFramebufferStatusEXT(target); |
718 | 733 |
719 if (result == GL_FRAMEBUFFER_COMPLETE) { | 734 if (result == GL_FRAMEBUFFER_COMPLETE) { |
720 manager_->GetFramebufferComboCompleteCache()->SetComplete(signature); | 735 manager_->GetFramebufferComboCompleteCache()->SetComplete(signature); |
721 } | 736 } |
722 | 737 |
723 return result; | 738 return result; |
724 } | 739 } |
725 | 740 |
726 bool Framebuffer::IsCleared() const { | 741 bool Framebuffer::IsCleared() const { |
727 // are all the attachments cleaared? | 742 // are all the attachments cleared? |
728 for (AttachmentMap::const_iterator it = attachments_.begin(); | 743 for (AttachmentMap::const_iterator it = attachments_.begin(); |
729 it != attachments_.end(); ++it) { | 744 it != attachments_.end(); ++it) { |
730 Attachment* attachment = it->second.get(); | 745 Attachment* attachment = it->second.get(); |
731 if (!attachment->cleared()) { | 746 if (!attachment->cleared()) { |
732 return false; | 747 return false; |
733 } | 748 } |
734 } | 749 } |
735 return true; | 750 return true; |
736 } | 751 } |
737 | 752 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
934 | 949 |
935 bool FramebufferManager::IsComplete( | 950 bool FramebufferManager::IsComplete( |
936 Framebuffer* framebuffer) { | 951 Framebuffer* framebuffer) { |
937 DCHECK(framebuffer); | 952 DCHECK(framebuffer); |
938 return framebuffer->framebuffer_complete_state_count_id() == | 953 return framebuffer->framebuffer_complete_state_count_id() == |
939 framebuffer_state_change_count_; | 954 framebuffer_state_change_count_; |
940 } | 955 } |
941 | 956 |
942 } // namespace gles2 | 957 } // namespace gles2 |
943 } // namespace gpu | 958 } // namespace gpu |
OLD | NEW |