Chromium Code Reviews| Index: gpu/command_buffer/service/framebuffer_manager.cc |
| diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc |
| index cec5b104b7ab678b71a164d4da999293e99df8a8..b870f0a8b029a3d601a05f4d444905f72386b792 100644 |
| --- a/gpu/command_buffer/service/framebuffer_manager.cc |
| +++ b/gpu/command_buffer/service/framebuffer_manager.cc |
| @@ -89,6 +89,15 @@ class RenderbufferAttachment |
| return renderbuffer_.get() == renderbuffer; |
| } |
| + bool IsSameAttachment(const Attachment* attachment) const override { |
| + if (attachment->IsRenderbufferAttachment()) { |
| + const RenderbufferAttachment* other = |
| + reinterpret_cast<const RenderbufferAttachment*>(attachment); |
| + return IsRenderbuffer(other->renderbuffer()); |
| + } |
| + return false; |
| + } |
| + |
| bool Is3D() const override { return false; } |
| bool CanRenderTo(const FeatureInfo*) const override { return true; } |
| @@ -220,6 +229,18 @@ class TextureAttachment |
| return texture == texture_ref_.get(); |
| } |
| + bool IsSameAttachment(const Attachment* attachment) const override { |
| + if (attachment->IsTextureAttachment()) { |
| + const TextureAttachment* other = |
| + reinterpret_cast<const TextureAttachment*>(attachment); |
| + return IsTexture(other->texture()) && |
| + layer_ == other->layer() && |
| + target_ == other->target() && |
| + level_ == other->level(); |
| + } |
| + return false; |
| + } |
| + |
| bool IsRenderbuffer(Renderbuffer* /* renderbuffer */) const override { |
| return false; |
| } |
| @@ -711,6 +732,21 @@ GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const { |
| if (!attachment->CanRenderTo(feature_info)) { |
| return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
| } |
| + |
| + // In WebGL 2.0, attaching an image to more than one color attachment point |
| + // should return FRAMEBUFFER_UNSUPPORTED. |
| + 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
|
| + if (it->first >= GL_COLOR_ATTACHMENT0 && |
| + it->first < GL_COLOR_ATTACHMENT0 + manager_->max_color_attachments_) { |
| + for (GLenum i = it->first + 1; |
| + i < GL_COLOR_ATTACHMENT0 + manager_->max_color_attachments_; i++) { |
| + const Attachment* other = GetAttachment(i); |
| + if (other && attachment->IsSameAttachment(other)) { |
| + return GL_FRAMEBUFFER_UNSUPPORTED; |
| + } |
| + } |
| + } |
| + } |
| } |
| // This does not mean the framebuffer is actually complete. It just means our |