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

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

Issue 2159183002: Attaching an image to many color attachment points is unsupported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix zmo's comments 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 bool IsTextureAttachment() const override { return false; } 83 bool IsTextureAttachment() const override { return false; }
84 bool IsRenderbufferAttachment() const override { return true; } 84 bool IsRenderbufferAttachment() const override { return true; }
85 85
86 bool IsTexture(TextureRef* /* texture */) const override { return false; } 86 bool IsTexture(TextureRef* /* texture */) const override { return false; }
87 87
88 bool IsRenderbuffer(Renderbuffer* renderbuffer) const override { 88 bool IsRenderbuffer(Renderbuffer* renderbuffer) const override {
89 return renderbuffer_.get() == renderbuffer; 89 return renderbuffer_.get() == renderbuffer;
90 } 90 }
91 91
92 bool IsSameAttachment(const Attachment* attachment) const override {
93 if (attachment->IsRenderbufferAttachment()) {
94 const RenderbufferAttachment* other =
95 reinterpret_cast<const RenderbufferAttachment*>(attachment);
96 return IsRenderbuffer(other->renderbuffer());
97 }
98 return false;
99 }
100
92 bool Is3D() const override { return false; } 101 bool Is3D() const override { return false; }
93 102
94 bool CanRenderTo(const FeatureInfo*) const override { return true; } 103 bool CanRenderTo(const FeatureInfo*) const override { return true; }
95 104
96 void DetachFromFramebuffer(Framebuffer* framebuffer) const override { 105 void DetachFromFramebuffer(Framebuffer* framebuffer) const override {
97 // Nothing to do for renderbuffers. 106 // Nothing to do for renderbuffers.
98 } 107 }
99 108
100 bool IsLayerValid() const override { return true; } 109 bool IsLayerValid() const override { return true; }
101 110
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return texture_ref_->texture()->IsLevelPartiallyCleared(target_, level_); 222 return texture_ref_->texture()->IsLevelPartiallyCleared(target_, level_);
214 } 223 }
215 224
216 bool IsTextureAttachment() const override { return true; } 225 bool IsTextureAttachment() const override { return true; }
217 bool IsRenderbufferAttachment() const override { return false; } 226 bool IsRenderbufferAttachment() const override { return false; }
218 227
219 bool IsTexture(TextureRef* texture) const override { 228 bool IsTexture(TextureRef* texture) const override {
220 return texture == texture_ref_.get(); 229 return texture == texture_ref_.get();
221 } 230 }
222 231
232 bool IsSameAttachment(const Attachment* attachment) const override {
233 if (attachment->IsTextureAttachment()) {
234 const TextureAttachment* other =
235 reinterpret_cast<const TextureAttachment*>(attachment);
236 return IsTexture(other->texture()) &&
237 layer_ == other->layer() &&
238 target_ == other->target() &&
239 level_ == other->level();
240 }
241 return false;
242 }
243
223 bool IsRenderbuffer(Renderbuffer* /* renderbuffer */) const override { 244 bool IsRenderbuffer(Renderbuffer* /* renderbuffer */) const override {
224 return false; 245 return false;
225 } 246 }
226 247
227 bool Is3D() const override { 248 bool Is3D() const override {
228 return (target_ == GL_TEXTURE_3D || target_ == GL_TEXTURE_2D_ARRAY); 249 return (target_ == GL_TEXTURE_3D || target_ == GL_TEXTURE_2D_ARRAY);
229 } 250 }
230 251
231 TextureRef* texture() const { 252 TextureRef* texture() const {
232 return texture_ref_.get(); 253 return texture_ref_.get();
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } else if (attachment->samples() != samples) { 725 } else if (attachment->samples() != samples) {
705 // It's possible that the specified samples isn't the actual samples a 726 // It's possible that the specified samples isn't the actual samples a
706 // GL implementation uses, but we always return INCOMPLETE_MULTISAMPLE 727 // GL implementation uses, but we always return INCOMPLETE_MULTISAMPLE
707 // here to ensure consistent behaviors across platforms. 728 // here to ensure consistent behaviors across platforms.
708 return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; 729 return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
709 } 730 }
710 } 731 }
711 if (!attachment->CanRenderTo(feature_info)) { 732 if (!attachment->CanRenderTo(feature_info)) {
712 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; 733 return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
713 } 734 }
735
736 // In WebGL 2.0, attaching an image to more than one color attachment point
737 // should return FRAMEBUFFER_UNSUPPORTED.
738 if (feature_info->context_type() == CONTEXT_TYPE_WEBGL2) {
qiankun 2016/07/20 08:53:33 Is it right only for webgl 2 context? I think gles
Zhenyao Mo 2016/07/20 13:55:44 We need to apply it to ES3 contexts as well. If t
qiankun 2016/07/20 15:03:26 I see. You told me to update extension case before
Zhenyao Mo 2016/07/20 16:12:48 On the command buffer side, we don't need to check
739 if (it->first >= GL_COLOR_ATTACHMENT0 &&
740 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_color_attachments_) {
741 for (GLenum i = it->first + 1;
742 i < GL_COLOR_ATTACHMENT0 + manager_->max_color_attachments_; i++) {
743 const Attachment* other = GetAttachment(i);
744 if (other && attachment->IsSameAttachment(other)) {
745 return GL_FRAMEBUFFER_UNSUPPORTED;
746 }
747 }
748 }
749 }
714 } 750 }
715 751
716 // This does not mean the framebuffer is actually complete. It just means our 752 // This does not mean the framebuffer is actually complete. It just means our
717 // checks passed. 753 // checks passed.
718 return GL_FRAMEBUFFER_COMPLETE; 754 return GL_FRAMEBUFFER_COMPLETE;
719 } 755 }
720 756
721 GLenum Framebuffer::GetStatus( 757 GLenum Framebuffer::GetStatus(
722 TextureManager* texture_manager, GLenum target) const { 758 TextureManager* texture_manager, GLenum target) const {
723 if (!manager_->GetFramebufferComboCompleteCache()) { 759 if (!manager_->GetFramebufferComboCompleteCache()) {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1040
1005 bool FramebufferManager::IsComplete( 1041 bool FramebufferManager::IsComplete(
1006 Framebuffer* framebuffer) { 1042 Framebuffer* framebuffer) {
1007 DCHECK(framebuffer); 1043 DCHECK(framebuffer);
1008 return framebuffer->framebuffer_complete_state_count_id() == 1044 return framebuffer->framebuffer_complete_state_count_id() ==
1009 framebuffer_state_change_count_; 1045 framebuffer_state_change_count_;
1010 } 1046 }
1011 1047
1012 } // namespace gles2 1048 } // namespace gles2
1013 } // namespace gpu 1049 } // 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