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

Commit 415bb28

Browse files
authored
[Impeller] Do not build scene unless 3d define is true (#45028)
Fixes flutter/flutter#133193
1 parent 6e5ad11 commit 415bb28

File tree

17 files changed

+106
-772
lines changed

17 files changed

+106
-772
lines changed

ci/builders/mac_unopt.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"debug",
1414
"--unoptimized",
1515
"--no-lto",
16-
"--prebuilt-dart-sdk"
16+
"--prebuilt-dart-sdk",
17+
"--enable-impeller-3d"
1718
],
1819
"name": "host_debug_unopt",
1920
"ninja": {

impeller/BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ config("impeller_public_config") {
4444
"_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING",
4545
]
4646
}
47+
48+
if (impeller_enable_3d) {
49+
defines += [ "IMPELLER_ENABLE_3D" ]
50+
}
4751
}
4852

4953
group("impeller") {

impeller/aiks/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ impeller_component("aiks_unittests") {
6767
"//flutter/impeller/geometry:geometry_asserts",
6868
"//flutter/impeller/golden_tests:golden_playground_test",
6969
"//flutter/impeller/playground:playground_test",
70+
"//flutter/impeller/scene",
7071
"//flutter/impeller/typographer/backends/stb:typographer_stb_backend",
7172
"//flutter/testing:testing_lib",
7273
]
@@ -92,6 +93,7 @@ impeller_component("aiks_unittests_golden") {
9293
"//flutter/impeller/geometry:geometry_asserts",
9394
"//flutter/impeller/golden_tests:golden_playground_test",
9495
"//flutter/impeller/playground:playground_test",
96+
"//flutter/impeller/scene",
9597
"//flutter/impeller/typographer/backends/stb:typographer_stb_backend",
9698
"//flutter/testing:testing_lib",
9799
]

impeller/aiks/aiks_unittests.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,7 @@ TEST_P(AiksTest, SaveLayerFiltersScaleWithTransform) {
20562056
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
20572057
}
20582058

2059+
#if IMPELLER_ENABLE_3D
20592060
TEST_P(AiksTest, SceneColorSource) {
20602061
// Load up the scene.
20612062
auto mapping =
@@ -2096,6 +2097,7 @@ TEST_P(AiksTest, SceneColorSource) {
20962097

20972098
ASSERT_TRUE(OpenPlaygroundHere(callback));
20982099
}
2100+
#endif // IMPELLER_ENABLE_3D
20992101

21002102
TEST_P(AiksTest, PaintWithFilters) {
21012103
// validate that a paint with a color filter "HasFilters", no other filters

impeller/aiks/color_source.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@
1313
#include "impeller/entity/contents/linear_gradient_contents.h"
1414
#include "impeller/entity/contents/radial_gradient_contents.h"
1515
#include "impeller/entity/contents/runtime_effect_contents.h"
16-
#include "impeller/entity/contents/scene_contents.h"
1716
#include "impeller/entity/contents/solid_color_contents.h"
1817
#include "impeller/entity/contents/sweep_gradient_contents.h"
1918
#include "impeller/entity/contents/tiled_texture_contents.h"
2019
#include "impeller/geometry/color.h"
2120
#include "impeller/geometry/matrix.h"
2221
#include "impeller/geometry/scalar.h"
2322
#include "impeller/runtime_stage/runtime_stage.h"
24-
#include "impeller/scene/node.h"
23+
24+
#if IMPELLER_ENABLE_3D
25+
#include "impeller/entity/contents/scene_contents.h" // nogncheck
26+
#include "impeller/scene/node.h" // nogncheck
27+
#endif // IMPELLER_ENABLE_3D
2528

2629
namespace impeller {
2730

@@ -210,6 +213,7 @@ ColorSource ColorSource::MakeRuntimeEffect(
210213
return result;
211214
}
212215

216+
#if IMPELLER_ENABLE_3D
213217
ColorSource ColorSource::MakeScene(std::shared_ptr<scene::Node> scene_node,
214218
Matrix camera_transform) {
215219
ColorSource result;
@@ -224,6 +228,7 @@ ColorSource ColorSource::MakeScene(std::shared_ptr<scene::Node> scene_node,
224228
};
225229
return result;
226230
}
231+
#endif // IMPELLER_ENABLE_3D
227232

228233
ColorSource::Type ColorSource::GetType() const {
229234
return type_;

impeller/aiks/color_source.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#include "impeller/geometry/matrix.h"
1616
#include "impeller/geometry/point.h"
1717
#include "impeller/runtime_stage/runtime_stage.h"
18-
#include "impeller/scene/node.h"
18+
19+
#if IMPELLER_ENABLE_3D
20+
#include "impeller/scene/node.h" // nogncheck
21+
#endif // IMPELLER_ENABLE_3D
1922

2023
namespace impeller {
2124

@@ -85,8 +88,10 @@ class ColorSource {
8588
std::shared_ptr<std::vector<uint8_t>> uniform_data,
8689
std::vector<RuntimeEffectContents::TextureInput> texture_inputs);
8790

91+
#if IMPELLER_ENABLE_3D
8892
static ColorSource MakeScene(std::shared_ptr<scene::Node> scene_node,
8993
Matrix camera_transform);
94+
#endif // IMPELLER_ENABLE_3D
9095

9196
Type GetType() const;
9297

impeller/display_list/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impeller_component("display_list_unittests") {
6161
deps = [
6262
":display_list",
6363
"../playground:playground_test",
64+
"//flutter/impeller/scene",
6465
"//flutter/impeller/typographer/backends/stb:typographer_stb_backend",
6566
]
6667

impeller/display_list/dl_dispatcher.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "impeller/entity/contents/linear_gradient_contents.h"
2727
#include "impeller/entity/contents/radial_gradient_contents.h"
2828
#include "impeller/entity/contents/runtime_effect_contents.h"
29-
#include "impeller/entity/contents/scene_contents.h"
3029
#include "impeller/entity/contents/sweep_gradient_contents.h"
3130
#include "impeller/entity/contents/tiled_texture_contents.h"
3231
#include "impeller/entity/entity.h"
@@ -37,6 +36,10 @@
3736
#include "impeller/geometry/sigma.h"
3837
#include "impeller/typographer/backends/skia/text_frame_skia.h"
3938

39+
#if IMPELLER_ENABLE_3D
40+
#include "impeller/entity/contents/scene_contents.h"
41+
#endif // IMPELLER_ENABLE_3D
42+
4043
namespace impeller {
4144

4245
#define UNIMPLEMENTED \

impeller/entity/BUILD.gn

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,6 @@ impeller_component("entity") {
203203
"contents/radial_gradient_contents.h",
204204
"contents/runtime_effect_contents.cc",
205205
"contents/runtime_effect_contents.h",
206-
"contents/scene_contents.cc",
207-
"contents/scene_contents.h",
208206
"contents/solid_color_contents.cc",
209207
"contents/solid_color_contents.h",
210208
"contents/solid_rrect_blur_contents.cc",
@@ -261,10 +259,17 @@ impeller_component("entity") {
261259
"../archivist",
262260
"../image:image_skia_backend",
263261
"../renderer",
264-
"../scene",
265262
"../typographer",
266263
]
267264

265+
if (impeller_enable_3d) {
266+
sources += [
267+
"contents/scene_contents.cc",
268+
"contents/scene_contents.h",
269+
]
270+
public_deps += [ "../scene" ]
271+
}
272+
268273
deps = [ "//flutter/fml" ]
269274
}
270275

impeller/entity/contents/content_context.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ ContentContext::ContentContext(
167167
lazy_glyph_atlas_(
168168
std::make_shared<LazyGlyphAtlas>(std::move(typographer_context))),
169169
tessellator_(std::make_shared<Tessellator>()),
170+
#if IMPELLER_ENABLE_3D
170171
scene_context_(std::make_shared<scene::SceneContext>(context_)),
172+
#endif // IMPELLER_ENABLE_3D
171173
render_target_cache_(std::make_shared<RenderTargetCache>(
172174
context_->GetResourceAllocator())) {
173175
if (!context_ || !context_->IsValid()) {
@@ -413,9 +415,11 @@ std::shared_ptr<Texture> ContentContext::MakeSubpass(
413415
return subpass_texture;
414416
}
415417

418+
#if IMPELLER_ENABLE_3D
416419
std::shared_ptr<scene::SceneContext> ContentContext::GetSceneContext() const {
417420
return scene_context_;
418421
}
422+
#endif // IMPELLER_ENABLE_3D
419423

420424
std::shared_ptr<Tessellator> ContentContext::GetTessellator() const {
421425
return tessellator_;

0 commit comments

Comments
 (0)