OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 RenderPass::Id target_render_pass_id = | 595 RenderPass::Id target_render_pass_id = |
596 it.target_render_surface_layer()->render_surface()->RenderPassId(); | 596 it.target_render_surface_layer()->render_surface()->RenderPassId(); |
597 RenderPass* target_render_pass = | 597 RenderPass* target_render_pass = |
598 frame->render_passes_by_id[target_render_pass_id]; | 598 frame->render_passes_by_id[target_render_pass_id]; |
599 | 599 |
600 bool prevent_occlusion = | 600 bool prevent_occlusion = |
601 it.target_render_surface_layer()->HasRequestCopyCallback(); | 601 it.target_render_surface_layer()->HasRequestCopyCallback(); |
602 occlusion_tracker.EnterLayer(it, prevent_occlusion); | 602 occlusion_tracker.EnterLayer(it, prevent_occlusion); |
603 | 603 |
604 AppendQuadsData append_quads_data(target_render_pass->id); | 604 AppendQuadsData append_quads_data(target_render_pass->id); |
| 605 if (output_surface_->ForcedDrawToSoftwareDevice()) |
| 606 append_quads_data.cannot_append_tile_draw_quads = true; |
605 | 607 |
606 if (it.represents_target_render_surface()) { | 608 if (it.represents_target_render_surface()) { |
607 if (it->HasRequestCopyCallback()) { | 609 if (it->HasRequestCopyCallback()) { |
608 have_copy_request = true; | 610 have_copy_request = true; |
609 it->TakeRequestCopyCallbacks(&target_render_pass->copy_callbacks); | 611 it->TakeRequestCopyCallbacks(&target_render_pass->copy_callbacks); |
610 } | 612 } |
611 } else if (it.represents_contributing_render_surface()) { | 613 } else if (it.represents_contributing_render_surface()) { |
612 RenderPass::Id contributing_render_pass_id = | 614 RenderPass::Id contributing_render_pass_id = |
613 it->render_surface()->RenderPassId(); | 615 it->render_surface()->RenderPassId(); |
614 RenderPass* contributing_render_pass = | 616 RenderPass* contributing_render_pass = |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 active_tree_->background_color(), | 708 active_tree_->background_color(), |
707 occlusion_tracker); | 709 occlusion_tracker); |
708 } | 710 } |
709 | 711 |
710 if (draw_frame) | 712 if (draw_frame) |
711 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); | 713 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); |
712 else | 714 else |
713 DCHECK(!have_copy_request); | 715 DCHECK(!have_copy_request); |
714 | 716 |
715 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); | 717 RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame); |
716 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); | 718 if (!output_surface_->ForcedDrawToSoftwareDevice()) |
| 719 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); |
717 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), | 720 RemoveRenderPasses(CullRenderPassesWithCachedTextures(renderer_.get()), |
718 frame); | 721 frame); |
719 | 722 |
720 // If we're making a frame to draw, it better have at least one render pass. | 723 // If we're making a frame to draw, it better have at least one render pass. |
721 DCHECK(!frame->render_passes.empty()); | 724 DCHECK(!frame->render_passes.empty()); |
722 return draw_frame; | 725 return draw_frame; |
723 } | 726 } |
724 | 727 |
725 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( | 728 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( |
726 bool should_background_tick) { | 729 bool should_background_tick) { |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 TRACE_EVENT_INSTANT1("cc.debug", "Frame", TRACE_EVENT_SCOPE_THREAD, | 1112 TRACE_EVENT_INSTANT1("cc.debug", "Frame", TRACE_EVENT_SCOPE_THREAD, |
1110 "frame", ValueToString(FrameStateAsValue())); | 1113 "frame", ValueToString(FrameStateAsValue())); |
1111 } | 1114 } |
1112 | 1115 |
1113 // Because the contents of the HUD depend on everything else in the frame, the | 1116 // Because the contents of the HUD depend on everything else in the frame, the |
1114 // contents of its texture are updated as the last thing before the frame is | 1117 // contents of its texture are updated as the last thing before the frame is |
1115 // drawn. | 1118 // drawn. |
1116 if (active_tree_->hud_layer()) | 1119 if (active_tree_->hud_layer()) |
1117 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); | 1120 active_tree_->hud_layer()->UpdateHudTexture(resource_provider_.get()); |
1118 | 1121 |
1119 renderer_->DrawFrame(&frame->render_passes); | 1122 if (output_surface_->ForcedDrawToSoftwareDevice()) { |
| 1123 scoped_ptr<SoftwareRenderer> temp_software_renderer = |
| 1124 SoftwareRenderer::Create(this, output_surface_.get(), NULL); |
| 1125 temp_software_renderer->DrawFrame(&frame->render_passes); |
| 1126 } else { |
| 1127 renderer_->DrawFrame(&frame->render_passes); |
| 1128 } |
1120 // The render passes should be consumed by the renderer. | 1129 // The render passes should be consumed by the renderer. |
1121 DCHECK(frame->render_passes.empty()); | 1130 DCHECK(frame->render_passes.empty()); |
1122 frame->render_passes_by_id.clear(); | 1131 frame->render_passes_by_id.clear(); |
1123 | 1132 |
1124 // The next frame should start by assuming nothing has changed, and changes | 1133 // The next frame should start by assuming nothing has changed, and changes |
1125 // are noted as they occur. | 1134 // are noted as they occur. |
1126 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { | 1135 for (size_t i = 0; i < frame->render_surface_layer_list->size(); i++) { |
1127 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()-> | 1136 (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()-> |
1128 DidDrawDamagedArea(); | 1137 DidDrawDamagedArea(); |
1129 } | 1138 } |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 } | 2169 } |
2161 | 2170 |
2162 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2171 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2163 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2172 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2164 paint_time_counter_->ClearHistory(); | 2173 paint_time_counter_->ClearHistory(); |
2165 | 2174 |
2166 debug_state_ = debug_state; | 2175 debug_state_ = debug_state; |
2167 } | 2176 } |
2168 | 2177 |
2169 } // namespace cc | 2178 } // namespace cc |
OLD | NEW |