OLD | NEW |
---|---|
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2005 1.f, | 2005 1.f, |
2006 1.f)); | 2006 1.f)); |
2007 } | 2007 } |
2008 | 2008 |
2009 SetShaderOpacity(1.f, program->fragment_shader().alpha_location()); | 2009 SetShaderOpacity(1.f, program->fragment_shader().alpha_location()); |
2010 | 2010 |
2011 GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); | 2011 GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); |
2012 DrawQuadGeometry( | 2012 DrawQuadGeometry( |
2013 frame, draw_matrix, rect, program->vertex_shader().matrix_location()); | 2013 frame, draw_matrix, rect, program->vertex_shader().matrix_location()); |
2014 } | 2014 } |
2015 | 2015 // |
2016 void GLRenderer::Finish() { | 2016 //void GLRenderer::Finish() { |
2017 TRACE_EVENT0("cc", "GLRenderer::finish"); | 2017 // TRACE_EVENT0("cc", "GLRenderer::finish"); |
2018 context_->finish(); | 2018 // context_->finish(); |
2019 } | 2019 //} |
2020 | 2020 |
2021 void GLRenderer::SwapBuffers() { | 2021 void GLRenderer::SwapBuffers() { |
2022 DCHECK(visible_); | 2022 DCHECK(visible_); |
2023 DCHECK(!is_backbuffer_discarded_); | 2023 DCHECK(!is_backbuffer_discarded_); |
2024 | 2024 |
2025 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); | 2025 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); |
2026 // We're done! Time to swapbuffers! | 2026 // We're done! Time to swapbuffers! |
2027 | 2027 |
2028 CompositorFrame compositor_frame; | 2028 CompositorFrame compositor_frame; |
2029 compositor_frame.metadata = client_->MakeCompositorFrameMetadata(); | 2029 compositor_frame.metadata = client_->MakeCompositorFrameMetadata(); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2336 // Save the buffer to verify the callbacks happen in the expected order. | 2336 // Save the buffer to verify the callbacks happen in the expected order. |
2337 pending_async_read_pixels_.front()->buffer = buffer; | 2337 pending_async_read_pixels_.front()->buffer = buffer; |
2338 | 2338 |
2339 if (is_async) { | 2339 if (is_async) { |
2340 unsigned sync_point = context_->insertSyncPoint(); | 2340 unsigned sync_point = context_->insertSyncPoint(); |
2341 SyncPointHelper::SignalSyncPoint( | 2341 SyncPointHelper::SignalSyncPoint( |
2342 context_, | 2342 context_, |
2343 sync_point, | 2343 sync_point, |
2344 finished_callback); | 2344 finished_callback); |
2345 } else { | 2345 } else { |
2346 resource_provider_->Finish(); | 2346 // Can this be a flush? |
piman
2013/06/21 02:31:10
It can't because we're waiting on the the ReadPixe
| |
2347 // resource_provider_->Finish(); | |
2347 finished_callback.Run(); | 2348 finished_callback.Run(); |
2348 } | 2349 } |
2349 | 2350 |
2350 EnforceMemoryPolicy(); | 2351 EnforceMemoryPolicy(); |
2351 } | 2352 } |
2352 | 2353 |
2353 void GLRenderer::FinishedReadback( | 2354 void GLRenderer::FinishedReadback( |
2354 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, | 2355 const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, |
2355 unsigned source_buffer, | 2356 unsigned source_buffer, |
2356 uint8* dest_pixels, | 2357 uint8* dest_pixels, |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3029 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas | 3030 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas |
3030 // implementation. | 3031 // implementation. |
3031 return gr_context_ && context_->getContextAttributes().stencil; | 3032 return gr_context_ && context_->getContextAttributes().stencil; |
3032 } | 3033 } |
3033 | 3034 |
3034 bool GLRenderer::IsContextLost() { | 3035 bool GLRenderer::IsContextLost() { |
3035 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); | 3036 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
3036 } | 3037 } |
3037 | 3038 |
3038 } // namespace cc | 3039 } // namespace cc |
OLD | NEW |