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/renderer/gpu/mailbox_output_surface.h" | 5 #include "content/renderer/gpu/mailbox_output_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/output/compositor_frame_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
10 #include "cc/output/gl_frame_data.h" | 10 #include "cc/output/gl_frame_data.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 uint32 texture_id = pending_textures_.front().texture_id; | 156 uint32 texture_id = pending_textures_.front().texture_id; |
157 if (texture_id) | 157 if (texture_id) |
158 context3d_->deleteTexture(texture_id); | 158 context3d_->deleteTexture(texture_id); |
159 pending_textures_.pop_front(); | 159 pending_textures_.pop_front(); |
160 } | 160 } |
161 CompositorOutputSurface::OnSwapAck(ack); | 161 CompositorOutputSurface::OnSwapAck(ack); |
162 } | 162 } |
163 | 163 |
164 void MailboxOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { | 164 void MailboxOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
165 DCHECK(frame->gl_frame_data); | 165 DCHECK(frame->gl_frame_data); |
166 DCHECK(frame->gl_frame_data->sub_buffer_rect.size() == | |
167 frame->gl_frame_data->size) | |
168 << "Partial swap not supported with composite-to-mailbox yet."; | |
169 | |
170 DCHECK(!surface_size_.IsEmpty()); | 166 DCHECK(!surface_size_.IsEmpty()); |
171 DCHECK(surface_size_ == current_backing_.size); | 167 DCHECK(surface_size_ == current_backing_.size); |
172 DCHECK(frame->gl_frame_data->size == current_backing_.size); | 168 DCHECK(frame->gl_frame_data->size == current_backing_.size); |
173 DCHECK(!current_backing_.mailbox.IsZero()); | 169 DCHECK(!current_backing_.mailbox.IsZero()); |
174 | 170 |
175 frame->gl_frame_data->mailbox = current_backing_.mailbox; | 171 frame->gl_frame_data->mailbox = current_backing_.mailbox; |
176 context3d_->flush(); | 172 context3d_->flush(); |
177 frame->gl_frame_data->sync_point = context3d_->insertSyncPoint(); | 173 frame->gl_frame_data->sync_point = context3d_->insertSyncPoint(); |
178 CompositorOutputSurface::SwapBuffers(frame); | 174 CompositorOutputSurface::SwapBuffers(frame); |
179 | 175 |
180 pending_textures_.push_back(current_backing_); | 176 pending_textures_.push_back(current_backing_); |
181 current_backing_ = TransferableFrame(); | 177 current_backing_ = TransferableFrame(); |
182 } | 178 } |
183 | 179 |
184 size_t MailboxOutputSurface::GetNumAcksPending() { | 180 size_t MailboxOutputSurface::GetNumAcksPending() { |
185 DCHECK(pending_textures_.size()); | 181 DCHECK(pending_textures_.size()); |
186 return pending_textures_.size() - 1; | 182 return pending_textures_.size() - 1; |
187 } | 183 } |
188 | 184 |
189 } // namespace content | 185 } // namespace content |
OLD | NEW |