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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 } | 459 } |
460 | 460 |
461 static ResourceProvider::ResourceId WaitOnResourceSyncPoints( | 461 static ResourceProvider::ResourceId WaitOnResourceSyncPoints( |
462 ResourceProvider* resource_provider, | 462 ResourceProvider* resource_provider, |
463 ResourceProvider::ResourceId resource_id) { | 463 ResourceProvider::ResourceId resource_id) { |
464 resource_provider->WaitSyncPointIfNeeded(resource_id); | 464 resource_provider->WaitSyncPointIfNeeded(resource_id); |
465 return resource_id; | 465 return resource_id; |
466 } | 466 } |
467 | 467 |
468 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { | 468 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { |
469 if (frame->device_viewport_rect.IsEmpty()) | |
470 return; | |
471 | |
472 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame"); | 469 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame"); |
473 | 470 |
474 scoped_refptr<ResourceProvider::Fence> read_lock_fence; | 471 scoped_refptr<ResourceProvider::Fence> read_lock_fence; |
475 if (use_sync_query_) { | 472 if (use_sync_query_) { |
476 // Block until oldest sync query has passed if the number of pending queries | 473 // Block until oldest sync query has passed if the number of pending queries |
477 // ever reach kMaxPendingSyncQueries. | 474 // ever reach kMaxPendingSyncQueries. |
478 if (pending_sync_queries_.size() >= kMaxPendingSyncQueries) { | 475 if (pending_sync_queries_.size() >= kMaxPendingSyncQueries) { |
479 LOG(ERROR) << "Reached limit of pending sync queries."; | 476 LOG(ERROR) << "Reached limit of pending sync queries."; |
480 | 477 |
481 pending_sync_queries_.front()->Wait(); | 478 pending_sync_queries_.front()->Wait(); |
(...skipping 10 matching lines...) Expand all Loading... | |
492 current_sync_query_ = available_sync_queries_.empty() | 489 current_sync_query_ = available_sync_queries_.empty() |
493 ? make_scoped_ptr(new SyncQuery(gl_)) | 490 ? make_scoped_ptr(new SyncQuery(gl_)) |
494 : available_sync_queries_.take_front(); | 491 : available_sync_queries_.take_front(); |
495 | 492 |
496 read_lock_fence = current_sync_query_->Begin(); | 493 read_lock_fence = current_sync_query_->Begin(); |
497 } else { | 494 } else { |
498 read_lock_fence = make_scoped_refptr(new FallbackFence(gl_)); | 495 read_lock_fence = make_scoped_refptr(new FallbackFence(gl_)); |
499 } | 496 } |
500 resource_provider_->SetReadLockFence(read_lock_fence.get()); | 497 resource_provider_->SetReadLockFence(read_lock_fence.get()); |
501 | 498 |
499 if (frame->device_viewport_rect.IsEmpty()) | |
danakj
2014/10/29 15:18:26
If there's an empty viewport can you not just make
reveman
2014/10/29 16:14:52
Maybe. It would assume that we're not performing a
danakj
2014/10/29 17:04:38
ie make DirectRenderer check this? That sounds goo
| |
500 return; | |
501 | |
502 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame, | 502 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame, |
503 // so that drawing can proceed without GL context switching interruptions. | 503 // so that drawing can proceed without GL context switching interruptions. |
504 DrawQuad::ResourceIteratorCallback wait_on_resource_syncpoints_callback = | 504 DrawQuad::ResourceIteratorCallback wait_on_resource_syncpoints_callback = |
505 base::Bind(&WaitOnResourceSyncPoints, resource_provider_); | 505 base::Bind(&WaitOnResourceSyncPoints, resource_provider_); |
506 | 506 |
507 for (size_t i = 0; i < frame->render_passes_in_draw_order->size(); ++i) { | 507 for (size_t i = 0; i < frame->render_passes_in_draw_order->size(); ++i) { |
508 RenderPass* pass = frame->render_passes_in_draw_order->at(i); | 508 RenderPass* pass = frame->render_passes_in_draw_order->at(i); |
509 for (auto& quad : pass->quad_list) | 509 for (auto& quad : pass->quad_list) |
510 quad.IterateResources(wait_on_resource_syncpoints_callback); | 510 quad.IterateResources(wait_on_resource_syncpoints_callback); |
511 } | 511 } |
(...skipping 2849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3361 context_support_->ScheduleOverlayPlane( | 3361 context_support_->ScheduleOverlayPlane( |
3362 overlay.plane_z_order, | 3362 overlay.plane_z_order, |
3363 overlay.transform, | 3363 overlay.transform, |
3364 pending_overlay_resources_.back()->texture_id(), | 3364 pending_overlay_resources_.back()->texture_id(), |
3365 overlay.display_rect, | 3365 overlay.display_rect, |
3366 overlay.uv_rect); | 3366 overlay.uv_rect); |
3367 } | 3367 } |
3368 } | 3368 } |
3369 | 3369 |
3370 } // namespace cc | 3370 } // namespace cc |
OLD | NEW |