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/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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 // GL implementation uses, but we always return INCOMPLETE_MULTISAMPLE | 670 // GL implementation uses, but we always return INCOMPLETE_MULTISAMPLE |
| 671 // here to ensure consistent behaviors across platforms. | 671 // here to ensure consistent behaviors across platforms. |
| 672 return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; | 672 return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; |
| 673 } | 673 } |
| 674 } | 674 } |
| 675 if (!attachment->CanRenderTo(feature_info)) { | 675 if (!attachment->CanRenderTo(feature_info)) { |
| 676 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; | 676 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 // WebGL2 and GLES3 don't allow different images to bind to the depth and | |
| 681 // stencil attachment points, or GL_FRAMEBUFFER_UNSUPPORTED is returned. | |
| 682 if (feature_info->context_type() == CONTEXT_TYPE_WEBGL2 || | |
| 683 feature_info->context_type() == CONTEXT_TYPE_OPENGLES3) { | |
|
Zhenyao Mo
2016/07/20 13:46:07
We probably want to enforce this for all context t
| |
| 684 AttachmentMap::const_iterator depth_it = | |
| 685 attachments_.find(GL_DEPTH_ATTACHMENT); | |
| 686 if (depth_it != attachments_.end()) { | |
| 687 AttachmentMap::const_iterator stencil_it = | |
| 688 attachments_.find(GL_STENCIL_ATTACHMENT); | |
| 689 if (stencil_it != attachments_.end()) { | |
| 690 if ((depth_it->second.get()->IsTextureAttachment() != | |
|
Zhenyao Mo
2016/07/20 13:46:07
This is incorrect. First, you also need to consid
| |
| 691 stencil_it->second.get()->IsTextureAttachment()) || | |
| 692 (depth_it->second.get()->object_name() != | |
| 693 stencil_it->second.get()->object_name())) { | |
| 694 return GL_FRAMEBUFFER_UNSUPPORTED; | |
| 695 } | |
| 696 } | |
| 697 } | |
| 698 } | |
| 680 // This does not mean the framebuffer is actually complete. It just means our | 699 // This does not mean the framebuffer is actually complete. It just means our |
| 681 // checks passed. | 700 // checks passed. |
| 682 return GL_FRAMEBUFFER_COMPLETE; | 701 return GL_FRAMEBUFFER_COMPLETE; |
| 683 } | 702 } |
| 684 | 703 |
| 685 GLenum Framebuffer::GetStatus( | 704 GLenum Framebuffer::GetStatus( |
| 686 TextureManager* texture_manager, GLenum target) const { | 705 TextureManager* texture_manager, GLenum target) const { |
| 687 if (!manager_->GetFramebufferComboCompleteCache()) { | 706 if (!manager_->GetFramebufferComboCompleteCache()) { |
| 688 return glCheckFramebufferStatusEXT(target); | 707 return glCheckFramebufferStatusEXT(target); |
| 689 } | 708 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 | 953 |
| 935 bool FramebufferManager::IsComplete( | 954 bool FramebufferManager::IsComplete( |
| 936 Framebuffer* framebuffer) { | 955 Framebuffer* framebuffer) { |
| 937 DCHECK(framebuffer); | 956 DCHECK(framebuffer); |
| 938 return framebuffer->framebuffer_complete_state_count_id() == | 957 return framebuffer->framebuffer_complete_state_count_id() == |
| 939 framebuffer_state_change_count_; | 958 framebuffer_state_change_count_; |
| 940 } | 959 } |
| 941 | 960 |
| 942 } // namespace gles2 | 961 } // namespace gles2 |
| 943 } // namespace gpu | 962 } // namespace gpu |
| OLD | NEW |