Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0c49792

Browse files
authored
Revert "[Impeller Scene] Add DisplayList OP and Dart bindings (#38676)"
This reverts commit 716bb91.
1 parent c1d61cf commit 0c49792

29 files changed

+88
-810
lines changed

ci/licenses_golden/licenses_flutter

+2-14
Original file line numberDiff line numberDiff line change
@@ -1703,8 +1703,7 @@ ORIGIN: ../../../flutter/lib/ui/dart_runtime_hooks.h + ../../../flutter/LICENSE
17031703
ORIGIN: ../../../flutter/lib/ui/dart_ui.cc + ../../../flutter/LICENSE
17041704
ORIGIN: ../../../flutter/lib/ui/dart_ui.h + ../../../flutter/LICENSE
17051705
ORIGIN: ../../../flutter/lib/ui/dart_wrapper.h + ../../../flutter/LICENSE
1706-
ORIGIN: ../../../flutter/lib/ui/experiments/scene.dart + ../../../flutter/LICENSE
1707-
ORIGIN: ../../../flutter/lib/ui/experiments/setup_hooks.dart + ../../../flutter/LICENSE
1706+
ORIGIN: ../../../flutter/lib/ui/experiments/compositing_3d.dart + ../../../flutter/LICENSE
17081707
ORIGIN: ../../../flutter/lib/ui/experiments/ui.dart + ../../../flutter/LICENSE
17091708
ORIGIN: ../../../flutter/lib/ui/geometry.dart + ../../../flutter/LICENSE
17101709
ORIGIN: ../../../flutter/lib/ui/hash_codes.dart + ../../../flutter/LICENSE
@@ -1784,10 +1783,6 @@ ORIGIN: ../../../flutter/lib/ui/painting/picture_recorder.cc + ../../../flutter/
17841783
ORIGIN: ../../../flutter/lib/ui/painting/picture_recorder.h + ../../../flutter/LICENSE
17851784
ORIGIN: ../../../flutter/lib/ui/painting/rrect.cc + ../../../flutter/LICENSE
17861785
ORIGIN: ../../../flutter/lib/ui/painting/rrect.h + ../../../flutter/LICENSE
1787-
ORIGIN: ../../../flutter/lib/ui/painting/scene/scene_node.cc + ../../../flutter/LICENSE
1788-
ORIGIN: ../../../flutter/lib/ui/painting/scene/scene_node.h + ../../../flutter/LICENSE
1789-
ORIGIN: ../../../flutter/lib/ui/painting/scene/scene_shader.cc + ../../../flutter/LICENSE
1790-
ORIGIN: ../../../flutter/lib/ui/painting/scene/scene_shader.h + ../../../flutter/LICENSE
17911786
ORIGIN: ../../../flutter/lib/ui/painting/shader.cc + ../../../flutter/LICENSE
17921787
ORIGIN: ../../../flutter/lib/ui/painting/shader.h + ../../../flutter/LICENSE
17931788
ORIGIN: ../../../flutter/lib/ui/painting/single_frame_codec.cc + ../../../flutter/LICENSE
@@ -1810,7 +1805,6 @@ ORIGIN: ../../../flutter/lib/ui/semantics/semantics_update_builder.cc + ../../..
18101805
ORIGIN: ../../../flutter/lib/ui/semantics/semantics_update_builder.h + ../../../flutter/LICENSE
18111806
ORIGIN: ../../../flutter/lib/ui/semantics/string_attribute.cc + ../../../flutter/LICENSE
18121807
ORIGIN: ../../../flutter/lib/ui/semantics/string_attribute.h + ../../../flutter/LICENSE
1813-
ORIGIN: ../../../flutter/lib/ui/setup_hooks.dart + ../../../flutter/LICENSE
18141808
ORIGIN: ../../../flutter/lib/ui/snapshot_delegate.h + ../../../flutter/LICENSE
18151809
ORIGIN: ../../../flutter/lib/ui/text.dart + ../../../flutter/LICENSE
18161810
ORIGIN: ../../../flutter/lib/ui/text/asset_manager_font_provider.cc + ../../../flutter/LICENSE
@@ -4184,8 +4178,7 @@ FILE: ../../../flutter/lib/ui/dart_runtime_hooks.h
41844178
FILE: ../../../flutter/lib/ui/dart_ui.cc
41854179
FILE: ../../../flutter/lib/ui/dart_ui.h
41864180
FILE: ../../../flutter/lib/ui/dart_wrapper.h
4187-
FILE: ../../../flutter/lib/ui/experiments/scene.dart
4188-
FILE: ../../../flutter/lib/ui/experiments/setup_hooks.dart
4181+
FILE: ../../../flutter/lib/ui/experiments/compositing_3d.dart
41894182
FILE: ../../../flutter/lib/ui/experiments/ui.dart
41904183
FILE: ../../../flutter/lib/ui/geometry.dart
41914184
FILE: ../../../flutter/lib/ui/hash_codes.dart
@@ -4265,10 +4258,6 @@ FILE: ../../../flutter/lib/ui/painting/picture_recorder.cc
42654258
FILE: ../../../flutter/lib/ui/painting/picture_recorder.h
42664259
FILE: ../../../flutter/lib/ui/painting/rrect.cc
42674260
FILE: ../../../flutter/lib/ui/painting/rrect.h
4268-
FILE: ../../../flutter/lib/ui/painting/scene/scene_node.cc
4269-
FILE: ../../../flutter/lib/ui/painting/scene/scene_node.h
4270-
FILE: ../../../flutter/lib/ui/painting/scene/scene_shader.cc
4271-
FILE: ../../../flutter/lib/ui/painting/scene/scene_shader.h
42724261
FILE: ../../../flutter/lib/ui/painting/shader.cc
42734262
FILE: ../../../flutter/lib/ui/painting/shader.h
42744263
FILE: ../../../flutter/lib/ui/painting/single_frame_codec.cc
@@ -4291,7 +4280,6 @@ FILE: ../../../flutter/lib/ui/semantics/semantics_update_builder.cc
42914280
FILE: ../../../flutter/lib/ui/semantics/semantics_update_builder.h
42924281
FILE: ../../../flutter/lib/ui/semantics/string_attribute.cc
42934282
FILE: ../../../flutter/lib/ui/semantics/string_attribute.h
4294-
FILE: ../../../flutter/lib/ui/setup_hooks.dart
42954283
FILE: ../../../flutter/lib/ui/snapshot_delegate.h
42964284
FILE: ../../../flutter/lib/ui/text.dart
42974285
FILE: ../../../flutter/lib/ui/text/asset_manager_font_provider.cc

