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

Unified 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: remove webgl2 condition 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 side-by-side diff with in-line comments
Download patch
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..84a77d46e74d5175c74c392eca676f0a5cab0ca0 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,19 @@ GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const {
if (!attachment->CanRenderTo(feature_info)) {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
+
+ // Attaching an image to more than one color attachment point should return
+ // FRAMEBUFFER_UNSUPPORTED.
+ 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

Powered by Google App Engine
This is Rietveld 408576698