[Impeller] Uniquely label subpasses and root blit (flutter/engine#43015)
Makes subpasses easier to identify in frame captures.
This commit is contained in:
@@ -42,6 +42,7 @@ std::shared_ptr<Contents> PaintPassDelegate::CreateContentsForSubpassTarget(
|
||||
const Matrix& effect_transform) {
|
||||
auto contents = TextureContents::MakeRect(Rect::MakeSize(target->GetSize()));
|
||||
contents->SetTexture(target);
|
||||
contents->SetLabel("Subpass");
|
||||
contents->SetSourceRect(Rect::MakeSize(target->GetSize()));
|
||||
contents->SetOpacity(paint_.color.alpha);
|
||||
contents->SetDeferApplyingOpacity(true);
|
||||
@@ -134,6 +135,7 @@ OpacityPeepholePassDelegate::CreateContentsForSubpassTarget(
|
||||
std::shared_ptr<Texture> target,
|
||||
const Matrix& effect_transform) {
|
||||
auto contents = TextureContents::MakeRect(Rect::MakeSize(target->GetSize()));
|
||||
contents->SetLabel("Subpass");
|
||||
contents->SetTexture(target);
|
||||
contents->SetSourceRect(Rect::MakeSize(target->GetSize()));
|
||||
contents->SetOpacity(paint_.color.alpha);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "texture_contents.h"
|
||||
#include "impeller/entity/contents/texture_contents.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@@ -105,13 +105,13 @@ std::optional<Snapshot> TextureContents::RenderToSnapshot(
|
||||
}
|
||||
|
||||
static TextureFillVertexShader::PerVertexData ComputeVertexData(
|
||||
const Point& vtx,
|
||||
const Point& position,
|
||||
const Rect& coverage_rect,
|
||||
const ISize& texture_size,
|
||||
const Rect& source_rect) {
|
||||
TextureFillVertexShader::PerVertexData data;
|
||||
data.position = vtx;
|
||||
auto coverage_coords = (vtx - coverage_rect.origin) / coverage_rect.size;
|
||||
data.position = position;
|
||||
auto coverage_coords = (position - coverage_rect.origin) / coverage_rect.size;
|
||||
data.texture_coords =
|
||||
(source_rect.origin + source_rect.size * coverage_coords) / texture_size;
|
||||
return data;
|
||||
@@ -131,9 +131,9 @@ bool TextureContents::Render(const ContentContext& renderer,
|
||||
}
|
||||
|
||||
VertexBufferBuilder<VS::PerVertexData> vertex_builder;
|
||||
for (const auto vtx : rect_.GetPoints()) {
|
||||
for (const auto position : rect_.GetPoints()) {
|
||||
vertex_builder.AppendVertex(ComputeVertexData(
|
||||
vtx, coverage_rect, texture_->GetSize(), source_rect_));
|
||||
position, coverage_rect, texture_->GetSize(), source_rect_));
|
||||
}
|
||||
|
||||
auto& host_buffer = pass.GetTransientsBuffer();
|
||||
|
||||
@@ -283,6 +283,7 @@ bool EntityPass::Render(ContentContext& renderer,
|
||||
contents->SetTexture(
|
||||
offscreen_target.GetRenderTarget().GetRenderTargetTexture());
|
||||
contents->SetSourceRect(size_rect);
|
||||
contents->SetLabel("Root pass blit");
|
||||
|
||||
Entity entity;
|
||||
entity.SetContents(contents);
|
||||
|
||||
Reference in New Issue
Block a user