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

Unified Diff: gpu/command_buffer/service/framebuffer_manager.cc

Issue 2020473002: Check layer is valid for framebuffer 3D texture attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 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();
« 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