display_list/BUILD.gn

-8
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ source_set("display_list") {
7171
"//flutter/impeller/runtime_stage",
7272
"//third_party/skia",
7373
]
74-
75-
if (!defined(defines)) {
76-
defines = []
77-
}
78-
if (impeller_enable_3d) {
79-
defines += [ "IMPELLER_ENABLE_3D" ]
80-
public_deps += [ "//flutter/impeller/scene" ]
81-
}
8274
}
8375

8476
if (enable_unittests) {

display_list/display_list.cc

-9
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ void DisplayList::Dispatch(Dispatcher& dispatcher,
184184
break;
185185

186186
FOR_EACH_DISPLAY_LIST_OP(DL_OP_DISPATCH)
187-
#ifdef IMPELLER_ENABLE_3D
188-
DL_OP_DISPATCH(SetSceneColorSource)
189-
#endif // IMPELLER_ENABLE_3D
190187

191188
#undef DL_OP_DISPATCH
192189

@@ -212,9 +209,6 @@ void DisplayList::DisposeOps(uint8_t* ptr, uint8_t* end) {
212209
break;
213210

214211
FOR_EACH_DISPLAY_LIST_OP(DL_OP_DISPOSE)
215-
#ifdef IMPELLER_ENABLE_3D
216-
DL_OP_DISPOSE(SetSceneColorSource)
217-
#endif // IMPELLER_ENABLE_3D
218212

219213
#undef DL_OP_DISPOSE
220214

@@ -253,9 +247,6 @@ static bool CompareOps(uint8_t* ptrA,
253247
break;
254248

255249
FOR_EACH_DISPLAY_LIST_OP(DL_OP_EQUALS)
256-
#ifdef IMPELLER_ENABLE_3D
257-
DL_OP_EQUALS(SetSceneColorSource)
258-
#endif // IMPELLER_ENABLE_3D
259250

260251
#undef DL_OP_EQUALS
261252

display_list/display_list.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,7 @@ namespace flutter {
159159
V(DrawShadowTransparentOccluder)
160160

161161
#define DL_OP_TO_ENUM_VALUE(name) k##name,
162-
enum class DisplayListOpType {
163-
FOR_EACH_DISPLAY_LIST_OP(DL_OP_TO_ENUM_VALUE)
164-
#ifdef IMPELLER_ENABLE_3D
165-
DL_OP_TO_ENUM_VALUE(SetSceneColorSource)
166-
#endif // IMPELLER_ENABLE_3D
167-
};
162+
enum class DisplayListOpType { FOR_EACH_DISPLAY_LIST_OP(DL_OP_TO_ENUM_VALUE) };
168163
#undef DL_OP_TO_ENUM_VALUE
169164

170165
class Dispatcher;

display_list/display_list_builder.cc

-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "flutter/display_list/display_list_canvas_dispatcher.h"
1010
#include "flutter/display_list/display_list_color_source.h"
1111
#include "flutter/display_list/display_list_ops.h"
12-
#include "fml/logging.h"
1312

1413
namespace flutter {
1514

@@ -207,14 +206,6 @@ void DisplayListBuilder::onSetColorSource(const DlColorSource* source) {
207206
Push<SetRuntimeEffectColorSourceOp>(0, 0, effect);
208207
break;
209208
}
210-
#ifdef IMPELLER_ENABLE_3D
211-
case DlColorSourceType::kScene: {
212-
const DlSceneColorSource* scene = source->asScene();
213-
FML_DCHECK(scene);
214-
Push<SetSceneColorSourceOp>(0, 0, scene);
215-
break;
216-
}
217-
#endif // IMPELLER_ENABLE_3D
218209
case DlColorSourceType::kUnknown:
219210
Push<SetSkColorSourceOp>(0, 0, source->skia_object());
220211
break;

display_list/display_list_color_source.h

-57
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222
#include "third_party/skia/include/effects/SkGradientShader.h"
2323
#include "third_party/skia/include/effects/SkRuntimeEffect.h"
2424

25-
#ifdef IMPELLER_ENABLE_3D
26-
#include "impeller/geometry/matrix.h" // nogncheck
27-
#include "impeller/scene/node.h" // nogncheck
28-
namespace flutter {
29-
class DlSceneColorSource;
30-
}
31-
#endif // IMPELLER_ENABLE_3D
32-
3325
namespace flutter {
3426

3527
class DlColorColorSource;
@@ -59,9 +51,6 @@ enum class DlColorSourceType {
5951
kConicalGradient,
6052
kSweepGradient,
6153
kRuntimeEffect,
62-
#ifdef IMPELLER_ENABLE_3D
63-
kScene,
64-
#endif // IMPELLER_ENABLE_3D
6554
kUnknown
6655
};
6756

@@ -171,10 +160,6 @@ class DlColorSource
171160
return nullptr;
172161
}
173162

174-
#ifdef IMPELLER_ENABLE_3D
175-
virtual const DlSceneColorSource* asScene() const { return nullptr; }
176-
#endif // IMPELLER_ENABLE_3D
177-
178163
// If this filter contains images, specifies the owning context for those
179164
// images.
180165
// Images with a DlImage::OwningContext::kRaster must only call skia_object
@@ -769,48 +754,6 @@ class DlRuntimeEffectColorSource final : public DlColorSource {
769754
FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlRuntimeEffectColorSource);
770755
};
771756

772-
#ifdef IMPELLER_ENABLE_3D
773-
class DlSceneColorSource final : public DlColorSource {
774-
public:
775-
DlSceneColorSource(std::shared_ptr<impeller::scene::Node> node,
776-
impeller::Matrix camera_matrix)
777-
: node_(std::move(node)), camera_matrix_(camera_matrix) {}
778-
779-
const DlSceneColorSource* asScene() const override { return this; }
780-
781-
std::shared_ptr<DlColorSource> shared() const override {
782-
return std::make_shared<DlSceneColorSource>(node_, camera_matrix_);
783-
}
784-
785-
DlColorSourceType type() const override { return DlColorSourceType::kScene; }
786-
size_t size() const override { return sizeof(*this); }
787-
788-
bool is_opaque() const override { return false; }
789-
790-
std::shared_ptr<impeller::scene::Node> scene_node() const { return node_; }
791-
792-
impeller::Matrix camera_matrix() const { return camera_matrix_; }
793-
794-
sk_sp<SkShader> skia_object() const override { return nullptr; }
795-
796-
protected:
797-
bool equals_(DlColorSource const& other) const override {
798-
FML_DCHECK(other.type() == DlColorSourceType::kScene);
799-
auto that = static_cast<DlSceneColorSource const*>(&other);
800-
if (node_ != that->node_) {
801-
return false;
802-
}
803-
return true;
804-
}
805-
806-
private:
807-
std::shared_ptr<impeller::scene::Node> node_;
808-
impeller::Matrix camera_matrix_; // the view-projection matrix of the scene.
809-
810-
FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlSceneColorSource);
811-
};
812-
#endif // IMPELLER_ENABLE_3D
813-
814757
class DlUnknownColorSource final : public DlColorSource {
815758
public:
816759
DlUnknownColorSource(sk_sp<SkShader> shader)

display_list/display_list_ops.h

-20
Original file line numberDiff line numberDiff line change
@@ -312,26 +312,6 @@ struct SetRuntimeEffectColorSourceOp : DLOp {
312312
}
313313
};
314314

315-
#ifdef IMPELLER_ENABLE_3D
316-
struct SetSceneColorSourceOp : DLOp {
317-
static const auto kType = DisplayListOpType::kSetSceneColorSource;
318-
319-
SetSceneColorSourceOp(const DlSceneColorSource* source)
320-
: source(source->scene_node(), source->camera_matrix()) {}
321-
322-
const DlSceneColorSource source;
323-
324-
void dispatch(DispatchContext& ctx) const {
325-
ctx.dispatcher.setColorSource(&source);
326-
}
327-
328-
DisplayListCompare equals(const SetSceneColorSourceOp* other) const {
329-
return (source == other->source) ? DisplayListCompare::kEqual
330-
: DisplayListCompare::kNotEqual;
331-
}
332-
};
333-
#endif // IMPELLER_ENABLE_3D
334-
335315
// 4 byte header + 16 byte payload uses 24 total bytes (4 bytes unused)
336316
struct SetSharedImageFilterOp : DLOp {
337317
static const auto kType = DisplayListOpType::kSetSharedImageFilter;

impeller/display_list/BUILD.gn

-14
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ impeller_component("display_list") {
2222
"//flutter/fml",
2323
"//third_party/skia",
2424
]
25-
26-
if (!defined(defines)) {
27-
defines = []
28-
}
29-
if (impeller_enable_3d) {
30-
defines += [ "IMPELLER_ENABLE_3D" ]
31-
}
3225
}
3326

3427
impeller_component("display_list_unittests") {
@@ -44,11 +37,4 @@ impeller_component("display_list_unittests") {
4437
":display_list",
4538
"../playground:playground_test",
4639
]
47-
48-
if (!defined(defines)) {
49-
defines = []
50-
}
51-
if (impeller_enable_3d) {
52-
defines += [ "IMPELLER_ENABLE_3D" ]
53-
}
5440
}

impeller/display_list/display_list_dispatcher.cc

+8-17
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,6 @@ static std::optional<Paint::ColorSourceType> ToColorSourceType(
337337
return Paint::ColorSourceType::kSweepGradient;
338338
case flutter::DlColorSourceType::kRuntimeEffect:
339339
return Paint::ColorSourceType::kRuntimeEffect;
340-
#ifdef IMPELLER_ENABLE_3D
341-
case flutter::DlColorSourceType::kScene:
342-
return Paint::ColorSourceType::kScene;
343-
#endif // IMPELLER_ENABLE_3D
344340
case flutter::DlColorSourceType::kUnknown:
345341
return std::nullopt;
346342
}
@@ -506,24 +502,19 @@ void DisplayListDispatcher::setColorSource(
506502
return;
507503
}
508504
case Paint::ColorSourceType::kScene: {
509-
#ifdef IMPELLER_ENABLE_3D
510-
const flutter::DlSceneColorSource* scene_color_source = source->asScene();
511-
std::shared_ptr<scene::Node> scene_node =
512-
scene_color_source->scene_node();
513-
Matrix camera_transform = scene_color_source->camera_matrix();
505+
// const flutter::DlSceneColorSource* scene_color_source =
506+
// source->asScene(); std::shared_ptr<scene::Node> scene_node =
507+
// scene_color_source->node(); Matrix camera_transform =
508+
// scene_color_node->camera_transform();
514509

515-
paint_.color_source = [scene_node, camera_transform]() {
510+
paint_.color_source = [/*scene_node, camera_transform*/]() {
516511
auto contents = std::make_shared<SceneContents>();
517-
contents->SetNode(scene_node);
518-
contents->SetCameraTransform(camera_transform);
512+
// contents->SetNode(scene_node);
513+
// contents->SetCameraTransform(camera_transform);
519514
return contents;
520515
};
521-
#else // IMPELLER_ENABLE_3D
522-
FML_LOG(ERROR) << "ColorSourceType::kScene can only be used if Impeller "
523-
"Scene is enabled.";
524-
#endif // IMPELLER_ENABLE_3D
525-
return;
526516
}
517+
return;
527518
case Paint::ColorSourceType::kConicalGradient:
528519
UNIMPLEMENTED;
529520
break;

impeller/display_list/display_list_unittests.cc

-28
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "impeller/geometry/constants.h"
2424
#include "impeller/geometry/point.h"
2525
#include "impeller/playground/widgets.h"
26-
#include "impeller/scene/node.h"
2726
#include "third_party/imgui/imgui.h"
2827
#include "third_party/skia/include/core/SkBlurTypes.h"
2928
#include "third_party/skia/include/core/SkClipOp.h"
@@ -1159,32 +1158,5 @@ TEST_P(DisplayListTest, DrawShapes) {
11591158
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
11601159
}
11611160

1162-
#ifdef IMPELLER_ENABLE_3D
1163-
TEST_P(DisplayListTest, SceneColorSource) {
1164-
// Load up the scene.
1165-
auto mapping =
1166-
flutter::testing::OpenFixtureAsMapping("flutter_logo_baked.glb.ipscene");
1167-
ASSERT_NE(mapping, nullptr);
1168-
1169-
std::shared_ptr<scene::Node> gltf_scene =
1170-
impeller::scene::Node::MakeFromFlatbuffer(
1171-
*mapping, *GetContext()->GetResourceAllocator());
1172-
ASSERT_NE(gltf_scene, nullptr);
1173-
1174-
flutter::DisplayListBuilder builder;
1175-
1176-
auto color_source = std::make_shared<flutter::DlSceneColorSource>(
1177-
gltf_scene,
1178-
Matrix::MakePerspective(Degrees(45), GetWindowSize(), 0.1, 1000) *
1179-
Matrix::MakeLookAt({3, 2, -5}, {0, 0, 0}, {0, 1, 0}));
1180-
1181-
flutter::DlPaint paint = flutter::DlPaint().setColorSource(color_source);
1182-
1183-
builder.drawPaint(paint);
1184-
1185-
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
1186-
}
1187-
#endif
1188-
11891161
} // namespace testing
11901162
} // namespace impeller

impeller/entity/contents/scene_contents.cc

-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ bool SceneContents::Render(const ContentContext& renderer,
7171
TiledTextureContents contents;
7272
contents.SetGeometry(GetGeometry());
7373
contents.SetTexture(subpass_target.GetRenderTargetTexture());
74-
contents.SetMatrix(
75-
Matrix::MakeScale(1 / entity.GetTransformation().GetScale()));
7674
return contents.Render(renderer, entity, pass);
7775
}
7876

impeller/scene/node.cc

+6-13
Original file line numberDiff line numberDiff line change
@@ -287,19 +287,12 @@ Matrix Node::GetGlobalTransform() const {
287287
}
288288

289289
bool Node::AddChild(std::shared_ptr<Node> node) {
290-
// TODO(bdero): Figure out a better paradigm/rules for nodes with multiple
291-
// parents. We should probably disallow this, make deep
292-
// copying of nodes cheap and easy, add mesh instancing, etc.
293-
// Today, the parent link is only used for skin posing, and so
294-
// it's reasonable to not have a check and allow multi-parenting.
295-
// Even still, there should still be some kind of cycle
296-
// prevention/detection, ideally at the protocol level.
297-
//
298-
// if (node->parent_ != nullptr) {
299-
// VALIDATION_LOG
300-
// << "Cannot add a node as a child which already has a parent.";
301-
// return false;
302-
// }
290+
// This ensures that cycles are impossible.
291+
if (node->parent_ != nullptr) {
292+
VALIDATION_LOG
293+
<< "Cannot add a node as a child which already has a parent.";
294+
return false;
295+
}
303296
node->parent_ = this;
304297
children_.push_back(std::move(node));
305298

0 commit comments

Comments
 (0)