| 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 7dfba400d24704d31a79cba36c62655b1c81bba8..4022b3defaa1e286e85e72f7ac6aa702fa1e9fb2 100644
|
| --- a/gpu/command_buffer/service/framebuffer_manager.cc
|
| +++ b/gpu/command_buffer/service/framebuffer_manager.cc
|
| @@ -360,6 +360,55 @@ bool Framebuffer::HasUnclearedAttachment(
|
| return false;
|
| }
|
|
|
| +bool Framebuffer::HasUnclearedColorAttachments() const {
|
| + for (AttachmentMap::const_iterator it = attachments_.begin();
|
| + it != attachments_.end(); ++it) {
|
| + if (it->first >= GL_COLOR_ATTACHMENT0 &&
|
| + it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) {
|
| + const Attachment* attachment = it->second.get();
|
| + if (!attachment->cleared())
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +void Framebuffer::ChangeDrawBuffersHelper(bool recover) const {
|
| + scoped_ptr<GLenum[]> buffers(new GLenum[manager_->max_draw_buffers_]);
|
| + for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i)
|
| + buffers[i] = GL_NONE;
|
| + for (AttachmentMap::const_iterator it = attachments_.begin();
|
| + it != attachments_.end(); ++it) {
|
| + if (it->first >= GL_COLOR_ATTACHMENT0 &&
|
| + it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) {
|
| + buffers[it->first - GL_COLOR_ATTACHMENT0] = it->first;
|
| + }
|
| + }
|
| + bool different = false;
|
| + for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i) {
|
| + if (buffers[i] != draw_buffers_[i]) {
|
| + different = true;
|
| + break;
|
| + }
|
| + }
|
| + if (different) {
|
| + if (recover)
|
| + glDrawBuffersARB(manager_->max_draw_buffers_, draw_buffers_.get());
|
| + else
|
| + glDrawBuffersARB(manager_->max_draw_buffers_, buffers.get());
|
| + }
|
| +}
|
| +
|
| +void Framebuffer::PrepareDrawBuffersForClear() const {
|
| + bool recover = false;
|
| + ChangeDrawBuffersHelper(recover);
|
| +}
|
| +
|
| +void Framebuffer::RestoreDrawBuffersAfterClear() const {
|
| + bool recover = true;
|
| + ChangeDrawBuffersHelper(recover);
|
| +}
|
| +
|
| void Framebuffer::MarkAttachmentAsCleared(
|
| RenderbufferManager* renderbuffer_manager,
|
| TextureManager* texture_manager,
|
| @@ -516,6 +565,8 @@ void Framebuffer::SetDrawBuffers(GLsizei n, const GLenum* bufs) {
|
| draw_buffers_[i] = bufs[i];
|
| }
|
|
|
| +
|
| +
|
| bool Framebuffer::HasAlphaMRT() const {
|
| for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i) {
|
| if (draw_buffers_[i] != GL_NONE) {
|
|
|