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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/framebuffer_manager.h" 5 #include "gpu/command_buffer/service/framebuffer_manager.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 namespace gles2 { 10 namespace gles2 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 virtual bool CanRenderTo() const { 57 virtual bool CanRenderTo() const {
58 return true; 58 return true;
59 } 59 }
60 60
61 virtual void DetachFromFramebuffer() { 61 virtual void DetachFromFramebuffer() {
62 // Nothing to do for renderbuffers. 62 // Nothing to do for renderbuffers.
63 } 63 }
64 64
65 virtual bool ValidForAttachmentType(GLenum attachment_type) { 65 virtual bool ValidForAttachmentType(GLenum attachment_type) {
66 // TODO(gman): Fill this out. 66 uint32 need = GLES2Util::GetChannelsNeededForAttachmentType(
67 return true; 67 attachment_type);
68 uint32 have = GLES2Util::GetChannelsForFormat(internal_format());
69 return (need & have) != 0;
68 } 70 }
69 71
70 RenderbufferManager::RenderbufferInfo* renderbuffer() const { 72 RenderbufferManager::RenderbufferInfo* renderbuffer() const {
71 return renderbuffer_.get(); 73 return renderbuffer_.get();
72 } 74 }
73 75
74 private: 76 private:
75 RenderbufferManager::RenderbufferInfo::Ref renderbuffer_; 77 RenderbufferManager::RenderbufferInfo::Ref renderbuffer_;
76 78
77 DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment); 79 DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 141
140 virtual bool CanRenderTo() const { 142 virtual bool CanRenderTo() const {
141 return texture_->CanRenderTo(); 143 return texture_->CanRenderTo();
142 } 144 }
143 145
144 virtual void DetachFromFramebuffer() { 146 virtual void DetachFromFramebuffer() {
145 texture_->DetachFromFramebuffer(); 147 texture_->DetachFromFramebuffer();
146 } 148 }
147 149
148 virtual bool ValidForAttachmentType(GLenum attachment_type) { 150 virtual bool ValidForAttachmentType(GLenum attachment_type) {
149 // TODO(gman): Fill this out. 151 GLenum type = 0;
150 return true; 152 GLenum internal_format = 0;
153 if (!texture_->GetLevelType(target_, level_, &type, &internal_format)) {
154 return false;
155 }
156 uint32 need = GLES2Util::GetChannelsNeededForAttachmentType(
157 attachment_type);
158 uint32 have = GLES2Util::GetChannelsForFormat(internal_format);
159 return (need & have) != 0;
151 } 160 }
152 161
153 private: 162 private:
154 TextureManager::TextureInfo::Ref texture_; 163 TextureManager::TextureInfo::Ref texture_;
155 GLenum target_; 164 GLenum target_;
156 GLint level_; 165 GLint level_;
157 166
158 DISALLOW_COPY_AND_ASSIGN(TextureAttachment); 167 DISALLOW_COPY_AND_ASSIGN(TextureAttachment);
159 }; 168 };
160 169
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 FramebufferManager::FramebufferInfo* framebuffer) { 436 FramebufferManager::FramebufferInfo* framebuffer) {
428 DCHECK(framebuffer); 437 DCHECK(framebuffer);
429 return framebuffer->framebuffer_complete_state_count_id() == 438 return framebuffer->framebuffer_complete_state_count_id() ==
430 framebuffer_state_change_count_; 439 framebuffer_state_change_count_;
431 } 440 }
432 441
433 } // namespace gles2 442 } // namespace gles2
434 } // namespace gpu 443 } // namespace gpu
435 444
436 445
OLDNEW
« 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