From 819b0336fe95b920469d70e66757ffc651d0a1a1 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 31 Jan 2022 19:28:11 -0800 Subject: [PATCH] Cross reference issues and add additional tracing. --- .../display_list/display_list_dispatcher.cc | 26 ++++++++++++++++++- impeller/entity/entity_pass.cc | 3 +++ .../renderer/backend/metal/render_pass_mtl.mm | 2 ++ .../renderer/backend/metal/surface_mtl.mm | 2 +- impeller/renderer/renderer.cc | 2 ++ impeller/renderer/tessellator.cc | 2 ++ impeller/renderer/texture_descriptor.h | 4 +++ 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/impeller/display_list/display_list_dispatcher.cc b/impeller/display_list/display_list_dispatcher.cc index c349a55e5a5d6..dccbd1f86a4bf 100644 --- a/impeller/display_list/display_list_dispatcher.cc +++ b/impeller/display_list/display_list_dispatcher.cc @@ -4,6 +4,7 @@ #include "impeller/display_list/display_list_dispatcher.h" +#include "flutter/fml/trace_event.h" #include "impeller/geometry/path_builder.h" namespace impeller { @@ -73,11 +74,13 @@ void DisplayListDispatcher::setStrokeJoin(SkPaint::Join join) { // |flutter::Dispatcher| void DisplayListDispatcher::setShader(sk_sp shader) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } // |flutter::Dispatcher| void DisplayListDispatcher::setColorFilter(sk_sp filter) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -93,16 +96,19 @@ void DisplayListDispatcher::setBlendMode(SkBlendMode mode) { // |flutter::Dispatcher| void DisplayListDispatcher::setBlender(sk_sp blender) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } // |flutter::Dispatcher| void DisplayListDispatcher::setPathEffect(sk_sp effect) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } // |flutter::Dispatcher| void DisplayListDispatcher::setMaskFilter(sk_sp filter) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -396,6 +402,7 @@ void DisplayListDispatcher::drawPoints(SkCanvas::PointMode mode, // |flutter::Dispatcher| void DisplayListDispatcher::drawVertices(const sk_sp vertices, SkBlendMode mode) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -404,6 +411,7 @@ void DisplayListDispatcher::drawImage(const sk_sp image, const SkPoint point, const SkSamplingOptions& sampling, bool render_with_attributes) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -415,6 +423,7 @@ void DisplayListDispatcher::drawImageRect( const SkSamplingOptions& sampling, bool render_with_attributes, SkCanvas::SrcRectConstraint constraint) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -424,6 +433,7 @@ void DisplayListDispatcher::drawImageNine(const sk_sp image, const SkRect& dst, SkFilterMode filter, bool render_with_attributes) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -433,6 +443,7 @@ void DisplayListDispatcher::drawImageLattice(const sk_sp image, const SkRect& dst, SkFilterMode filter, bool render_with_attributes) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -446,6 +457,7 @@ void DisplayListDispatcher::drawAtlas(const sk_sp atlas, const SkSamplingOptions& sampling, const SkRect* cull_rect, bool render_with_attributes) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -453,6 +465,7 @@ void DisplayListDispatcher::drawAtlas(const sk_sp atlas, void DisplayListDispatcher::drawPicture(const sk_sp picture, const SkMatrix* matrix, bool render_with_attributes) { + // Needs https://github.com/flutter/flutter/issues/95434 UNIMPLEMENTED; } @@ -466,7 +479,17 @@ void DisplayListDispatcher::drawDisplayList( void DisplayListDispatcher::drawTextBlob(const sk_sp blob, SkScalar x, SkScalar y) { - UNIMPLEMENTED; + if (!blob) { + return; + } + + auto bounds = blob->bounds(); + bounds.fLeft += x; + bounds.fTop += y; + + impeller::Paint paint; + paint.color = impeller::Color::Random().WithAlpha(0.2); + canvas_.DrawRect(ToRect(bounds), paint); } // |flutter::Dispatcher| @@ -479,6 +502,7 @@ void DisplayListDispatcher::drawShadow(const SkPath& path, } Picture DisplayListDispatcher::EndRecordingAsPicture() { + TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture"); return canvas_.EndRecordingAsPicture(); } diff --git a/impeller/entity/entity_pass.cc b/impeller/entity/entity_pass.cc index eec7f0cbfd412..69c14c888a17b 100644 --- a/impeller/entity/entity_pass.cc +++ b/impeller/entity/entity_pass.cc @@ -4,6 +4,7 @@ #include "impeller/entity/entity_pass.h" +#include "flutter/fml/trace_event.h" #include "impeller/entity/content_context.h" #include "impeller/geometry/path_builder.h" #include "impeller/renderer/command_buffer.h" @@ -99,6 +100,8 @@ EntityPass* EntityPass::AddSubpass(std::unique_ptr pass) { bool EntityPass::Render(ContentContext& renderer, RenderPass& parent_pass) const { + TRACE_EVENT0("impeller", "EntityPass::Render"); + for (const auto& entity : entities_) { if (!entity.Render(renderer, parent_pass)) { return false; diff --git a/impeller/renderer/backend/metal/render_pass_mtl.mm b/impeller/renderer/backend/metal/render_pass_mtl.mm index cba003d628776..aa9d5737e93ab 100644 --- a/impeller/renderer/backend/metal/render_pass_mtl.mm +++ b/impeller/renderer/backend/metal/render_pass_mtl.mm @@ -6,6 +6,7 @@ #include "flutter/fml/closure.h" #include "flutter/fml/logging.h" +#include "flutter/fml/trace_event.h" #include "impeller/base/base.h" #include "impeller/renderer/backend/metal/device_buffer_mtl.h" #include "impeller/renderer/backend/metal/formats_mtl.h" @@ -156,6 +157,7 @@ static bool ConfigureStencilAttachment( } bool RenderPassMTL::EncodeCommands(Allocator& transients_allocator) const { + TRACE_EVENT0("impeller", "RenderPassMTL::EncodeCommands"); if (!IsValid()) { return false; } diff --git a/impeller/renderer/backend/metal/surface_mtl.mm b/impeller/renderer/backend/metal/surface_mtl.mm index 4c57ee21f6579..8b0c6e26ca4cf 100644 --- a/impeller/renderer/backend/metal/surface_mtl.mm +++ b/impeller/renderer/backend/metal/surface_mtl.mm @@ -15,7 +15,7 @@ std::unique_ptr SurfaceMTL::WrapCurrentMetalLayerDrawable( std::shared_ptr context, CAMetalLayer* layer) { - TRACE_EVENT0("flutter", __FUNCTION__); + TRACE_EVENT0("impeller", "SurfaceMTL::WrapCurrentMetalLayerDrawable"); if (context == nullptr || !context->IsValid() || layer == nil) { return nullptr; diff --git a/impeller/renderer/renderer.cc b/impeller/renderer/renderer.cc index ff055ee690da8..5507314fe87ef 100644 --- a/impeller/renderer/renderer.cc +++ b/impeller/renderer/renderer.cc @@ -7,6 +7,7 @@ #include #include "flutter/fml/logging.h" +#include "flutter/fml/trace_event.h" #include "impeller/base/validation.h" #include "impeller/renderer/command_buffer.h" #include "impeller/renderer/surface.h" @@ -33,6 +34,7 @@ bool Renderer::IsValid() const { bool Renderer::Render(std::unique_ptr surface, RenderCallback render_callback) const { + TRACE_EVENT0("impeller", "Renderer::Render"); if (!IsValid()) { return false; } diff --git a/impeller/renderer/tessellator.cc b/impeller/renderer/tessellator.cc index 9cc5d4ebba0cd..38d724b263c51 100644 --- a/impeller/renderer/tessellator.cc +++ b/impeller/renderer/tessellator.cc @@ -4,6 +4,7 @@ #include "impeller/renderer/tessellator.h" +#include "flutter/fml/trace_event.h" #include "third_party/libtess2/Include/tesselator.h" namespace impeller { @@ -36,6 +37,7 @@ static void DestroyTessellator(TESStesselator* tessellator) { bool Tessellator::Tessellate(const std::vector& contours, VertexCallback callback) const { + TRACE_EVENT0("impeller", "Tessellator::Tessellate"); if (!callback) { return false; } diff --git a/impeller/renderer/texture_descriptor.h b/impeller/renderer/texture_descriptor.h index da51479b0e4a5..20b9a367dddc3 100644 --- a/impeller/renderer/texture_descriptor.h +++ b/impeller/renderer/texture_descriptor.h @@ -12,6 +12,10 @@ namespace impeller { +//------------------------------------------------------------------------------ +/// @brief A lightweight object that describes the attributes of a texture +/// that can then used used an allocator to create that texture. +/// struct TextureDescriptor { TextureType type = TextureType::kTexture2D; PixelFormat format = PixelFormat::kUnknown;