Cross reference issues and add additional tracing.

This commit is contained in:
Chinmay Garde
2022-01-31 19:28:11 -08:00
committed by Dan Field
parent da1929b38b
commit 9c73955e36
7 changed files with 39 additions and 2 deletions

View File

@@ -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<SkShader> shader) {
// Needs https://github.com/flutter/flutter/issues/95434
UNIMPLEMENTED;
}
// |flutter::Dispatcher|
void DisplayListDispatcher::setColorFilter(sk_sp<SkColorFilter> 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<SkBlender> blender) {
// Needs https://github.com/flutter/flutter/issues/95434
UNIMPLEMENTED;
}
// |flutter::Dispatcher|
void DisplayListDispatcher::setPathEffect(sk_sp<SkPathEffect> effect) {
// Needs https://github.com/flutter/flutter/issues/95434
UNIMPLEMENTED;
}
// |flutter::Dispatcher|
void DisplayListDispatcher::setMaskFilter(sk_sp<SkMaskFilter> 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<SkVertices> vertices,
SkBlendMode mode) {
// Needs https://github.com/flutter/flutter/issues/95434
UNIMPLEMENTED;
}
@@ -404,6 +411,7 @@ void DisplayListDispatcher::drawImage(const sk_sp<SkImage> 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<SkImage> 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<SkImage> 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<SkImage> 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<SkImage> atlas,
void DisplayListDispatcher::drawPicture(const sk_sp<SkPicture> 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<SkTextBlob> 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();
}

View File

@@ -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<EntityPass> 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;

View File

@@ -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 @@ void RenderPassMTL::SetLabel(std::string label) {
}
bool RenderPassMTL::EncodeCommands(Allocator& transients_allocator) const {
TRACE_EVENT0("impeller", "RenderPassMTL::EncodeCommands");
if (!IsValid()) {
return false;
}

View File

@@ -15,7 +15,7 @@ namespace impeller {
std::unique_ptr<Surface> SurfaceMTL::WrapCurrentMetalLayerDrawable(
std::shared_ptr<Context> context,
CAMetalLayer* layer) {
TRACE_EVENT0("flutter", __FUNCTION__);
TRACE_EVENT0("impeller", "SurfaceMTL::WrapCurrentMetalLayerDrawable");
if (context == nullptr || !context->IsValid() || layer == nil) {
return nullptr;

View File

@@ -7,6 +7,7 @@
#include <algorithm>
#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> surface,
RenderCallback render_callback) const {
TRACE_EVENT0("impeller", "Renderer::Render");
if (!IsValid()) {
return false;
}

View File

@@ -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<Point>& contours,
VertexCallback callback) const {
TRACE_EVENT0("impeller", "Tessellator::Tessellate");
if (!callback) {
return false;
}

View File

@@ -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;