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 d64963534a345c6d92b47e65de94fff5b691253b..7a5e1ad871c587fe90b96dfdbb733718808a53ca 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,15 @@ class TextureAttachment |
| texture_ref_->texture()->DetachFromFramebuffer(); |
| } |
| + bool IsLayerValid() const override { |
| + Texture* texture = texture_ref_->texture(); |
| + DCHECK(texture); |
| + GLsizei width, height, depth; |
| + return (texture->GetLevelSize(texture->target(), level_, |
|
piman
2016/05/27 01:37:25
I think you need to take the attachment's target,
Zhenyao Mo
2016/05/27 12:44:35
Done. Added a unitttest to catch this bug.
|
| + &width, &height, &depth) && |
| + layer_ < depth); |
| + } |
| + |
| bool ValidForAttachmentType(GLenum attachment_type, |
| ContextType context_type, |
| uint32_t max_color_attachments) override { |
| @@ -577,6 +588,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(); |