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

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: fix tex target bug 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..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();
« 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