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 "content/common/gpu/texture_image_transport_surface.h" | 5 #include "content/common/gpu/texture_image_transport_surface.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_id_); | 127 glBindFramebufferEXT(GL_FRAMEBUFFER, fbo_id_); |
128 current_size_ = gfx::Size(1, 1); | 128 current_size_ = gfx::Size(1, 1); |
129 helper_->stub()->AddDestructionObserver(this); | 129 helper_->stub()->AddDestructionObserver(this); |
130 } | 130 } |
131 | 131 |
132 // We could be receiving non-deferred GL commands, that is anything that does | 132 // We could be receiving non-deferred GL commands, that is anything that does |
133 // not need a framebuffer. | 133 // not need a framebuffer. |
134 if (!backbuffer_.service_id && !is_swap_buffers_pending_ && | 134 if (!backbuffer_.service_id && !is_swap_buffers_pending_ && |
135 backbuffer_suggested_allocation_) { | 135 backbuffer_suggested_allocation_) { |
136 CreateBackTexture(); | 136 CreateBackTexture(); |
137 | |
138 #ifndef NDEBUG | |
139 GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | |
140 if (status != GL_FRAMEBUFFER_COMPLETE) { | |
141 DLOG(ERROR) << "Framebuffer incomplete."; | |
142 glDeleteFramebuffersEXT(1, &fbo_id_); | |
143 fbo_id_ = 0; | |
144 return false; | |
145 } | |
146 #endif | |
147 } | 137 } |
148 return true; | 138 return true; |
149 } | 139 } |
150 | 140 |
151 unsigned int TextureImageTransportSurface::GetBackingFrameBufferObject() { | 141 unsigned int TextureImageTransportSurface::GetBackingFrameBufferObject() { |
152 return fbo_id_; | 142 return fbo_id_; |
153 } | 143 } |
154 | 144 |
155 void TextureImageTransportSurface::SetBackbufferAllocation(bool allocation) { | 145 void TextureImageTransportSurface::SetBackbufferAllocation(bool allocation) { |
156 DCHECK(!is_swap_buffers_pending_); | 146 DCHECK(!is_swap_buffers_pending_); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // at which point we consume the correct texture back. | 473 // at which point we consume the correct texture back. |
484 mailbox_manager_->ProduceTexture( | 474 mailbox_manager_->ProduceTexture( |
485 GL_TEXTURE_2D, | 475 GL_TEXTURE_2D, |
486 mailbox_name(texture.surface_handle), | 476 mailbox_name(texture.surface_handle), |
487 definition.release(), | 477 definition.release(), |
488 NULL); | 478 NULL); |
489 texture.service_id = 0; | 479 texture.service_id = 0; |
490 } | 480 } |
491 | 481 |
492 } // namespace content | 482 } // namespace content |
OLD | NEW |