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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 SetShaderOpacity(1, program->fragment_shader().alpha_location()); | 1842 SetShaderOpacity(1, program->fragment_shader().alpha_location()); |
1843 DrawQuadGeometry( | 1843 DrawQuadGeometry( |
1844 frame, draw_matrix, rect, program->vertex_shader().matrix_location()); | 1844 frame, draw_matrix, rect, program->vertex_shader().matrix_location()); |
1845 } | 1845 } |
1846 | 1846 |
1847 void GLRenderer::Finish() { | 1847 void GLRenderer::Finish() { |
1848 TRACE_EVENT0("cc", "GLRenderer::finish"); | 1848 TRACE_EVENT0("cc", "GLRenderer::finish"); |
1849 context_->finish(); | 1849 context_->finish(); |
1850 } | 1850 } |
1851 | 1851 |
1852 bool GLRenderer::SwapBuffers() { | 1852 bool GLRenderer::SwapBuffers(const LatencyInfo& latency_info) { |
1853 DCHECK(visible_); | 1853 DCHECK(visible_); |
1854 DCHECK(!is_backbuffer_discarded_); | 1854 DCHECK(!is_backbuffer_discarded_); |
1855 | 1855 |
1856 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); | 1856 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); |
1857 // We're done! Time to swapbuffers! | 1857 // We're done! Time to swapbuffers! |
1858 | 1858 |
1859 if (capabilities_.using_partial_swap && client_->AllowPartialSwap()) { | 1859 if (capabilities_.using_partial_swap && client_->AllowPartialSwap()) { |
1860 // If supported, we can save significant bandwidth by only swapping the | 1860 // If supported, we can save significant bandwidth by only swapping the |
1861 // damaged/scissored region (clamped to the viewport) | 1861 // damaged/scissored region (clamped to the viewport) |
1862 swap_buffer_rect_.Intersect(gfx::Rect(ViewportSize())); | 1862 swap_buffer_rect_.Intersect(gfx::Rect(ViewportSize())); |
1863 int flipped_y_pos_of_rect_bottom = | 1863 int flipped_y_pos_of_rect_bottom = |
1864 ViewportHeight() - swap_buffer_rect_.y() - swap_buffer_rect_.height(); | 1864 ViewportHeight() - swap_buffer_rect_.y() - swap_buffer_rect_.height(); |
1865 output_surface_->PostSubBuffer(gfx::Rect(swap_buffer_rect_.x(), | 1865 output_surface_->PostSubBuffer(gfx::Rect(swap_buffer_rect_.x(), |
1866 flipped_y_pos_of_rect_bottom, | 1866 flipped_y_pos_of_rect_bottom, |
1867 swap_buffer_rect_.width(), | 1867 swap_buffer_rect_.width(), |
1868 swap_buffer_rect_.height()), | 1868 swap_buffer_rect_.height()), |
1869 LatencyInfo()); | 1869 latency_info); |
1870 } else { | 1870 } else { |
1871 output_surface_->SwapBuffers(LatencyInfo()); | 1871 output_surface_->SwapBuffers(latency_info); |
1872 } | 1872 } |
1873 | 1873 |
1874 swap_buffer_rect_ = gfx::Rect(); | 1874 swap_buffer_rect_ = gfx::Rect(); |
1875 | 1875 |
1876 // We don't have real fences, so we mark read fences as passed | 1876 // We don't have real fences, so we mark read fences as passed |
1877 // assuming a double-buffered GPU pipeline. A texture can be | 1877 // assuming a double-buffered GPU pipeline. A texture can be |
1878 // written to after one full frame has past since it was last read. | 1878 // written to after one full frame has past since it was last read. |
1879 if (last_swap_fence_) | 1879 if (last_swap_fence_) |
1880 static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed(); | 1880 static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed(); |
1881 last_swap_fence_ = resource_provider_->GetReadLockFence(); | 1881 last_swap_fence_ = resource_provider_->GetReadLockFence(); |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 2571 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
2572 | 2572 |
2573 ReleaseRenderPassTextures(); | 2573 ReleaseRenderPassTextures(); |
2574 } | 2574 } |
2575 | 2575 |
2576 bool GLRenderer::IsContextLost() { | 2576 bool GLRenderer::IsContextLost() { |
2577 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); | 2577 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
2578 } | 2578 } |
2579 | 2579 |
2580 } // namespace cc | 2580 } // namespace cc |
OLD | NEW |