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

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

Issue 411643002: Early wait on texture resource sync points in gl_renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implemented danakj's suggestions. Created 6 years, 4 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
« no previous file with comments | « no previous file | cc/resources/resource_provider.h » ('j') | cc/resources/resource_provider.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/output/direct_renderer.h" 5 #include "cc/output/direct_renderer.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // Map from ([-1, -1] to [1, 1]) -> ([0, 0] to [1, 1]) 50 // Map from ([-1, -1] to [1, 1]) -> ([0, 0] to [1, 1])
51 canvas.Translate3d(0.5, 0.5, 0.5); 51 canvas.Translate3d(0.5, 0.5, 0.5);
52 canvas.Scale3d(0.5, 0.5, 0.5); 52 canvas.Scale3d(0.5, 0.5, 0.5);
53 53
54 return canvas; 54 return canvas;
55 } 55 }
56 56
57 namespace cc { 57 namespace cc {
58 58
59 static ResourceProvider::ResourceId WaitOnResourceSyncPoints(
60 ResourceProvider* resource_provider,
61 ResourceProvider::ResourceId resource_id) {
62 resource_provider->WaitSyncPointIfNeeded(resource_id);
63 return resource_id;
64 }
65
59 DirectRenderer::DrawingFrame::DrawingFrame() 66 DirectRenderer::DrawingFrame::DrawingFrame()
60 : root_render_pass(NULL), current_render_pass(NULL), current_texture(NULL) { 67 : root_render_pass(NULL), current_render_pass(NULL), current_texture(NULL) {
61 } 68 }
62 69
63 DirectRenderer::DrawingFrame::~DrawingFrame() {} 70 DirectRenderer::DrawingFrame::~DrawingFrame() {}
64 71
65 // 72 //
66 // static 73 // static
67 gfx::RectF DirectRenderer::QuadVertexRect() { 74 gfx::RectF DirectRenderer::QuadVertexRect() {
68 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); 75 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order, 225 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order,
219 &frame.overlay_list); 226 &frame.overlay_list);
220 227
221 EnsureBackbuffer(); 228 EnsureBackbuffer();
222 229
223 // Only reshape when we know we are going to draw. Otherwise, the reshape 230 // Only reshape when we know we are going to draw. Otherwise, the reshape
224 // can leave the window at the wrong size if we never draw and the proper 231 // can leave the window at the wrong size if we never draw and the proper
225 // viewport size is never set. 232 // viewport size is never set.
226 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor); 233 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor);
227 234
235 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame,
236 // so that drawing can proceed without GL context switching interruptions.
237 // crbug.com/394547
danakj 2014/08/13 23:05:19 git blame will point to the bug, i think you can d
vmiura 2014/08/15 21:20:39 Done.
238 DrawQuad::ResourceIteratorCallback wait_on_resource_syncpoints_callback =
239 base::Bind(&WaitOnResourceSyncPoints, resource_provider_);
240
241 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) {
242 RenderPass* pass = render_passes_in_draw_order->at(i);
243 for (size_t j = 0; j < pass->quad_list.size(); ++j) {
244 DrawQuad* quad = pass->quad_list[j];
245 quad->IterateResources(wait_on_resource_syncpoints_callback);
246 }
247 }
248
228 BeginDrawingFrame(&frame); 249 BeginDrawingFrame(&frame);
229 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { 250 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) {
230 RenderPass* pass = render_passes_in_draw_order->at(i); 251 RenderPass* pass = render_passes_in_draw_order->at(i);
231 DrawRenderPass(&frame, pass); 252 DrawRenderPass(&frame, pass);
232 253
233 for (ScopedPtrVector<CopyOutputRequest>::iterator it = 254 for (ScopedPtrVector<CopyOutputRequest>::iterator it =
234 pass->copy_requests.begin(); 255 pass->copy_requests.begin();
235 it != pass->copy_requests.end(); 256 it != pass->copy_requests.end();
236 ++it) { 257 ++it) {
237 if (i > 0) { 258 if (i > 0) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 ScopedResource* texture = render_pass_textures_.get(id); 440 ScopedResource* texture = render_pass_textures_.get(id);
420 return texture && texture->id(); 441 return texture && texture->id();
421 } 442 }
422 443
423 // static 444 // static
424 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 445 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
425 return render_pass->output_rect.size(); 446 return render_pass->output_rect.size();
426 } 447 }
427 448
428 } // namespace cc 449 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_provider.h » ('j') | cc/resources/resource_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698