| 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 9c3a522be2039a239eb5a5aab931fe385b07abf7..4a4ffde26f240c07849d2eb09ba59f093002b234 100644
|
| --- a/gpu/command_buffer/service/framebuffer_manager.cc
|
| +++ b/gpu/command_buffer/service/framebuffer_manager.cc
|
| @@ -359,7 +359,8 @@ void Framebuffer::ChangeDrawBuffersHelper(bool recover) 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_) {
|
| + it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_ &&
|
| + !GLES2Util::IsIntegerFormat(it->second->internal_format())) {
|
| buffers[it->first - GL_COLOR_ATTACHMENT0] = it->first;
|
| }
|
| }
|
| @@ -388,6 +389,26 @@ void Framebuffer::RestoreDrawBuffersAfterClear() const {
|
| ChangeDrawBuffersHelper(recover);
|
| }
|
|
|
| +void Framebuffer::ClearIntegerBuffers() {
|
| + for (AttachmentMap::const_iterator it = attachments_.begin();
|
| + it != attachments_.end(); ++it) {
|
| + GLenum internal_format = it->second->internal_format();
|
| + if (it->first >= GL_COLOR_ATTACHMENT0 &&
|
| + it->first < GL_COLOR_ATTACHMENT0 + manager_->max_draw_buffers_ &&
|
| + !it->second->cleared() &&
|
| + GLES2Util::IsIntegerFormat(internal_format)) {
|
| + GLint drawbuffer = it->first - GL_COLOR_ATTACHMENT0;
|
| + if (GLES2Util::IsUnsignedIntegerFormat(internal_format)) {
|
| + const static GLuint kZero[] = { 0u, 0u, 0u, 0u };
|
| + glClearBufferuiv(GL_COLOR, drawbuffer, kZero);
|
| + } else { // IsUnsignedIntegerFormat(internal_format)
|
| + const static GLint kZero[] = { 0, 0, 0, 0 };
|
| + glClearBufferiv(GL_COLOR, drawbuffer, kZero);
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| void Framebuffer::MarkAttachmentAsCleared(
|
| RenderbufferManager* renderbuffer_manager,
|
| TextureManager* texture_manager,
|
| @@ -696,17 +717,21 @@ void Framebuffer::OnTextureRefDetached(TextureRef* texture) {
|
| manager_->OnTextureRefDetached(texture);
|
| }
|
|
|
| -void Framebuffer::OnWillRenderTo() const {
|
| +void Framebuffer::OnWillRenderTo(GLenum attachment) const {
|
| for (AttachmentMap::const_iterator it = attachments_.begin();
|
| it != attachments_.end(); ++it) {
|
| - it->second->OnWillRenderTo();
|
| + if (attachment == 0 || attachment == it->first) {
|
| + it->second->OnWillRenderTo();
|
| + }
|
| }
|
| }
|
|
|
| -void Framebuffer::OnDidRenderTo() const {
|
| +void Framebuffer::OnDidRenderTo(GLenum attachment) const {
|
| for (AttachmentMap::const_iterator it = attachments_.begin();
|
| it != attachments_.end(); ++it) {
|
| - it->second->OnDidRenderTo();
|
| + if (attachment == 0 || attachment == it->first) {
|
| + it->second->OnDidRenderTo();
|
| + }
|
| }
|
| }
|
|
|
|
|