OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
9 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 9 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
10 #include "gpu/command_buffer/service/texture_manager.h" | 10 #include "gpu/command_buffer/service/texture_manager.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { | 367 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { |
368 const Attachment* attachment = it->second.get(); | 368 const Attachment* attachment = it->second.get(); |
369 if (!attachment->cleared()) | 369 if (!attachment->cleared()) |
370 return true; | 370 return true; |
371 } | 371 } |
372 } | 372 } |
373 return false; | 373 return false; |
374 } | 374 } |
375 | 375 |
376 void Framebuffer::ChangeDrawBuffersHelper(bool recover) const { | 376 void Framebuffer::ChangeDrawBuffersHelper(bool recover) const { |
| 377 // There will always be only one buffer, GL_COLOR_ATTACHMENT0, if |
| 378 // GL_ARB_draw_buffers is not present, even if this FBO has no attachment. |
| 379 if (!gfx::g_driver_gl.ext.b_GL_ARB_draw_buffers) |
| 380 return; |
| 381 |
377 scoped_ptr<GLenum[]> buffers(new GLenum[manager_->max_draw_buffers_]); | 382 scoped_ptr<GLenum[]> buffers(new GLenum[manager_->max_draw_buffers_]); |
378 for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i) | 383 for (uint32 i = 0; i < manager_->max_draw_buffers_; ++i) |
379 buffers[i] = GL_NONE; | 384 buffers[i] = GL_NONE; |
380 for (AttachmentMap::const_iterator it = attachments_.begin(); | 385 for (AttachmentMap::const_iterator it = attachments_.begin(); |
381 it != attachments_.end(); ++it) { | 386 it != attachments_.end(); ++it) { |
382 if (it->first >= GL_COLOR_ATTACHMENT0 && | 387 if (it->first >= GL_COLOR_ATTACHMENT0 && |
383 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { | 388 it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_) { |
384 buffers[it->first - GL_COLOR_ATTACHMENT0] = it->first; | 389 buffers[it->first - GL_COLOR_ATTACHMENT0] = it->first; |
385 } | 390 } |
386 } | 391 } |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 ++it) { | 740 ++it) { |
736 TextureDetachObserver* observer = *it; | 741 TextureDetachObserver* observer = *it; |
737 observer->OnTextureRefDetachedFromFramebuffer(texture); | 742 observer->OnTextureRefDetachedFromFramebuffer(texture); |
738 } | 743 } |
739 } | 744 } |
740 | 745 |
741 } // namespace gles2 | 746 } // namespace gles2 |
742 } // namespace gpu | 747 } // namespace gpu |
743 | 748 |
744 | 749 |
OLD | NEW |