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 d64963534a345c6d92b47e65de94fff5b691253b..a1161b0baed4adbaba0962f4209f686e2e139101 100644 |
--- a/gpu/command_buffer/service/framebuffer_manager.cc |
+++ b/gpu/command_buffer/service/framebuffer_manager.cc |
@@ -97,6 +97,8 @@ class RenderbufferAttachment |
// Nothing to do for renderbuffers. |
} |
+ bool IsLayerValid() const override { return true; } |
+ |
bool ValidForAttachmentType(GLenum attachment_type, |
ContextType context_type, |
uint32_t max_color_attachments) override { |
@@ -238,6 +240,14 @@ class TextureAttachment |
texture_ref_->texture()->DetachFromFramebuffer(); |
} |
+ bool IsLayerValid() const override { |
+ Texture* texture = texture_ref_->texture(); |
+ DCHECK(texture); |
+ GLsizei width, height, depth; |
+ return (texture->GetLevelSize(target_, level_, &width, &height, &depth) && |
+ layer_ < depth); |
+ } |
+ |
bool ValidForAttachmentType(GLenum attachment_type, |
ContextType context_type, |
uint32_t max_color_attachments) override { |
@@ -577,6 +587,9 @@ GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const { |
manager_->max_color_attachments_)) { |
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
} |
+ if (!attachment->IsLayerValid()) { |
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
+ } |
if (width < 0) { |
width = attachment->width(); |
height = attachment->height(); |