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..44f3c21b552f90acd9436a63a40044fac7b8af19 100644 |
| --- a/gpu/command_buffer/service/framebuffer_manager.cc |
| +++ b/gpu/command_buffer/service/framebuffer_manager.cc |
| @@ -611,6 +611,43 @@ 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_); |
| + return it == attachments_.end(); |
| +} |
| + |
| +bool Framebuffer::DrawBuffersHaveMissingImage(GLsizei* num, GLenum* buf) const { |
| + DCHECK(num); |
| + DCHECK(buf); |
| + 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; |
| + ++(*num); |
| + } else { |
| + buf[i] = GL_NONE; |
| + ret = true; |
| + } |
| + } |
| + return ret; |
| +} |
| + |
| +bool Framebuffer::ColorBuffersHaveImage() const { |
| + for (GLenum i = 0; i < manager_->max_color_attachments_; i++) { |
|
Zhenyao Mo
2016/11/16 03:27:27
Can you do the other way? i.e., go through attachm
Zhenyao Mo
2016/11/16 03:27:27
nit: ++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; |