Skip to content

Commit

Permalink
Cross reference issues and add additional tracing.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent f700873 commit 819b033
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 2 deletions.
26 changes: 25 additions & 1 deletion impeller/display_list/display_list_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -446,13 +457,15 @@ 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;
}

// |flutter::Dispatcher|
void DisplayListDispatcher::drawPicture(const sk_sp<SkPicture> picture,
const SkMatrix* matrix,
bool render_with_attributes) {
// Needs https://github.com/flutter/flutter/issues/95434
UNIMPLEMENTED;
}

Expand All @@ -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|
Expand All @@ -479,6 +502,7 @@ void DisplayListDispatcher::drawShadow(const SkPath& path,
}

Picture DisplayListDispatcher::EndRecordingAsPicture() {
TRACE_EVENT0("impeller", "DisplayListDispatcher::EndRecordingAsPicture");
return canvas_.EndRecordingAsPicture();
}

Expand Down
3 changes: 3 additions & 0 deletions impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/backend/metal/render_pass_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -156,6 +157,7 @@ static bool ConfigureStencilAttachment(
}

bool RenderPassMTL::EncodeCommands(Allocator& transients_allocator) const {
TRACE_EVENT0("impeller", "RenderPassMTL::EncodeCommands");
if (!IsValid()) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/metal/surface_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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;
Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions impeller/renderer/tessellator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "impeller/renderer/tessellator.h"

#include "flutter/fml/trace_event.h"
#include "third_party/libtess2/Include/tesselator.h"

namespace impeller {
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions impeller/renderer/texture_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 819b033

Please sign in to comment.