Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 14092003: Add compositor support for the LatencyInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 SetShaderOpacity(1, program->fragment_shader().alpha_location()); 1847 SetShaderOpacity(1, program->fragment_shader().alpha_location());
1848 DrawQuadGeometry( 1848 DrawQuadGeometry(
1849 frame, draw_matrix, rect, program->vertex_shader().matrix_location()); 1849 frame, draw_matrix, rect, program->vertex_shader().matrix_location());
1850 } 1850 }
1851 1851
1852 void GLRenderer::Finish() { 1852 void GLRenderer::Finish() {
1853 TRACE_EVENT0("cc", "GLRenderer::finish"); 1853 TRACE_EVENT0("cc", "GLRenderer::finish");
1854 context_->finish(); 1854 context_->finish();
1855 } 1855 }
1856 1856
1857 bool GLRenderer::SwapBuffers() { 1857 bool GLRenderer::SwapBuffers(const LatencyInfo& latency_info) {
1858 DCHECK(visible_); 1858 DCHECK(visible_);
1859 DCHECK(!is_backbuffer_discarded_); 1859 DCHECK(!is_backbuffer_discarded_);
1860 1860
1861 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); 1861 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers");
1862 // We're done! Time to swapbuffers! 1862 // We're done! Time to swapbuffers!
1863 1863
1864 if (capabilities_.using_partial_swap && client_->AllowPartialSwap()) { 1864 if (capabilities_.using_partial_swap && client_->AllowPartialSwap()) {
1865 // If supported, we can save significant bandwidth by only swapping the 1865 // If supported, we can save significant bandwidth by only swapping the
1866 // damaged/scissored region (clamped to the viewport) 1866 // damaged/scissored region (clamped to the viewport)
1867 swap_buffer_rect_.Intersect(gfx::Rect(ViewportSize())); 1867 swap_buffer_rect_.Intersect(gfx::Rect(ViewportSize()));
1868 int flipped_y_pos_of_rect_bottom = 1868 int flipped_y_pos_of_rect_bottom =
1869 ViewportHeight() - swap_buffer_rect_.y() - swap_buffer_rect_.height(); 1869 ViewportHeight() - swap_buffer_rect_.y() - swap_buffer_rect_.height();
1870 output_surface_->PostSubBuffer(gfx::Rect(swap_buffer_rect_.x(), 1870 output_surface_->PostSubBuffer(gfx::Rect(swap_buffer_rect_.x(),
1871 flipped_y_pos_of_rect_bottom, 1871 flipped_y_pos_of_rect_bottom,
1872 swap_buffer_rect_.width(), 1872 swap_buffer_rect_.width(),
1873 swap_buffer_rect_.height()), 1873 swap_buffer_rect_.height()),
1874 LatencyInfo()); 1874 latency_info);
1875 } else { 1875 } else {
1876 output_surface_->SwapBuffers(LatencyInfo()); 1876 output_surface_->SwapBuffers(latency_info);
1877 } 1877 }
1878 1878
1879 swap_buffer_rect_ = gfx::Rect(); 1879 swap_buffer_rect_ = gfx::Rect();
1880 1880
1881 // We don't have real fences, so we mark read fences as passed 1881 // We don't have real fences, so we mark read fences as passed
1882 // assuming a double-buffered GPU pipeline. A texture can be 1882 // assuming a double-buffered GPU pipeline. A texture can be
1883 // written to after one full frame has past since it was last read. 1883 // written to after one full frame has past since it was last read.
1884 if (last_swap_fence_) 1884 if (last_swap_fence_)
1885 static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed(); 1885 static_cast<SimpleSwapFence*>(last_swap_fence_.get())->SetHasPassed();
1886 last_swap_fence_ = resource_provider_->GetReadLockFence(); 1886 last_swap_fence_ = resource_provider_->GetReadLockFence();
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); 2584 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_);
2585 2585
2586 ReleaseRenderPassTextures(); 2586 ReleaseRenderPassTextures();
2587 } 2587 }
2588 2588
2589 bool GLRenderer::IsContextLost() { 2589 bool GLRenderer::IsContextLost() {
2590 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 2590 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR);
2591 } 2591 }
2592 2592
2593 } // namespace cc 2593 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698