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 0fd59c5fd6ba1dfb618709f97b1a8269481fd6d2..f8d8405aa7a4241e6928a6058bbf412964ef9fa1 100644 |
| --- a/gpu/command_buffer/service/framebuffer_manager.cc |
| +++ b/gpu/command_buffer/service/framebuffer_manager.cc |
| @@ -611,6 +611,44 @@ bool Framebuffer::HasStencilAttachment() const { |
| return attachments_.find(GL_STENCIL_ATTACHMENT) != attachments_.end(); |
| } |
| +bool Framebuffer::ReadBufferHasNoImage() const { |
| + if (read_buffer_ == GL_NONE) { |
| + return false; |
| + } |
| + AttachmentMap::const_iterator it = attachments_.find(read_buffer_); |
| + if (it == attachments_.end()) { |
|
Zhenyao Mo
2016/11/14 19:42:24
Just return it == attachments_.end().
yunchao
2016/11/15 16:21:58
Done.
|
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| +bool Framebuffer::DrawBuffersHaveNoImage(GLsizei& num, GLenum* buf) const { |
| + bool ret = false; |
| + for (GLenum i = 0; i < manager_->max_draw_buffers_; ++i) { |
| + if (draw_buffers_[i] == GL_NONE) { |
| + buf[i] = GL_NONE; |
| + continue; |
| + } |
| + const Attachment* attachment = GetAttachment(draw_buffers_[i]); |
| + if (attachment) { |
| + buf[i] = GL_COLOR_ATTACHMENT0 + i; |
|
Zhenyao Mo
2016/11/14 19:42:24
Here you should DCHECK(buf[i] == GL_COLOR_ATTACHME
yunchao
2016/11/15 16:21:58
Not re-assign. The buf[] passed in are all GL_NONE
|
| + ++num; |
|
Zhenyao Mo
2016/11/14 19:42:24
Here you assume num is initialized to zero by call
yunchao
2016/11/15 16:21:58
See the explanation elsewhere.
|
| + } else { |
| + buf[i] = GL_NONE; |
| + ret = true; |
| + } |
| + } |
| + return ret; |
| +} |
| + |
| +bool Framebuffer::ColorBuffersHaveImage() const { |
| + for (GLenum i = 0; i < manager_->max_color_attachments_; i++) { |
| + if (attachments_.find(GL_COLOR_ATTACHMENT0 + i) != attachments_.end()) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| GLenum Framebuffer::GetReadBufferInternalFormat() const { |
| if (read_buffer_ == GL_NONE) |
| return 0; |