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

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

Issue 9732010: Check that attachments are the correct type for the attachment type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 fddc3e6ab73a122621eff27b58caa7dd6f989807..22082dfa36d5b2b1ad1e71a26acca32a0a7a1027 100644
--- a/gpu/command_buffer/service/framebuffer_manager.cc
+++ b/gpu/command_buffer/service/framebuffer_manager.cc
@@ -63,8 +63,10 @@ class RenderbufferAttachment
}
virtual bool ValidForAttachmentType(GLenum attachment_type) {
- // TODO(gman): Fill this out.
- return true;
+ uint32 need = GLES2Util::GetChannelsNeededForAttachmentType(
+ attachment_type);
+ uint32 have = GLES2Util::GetChannelsForFormat(internal_format());
+ return (need & have) != 0;
}
RenderbufferManager::RenderbufferInfo* renderbuffer() const {
@@ -146,8 +148,15 @@ class TextureAttachment
}
virtual bool ValidForAttachmentType(GLenum attachment_type) {
- // TODO(gman): Fill this out.
- return true;
+ GLenum type = 0;
+ GLenum internal_format = 0;
+ if (!texture_->GetLevelType(target_, level_, &type, &internal_format)) {
+ return false;
+ }
+ uint32 need = GLES2Util::GetChannelsNeededForAttachmentType(
+ attachment_type);
+ uint32 have = GLES2Util::GetChannelsForFormat(internal_format);
+ return (need & have) != 0;
}
private:
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | gpu/command_buffer/service/framebuffer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698