Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order, | 219 overlay_processor_->ProcessForOverlays(render_passes_in_draw_order, |
| 220 &frame.overlay_list); | 220 &frame.overlay_list); |
| 221 | 221 |
| 222 EnsureBackbuffer(); | 222 EnsureBackbuffer(); |
| 223 | 223 |
| 224 // Only reshape when we know we are going to draw. Otherwise, the reshape | 224 // Only reshape when we know we are going to draw. Otherwise, the reshape |
| 225 // can leave the window at the wrong size if we never draw and the proper | 225 // can leave the window at the wrong size if we never draw and the proper |
| 226 // viewport size is never set. | 226 // viewport size is never set. |
| 227 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor); | 227 output_surface_->Reshape(device_viewport_rect.size(), device_scale_factor); |
| 228 | 228 |
| 229 // Try to lock resources first. | |
| 230 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { | |
| 231 RenderPass* pass = render_passes_in_draw_order->at(i); | |
| 232 PrelockRenderPass(&frame, pass); | |
| 233 } | |
| 234 | |
| 229 BeginDrawingFrame(&frame); | 235 BeginDrawingFrame(&frame); |
| 230 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { | 236 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { |
| 231 RenderPass* pass = render_passes_in_draw_order->at(i); | 237 RenderPass* pass = render_passes_in_draw_order->at(i); |
| 232 DrawRenderPass(&frame, pass); | 238 DrawRenderPass(&frame, pass); |
| 233 | 239 |
| 234 for (ScopedPtrVector<CopyOutputRequest>::iterator it = | 240 for (ScopedPtrVector<CopyOutputRequest>::iterator it = |
| 235 pass->copy_requests.begin(); | 241 pass->copy_requests.begin(); |
| 236 it != pass->copy_requests.end(); | 242 it != pass->copy_requests.end(); |
| 237 ++it) { | 243 ++it) { |
| 238 if (i > 0) { | 244 if (i > 0) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 const DrawingFrame* frame, | 328 const DrawingFrame* frame, |
| 323 const gfx::Rect& draw_space_rect) { | 329 const gfx::Rect& draw_space_rect) { |
| 324 gfx::Rect window_space_rect = MoveFromDrawToWindowSpace(draw_space_rect); | 330 gfx::Rect window_space_rect = MoveFromDrawToWindowSpace(draw_space_rect); |
| 325 if (NeedDeviceClip(frame)) | 331 if (NeedDeviceClip(frame)) |
| 326 window_space_rect.Intersect(DeviceClipRectInWindowSpace(frame)); | 332 window_space_rect.Intersect(DeviceClipRectInWindowSpace(frame)); |
| 327 SetScissorTestRect(window_space_rect); | 333 SetScissorTestRect(window_space_rect); |
| 328 } | 334 } |
| 329 | 335 |
| 330 void DirectRenderer::FinishDrawingQuadList() {} | 336 void DirectRenderer::FinishDrawingQuadList() {} |
| 331 | 337 |
| 338 void DirectRenderer::PrelockRenderPass(DrawingFrame* frame, | |
| 339 const RenderPass* render_pass) { | |
| 340 const QuadList& quad_list = render_pass->quad_list; | |
| 341 int i = 0; | |
| 342 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | |
| 343 it != quad_list.BackToFrontEnd(); | |
| 344 ++it) { | |
|
danakj
2014/08/13 13:52:12
You can IterateResources here to get each of the r
vmiura
2014/08/13 22:50:39
Done.
| |
| 345 DoPrelockQuad(frame, *it); | |
| 346 i++; | |
| 347 } | |
| 348 } | |
| 349 | |
| 332 void DirectRenderer::DrawRenderPass(DrawingFrame* frame, | 350 void DirectRenderer::DrawRenderPass(DrawingFrame* frame, |
| 333 const RenderPass* render_pass) { | 351 const RenderPass* render_pass) { |
| 334 TRACE_EVENT0("cc", "DirectRenderer::DrawRenderPass"); | 352 TRACE_EVENT0("cc", "DirectRenderer::DrawRenderPass"); |
| 335 if (!UseRenderPass(frame, render_pass)) | 353 if (!UseRenderPass(frame, render_pass)) |
| 336 return; | 354 return; |
| 337 | 355 |
| 338 bool using_scissor_as_optimization = Capabilities().using_partial_swap; | 356 bool using_scissor_as_optimization = Capabilities().using_partial_swap; |
| 339 gfx::Rect render_pass_scissor; | 357 gfx::Rect render_pass_scissor; |
| 340 bool draw_rect_covers_full_surface = true; | 358 bool draw_rect_covers_full_surface = true; |
| 341 if (frame->current_render_pass == frame->root_render_pass && | 359 if (frame->current_render_pass == frame->root_render_pass && |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 ScopedResource* texture = render_pass_textures_.get(id); | 438 ScopedResource* texture = render_pass_textures_.get(id); |
| 421 return texture && texture->id(); | 439 return texture && texture->id(); |
| 422 } | 440 } |
| 423 | 441 |
| 424 // static | 442 // static |
| 425 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 443 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 426 return render_pass->output_rect.size(); | 444 return render_pass->output_rect.size(); |
| 427 } | 445 } |
| 428 | 446 |
| 429 } // namespace cc | 447 } // namespace cc |
| OLD | NEW |