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

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

Issue 2646243002: Use IDCompositionSurface to implement DirectCompositionSurfaceWin. (Closed)
Patch Set: rebase Created 3 years, 9 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 | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 DirectRenderer::~DirectRenderer() = default; 78 DirectRenderer::~DirectRenderer() = default;
79 79
80 void DirectRenderer::Initialize() { 80 void DirectRenderer::Initialize() {
81 overlay_processor_->Initialize(); 81 overlay_processor_->Initialize();
82 82
83 auto* context_provider = output_surface_->context_provider(); 83 auto* context_provider = output_surface_->context_provider();
84 84
85 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap(); 85 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap();
86 allow_empty_swap_ = use_partial_swap_; 86 allow_empty_swap_ = use_partial_swap_;
87 if (context_provider && 87 if (context_provider) {
88 context_provider->ContextCapabilities().commit_overlay_planes) 88 if (context_provider->ContextCapabilities().commit_overlay_planes)
89 allow_empty_swap_ = true; 89 allow_empty_swap_ = true;
90 if (context_provider->ContextCapabilities().set_draw_rectangle)
91 use_set_draw_rectangle_ = true;
92 }
90 93
91 initialized_ = true; 94 initialized_ = true;
92 } 95 }
93 96
94 // static 97 // static
95 gfx::RectF DirectRenderer::QuadVertexRect() { 98 gfx::RectF DirectRenderer::QuadVertexRect() {
96 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); 99 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
97 } 100 }
98 101
99 // static 102 // static
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 current_frame()->root_render_pass) { 507 current_frame()->root_render_pass) {
505 render_pass_scissor_in_draw_space.Intersect( 508 render_pass_scissor_in_draw_space.Intersect(
506 DeviceViewportRectInDrawSpace()); 509 DeviceViewportRectInDrawSpace());
507 } 510 }
508 511
509 if (use_partial_swap_) { 512 if (use_partial_swap_) {
510 render_pass_scissor_in_draw_space.Intersect( 513 render_pass_scissor_in_draw_space.Intersect(
511 current_frame()->ComputeScissorRectForRenderPass()); 514 current_frame()->ComputeScissorRectForRenderPass());
512 } 515 }
513 516
514 bool render_pass_is_clipped =
515 !render_pass_scissor_in_draw_space.Contains(surface_rect_in_draw_space);
516 bool is_root_render_pass = 517 bool is_root_render_pass =
517 current_frame()->current_render_pass == current_frame()->root_render_pass; 518 current_frame()->current_render_pass == current_frame()->root_render_pass;
519
520 // The SetDrawRectangleCHROMIUM spec requires that the scissor bit is always
521 // set on the root framebuffer or else the rendering may modify something
522 // outside the damage rectangle, even if the damage rectangle is the size of
523 // the full backbuffer.
524 bool render_pass_is_clipped =
525 (use_set_draw_rectangle_ && is_root_render_pass) ||
526 !render_pass_scissor_in_draw_space.Contains(surface_rect_in_draw_space);
518 bool has_external_stencil_test = 527 bool has_external_stencil_test =
519 is_root_render_pass && output_surface_->HasExternalStencilTest(); 528 is_root_render_pass && output_surface_->HasExternalStencilTest();
520 bool should_clear_surface = 529 bool should_clear_surface =
521 !has_external_stencil_test && 530 !has_external_stencil_test &&
522 (!is_root_render_pass || settings_->should_clear_root_render_pass); 531 (!is_root_render_pass || settings_->should_clear_root_render_pass);
523 532
524 // If |has_external_stencil_test| we can't discard or clear. Make sure we 533 // If |has_external_stencil_test| we can't discard or clear. Make sure we
525 // don't need to. 534 // don't need to.
526 DCHECK(!has_external_stencil_test || 535 DCHECK(!has_external_stencil_test ||
527 !current_frame()->current_render_pass->has_transparent_background); 536 !current_frame()->current_render_pass->has_transparent_background);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 585
577 DoDrawQuad(&quad, nullptr); 586 DoDrawQuad(&quad, nullptr);
578 } 587 }
579 FlushPolygons(&poly_list, render_pass_scissor_in_draw_space, 588 FlushPolygons(&poly_list, render_pass_scissor_in_draw_space,
580 render_pass_is_clipped); 589 render_pass_is_clipped);
581 FinishDrawingQuadList(); 590 FinishDrawingQuadList();
582 } 591 }
583 592
584 bool DirectRenderer::UseRenderPass(const RenderPass* render_pass) { 593 bool DirectRenderer::UseRenderPass(const RenderPass* render_pass) {
585 current_frame()->current_render_pass = render_pass; 594 current_frame()->current_render_pass = render_pass;
586 current_frame()->current_texture = NULL; 595 current_frame()->current_texture = nullptr;
587 if (render_pass == current_frame()->root_render_pass) { 596 if (render_pass == current_frame()->root_render_pass) {
588 BindFramebufferToOutputSurface(); 597 BindFramebufferToOutputSurface();
598
599 if (use_set_draw_rectangle_)
600 output_surface_->SetDrawRectangle(current_frame()->root_damage_rect);
589 InitializeViewport(current_frame(), render_pass->output_rect, 601 InitializeViewport(current_frame(), render_pass->output_rect,
590 gfx::Rect(current_frame()->device_viewport_size), 602 gfx::Rect(current_frame()->device_viewport_size),
591 current_frame()->device_viewport_size); 603 current_frame()->device_viewport_size);
592 return true; 604 return true;
593 } 605 }
594 606
595 ScopedResource* texture = render_pass_textures_[render_pass->id].get(); 607 ScopedResource* texture = render_pass_textures_[render_pass->id].get();
596 DCHECK(texture); 608 DCHECK(texture);
597 609
598 gfx::Size size = RenderPassTextureSize(render_pass); 610 gfx::Size size = RenderPassTextureSize(render_pass);
(...skipping 25 matching lines...) Expand all
624 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 636 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
625 return render_pass->output_rect.size(); 637 return render_pass->output_rect.size();
626 } 638 }
627 639
628 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { 640 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) {
629 current_frame_valid_ = true; 641 current_frame_valid_ = true;
630 current_frame_ = frame; 642 current_frame_ = frame;
631 } 643 }
632 644
633 } // namespace cc 645 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698