From 8655ec022fe12a8ddd727f15ff4df355aa0ae890 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Wed, 28 Dec 2022 20:57:14 -0800 Subject: [PATCH] [Impeller Scene] Add ColorSourceContents for drawing a node (#38485) --- ci/licenses_golden/licenses_flutter | 4 + impeller/aiks/aiks_unittests.cc | 53 +++++++++++++ impeller/aiks/paint.h | 1 + .../display_list/display_list_dispatcher.cc | 15 ++++ impeller/entity/BUILD.gn | 3 + .../entity/contents/color_source_contents.cc | 4 +- .../entity/contents/color_source_contents.h | 6 +- impeller/entity/contents/content_context.cc | 8 +- impeller/entity/contents/content_context.h | 7 +- impeller/entity/contents/scene_contents.cc | 77 +++++++++++++++++++ impeller/entity/contents/scene_contents.h | 35 +++++++++ impeller/geometry/rect.h | 10 ++- impeller/scene/scene.cc | 21 ++++- impeller/scene/scene.h | 10 ++- impeller/scene/scene_encoder.cc | 6 +- impeller/scene/scene_encoder.h | 2 +- impeller/scene/scene_unittests.cc | 10 ++- .../android/android_surface_gl_impeller.cc | 5 +- .../android_surface_vulkan_impeller.cc | 3 + .../FlutterDarwinContextMetalImpeller.mm | 5 +- 20 files changed, 258 insertions(+), 27 deletions(-) create mode 100644 impeller/entity/contents/scene_contents.cc create mode 100644 impeller/entity/contents/scene_contents.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 70bdd2184b60e..5a7f8c8018777 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -1259,6 +1259,8 @@ ORIGIN: ../../../flutter/impeller/entity/contents/rrect_shadow_contents.cc + ../ ORIGIN: ../../../flutter/impeller/entity/contents/rrect_shadow_contents.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/contents/runtime_effect_contents.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/contents/runtime_effect_contents.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/contents/scene_contents.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/entity/contents/scene_contents.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/contents/solid_color_contents.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/contents/solid_color_contents.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/entity/contents/sweep_gradient_contents.cc + ../../../flutter/LICENSE @@ -3716,6 +3718,8 @@ FILE: ../../../flutter/impeller/entity/contents/rrect_shadow_contents.cc FILE: ../../../flutter/impeller/entity/contents/rrect_shadow_contents.h FILE: ../../../flutter/impeller/entity/contents/runtime_effect_contents.cc FILE: ../../../flutter/impeller/entity/contents/runtime_effect_contents.h +FILE: ../../../flutter/impeller/entity/contents/scene_contents.cc +FILE: ../../../flutter/impeller/entity/contents/scene_contents.h FILE: ../../../flutter/impeller/entity/contents/solid_color_contents.cc FILE: ../../../flutter/impeller/entity/contents/solid_color_contents.h FILE: ../../../flutter/impeller/entity/contents/sweep_gradient_contents.cc diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index 14bdcacaba0ba..d64965857610b 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -12,7 +13,9 @@ #include "impeller/aiks/aiks_playground.h" #include "impeller/aiks/canvas.h" #include "impeller/aiks/image.h" +#include "impeller/entity/contents/color_source_contents.h" #include "impeller/entity/contents/filters/inputs/filter_input.h" +#include "impeller/entity/contents/scene_contents.h" #include "impeller/entity/contents/tiled_texture_contents.h" #include "impeller/geometry/color.h" #include "impeller/geometry/geometry_unittests.h" @@ -21,6 +24,8 @@ #include "impeller/playground/widgets.h" #include "impeller/renderer/command_buffer.h" #include "impeller/renderer/snapshot.h" +#include "impeller/scene/material.h" +#include "impeller/scene/node.h" #include "impeller/typographer/backends/skia/text_frame_skia.h" #include "impeller/typographer/backends/skia/text_render_context_skia.h" #include "third_party/skia/include/core/SkData.h" @@ -1700,5 +1705,53 @@ TEST_P(AiksTest, SaveLayerFiltersScaleWithTransform) { ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } +TEST_P(AiksTest, SceneColorSource) { + // Load up the scene. + auto mapping = + flutter::testing::OpenFixtureAsMapping("flutter_logo.glb.ipscene"); + ASSERT_NE(mapping, nullptr); + + std::shared_ptr gltf_scene = scene::Node::MakeFromFlatbuffer( + *mapping, *GetContext()->GetResourceAllocator()); + ASSERT_NE(gltf_scene, nullptr); + + // Assign a material (temporary stopgap). + std::shared_ptr material = scene::Material::MakeUnlit(); + auto color_baked = CreateTextureForFixture("flutter_logo_baked.png"); + ASSERT_NE(color_baked, nullptr); + material->SetColorTexture(std::move(color_baked)); + material->SetVertexColorWeight(0); + + ASSERT_EQ(gltf_scene->GetChildren().size(), 1u); + ASSERT_EQ(gltf_scene->GetChildren()[0]->GetMesh().GetPrimitives().size(), 1u); + gltf_scene->GetChildren()[0]->GetMesh().GetPrimitives()[0].material = + std::move(material); + + auto callback = [&](AiksContext& renderer, RenderTarget& render_target) { + Paint paint; + + paint.color_source_type = Paint::ColorSourceType::kScene; + paint.color_source = [this, gltf_scene]() { + Scalar angle = GetSecondsElapsed(); + Scalar distance = 2; + auto camera_position = + Vector3(distance * std::sin(angle), 2, -distance * std::cos(angle)); + auto contents = std::make_shared(); + contents->SetNode(gltf_scene); + contents->SetCameraTransform( + Matrix::MakePerspective(Degrees(45), GetWindowSize(), 0.1, 1000) * + Matrix::MakeLookAt(camera_position, {0, 0, 0}, {0, 1, 0})); + return contents; + }; + + Canvas canvas; + canvas.Scale(GetContentScale()); + canvas.DrawPaint(paint); + return renderer.Render(canvas.EndRecordingAsPicture(), render_target); + }; + + ASSERT_TRUE(OpenPlaygroundHere(callback)); +} + } // namespace testing } // namespace impeller diff --git a/impeller/aiks/paint.h b/impeller/aiks/paint.h index 6f3784112e94c..7db7b4223a49e 100644 --- a/impeller/aiks/paint.h +++ b/impeller/aiks/paint.h @@ -44,6 +44,7 @@ struct Paint { kConicalGradient, kSweepGradient, kRuntimeEffect, + kScene, }; struct MaskBlurDescriptor { diff --git a/impeller/display_list/display_list_dispatcher.cc b/impeller/display_list/display_list_dispatcher.cc index eba5782e43b22..538eff84f1b80 100644 --- a/impeller/display_list/display_list_dispatcher.cc +++ b/impeller/display_list/display_list_dispatcher.cc @@ -27,6 +27,7 @@ #include "impeller/entity/contents/linear_gradient_contents.h" #include "impeller/entity/contents/radial_gradient_contents.h" #include "impeller/entity/contents/runtime_effect_contents.h" +#include "impeller/entity/contents/scene_contents.h" #include "impeller/entity/contents/sweep_gradient_contents.h" #include "impeller/entity/contents/tiled_texture_contents.h" #include "impeller/entity/entity.h" @@ -500,6 +501,20 @@ void DisplayListDispatcher::setColorSource( }; return; } + case Paint::ColorSourceType::kScene: { + // const flutter::DlSceneColorSource* scene_color_source = + // source->asScene(); std::shared_ptr scene_node = + // scene_color_source->node(); Matrix camera_transform = + // scene_color_node->camera_transform(); + + paint_.color_source = [/*scene_node, camera_transform*/]() { + auto contents = std::make_shared(); + // contents->SetNode(scene_node); + // contents->SetCameraTransform(camera_transform); + return contents; + }; + } + return; case Paint::ColorSourceType::kConicalGradient: UNIMPLEMENTED; break; diff --git a/impeller/entity/BUILD.gn b/impeller/entity/BUILD.gn index ecba665e6617a..24702f3a82709 100644 --- a/impeller/entity/BUILD.gn +++ b/impeller/entity/BUILD.gn @@ -134,6 +134,8 @@ impeller_component("entity") { "contents/rrect_shadow_contents.h", "contents/runtime_effect_contents.cc", "contents/runtime_effect_contents.h", + "contents/scene_contents.cc", + "contents/scene_contents.h", "contents/solid_color_contents.cc", "contents/solid_color_contents.h", "contents/sweep_gradient_contents.cc", @@ -164,6 +166,7 @@ impeller_component("entity") { "../archivist", "../image", "../renderer", + "../scene", "../typographer", ] diff --git a/impeller/entity/contents/color_source_contents.cc b/impeller/entity/contents/color_source_contents.cc index 37e079d8785bb..c95507ea4fb44 100644 --- a/impeller/entity/contents/color_source_contents.cc +++ b/impeller/entity/contents/color_source_contents.cc @@ -13,11 +13,11 @@ ColorSourceContents::ColorSourceContents() = default; ColorSourceContents::~ColorSourceContents() = default; -void ColorSourceContents::SetGeometry(std::unique_ptr geometry) { +void ColorSourceContents::SetGeometry(std::shared_ptr geometry) { geometry_ = std::move(geometry); } -const std::unique_ptr& ColorSourceContents::GetGeometry() const { +const std::shared_ptr& ColorSourceContents::GetGeometry() const { return geometry_; } diff --git a/impeller/entity/contents/color_source_contents.h b/impeller/entity/contents/color_source_contents.h index f5289192b1d89..4396c38395516 100644 --- a/impeller/entity/contents/color_source_contents.h +++ b/impeller/entity/contents/color_source_contents.h @@ -18,7 +18,7 @@ class ColorSourceContents : public Contents { ~ColorSourceContents() override; - void SetGeometry(std::unique_ptr geometry); + void SetGeometry(std::shared_ptr geometry); void SetMatrix(Matrix matrix); @@ -32,14 +32,14 @@ class ColorSourceContents : public Contents { const std::optional& stencil_coverage) const override; protected: - const std::unique_ptr& GetGeometry() const; + const std::shared_ptr& GetGeometry() const; const Matrix& GetInverseMatrix() const; Scalar GetAlpha() const; private: - std::unique_ptr geometry_; + std::shared_ptr geometry_; Matrix inverse_matrix_; Scalar alpha_ = 1.0; diff --git a/impeller/entity/contents/content_context.cc b/impeller/entity/contents/content_context.cc index fa6c6782f40cb..c6158d87f857e 100644 --- a/impeller/entity/contents/content_context.cc +++ b/impeller/entity/contents/content_context.cc @@ -4,6 +4,7 @@ #include "impeller/entity/contents/content_context.h" +#include #include #include "impeller/entity/entity.h" @@ -146,7 +147,8 @@ static std::unique_ptr CreateDefaultPipeline( ContentContext::ContentContext(std::shared_ptr context) : context_(std::move(context)), tessellator_(std::make_shared()), - glyph_atlas_context_(std::make_shared()) { + glyph_atlas_context_(std::make_shared()), + scene_context_(std::make_shared(context_)) { if (!context_ || !context_->IsValid()) { return; } @@ -298,6 +300,10 @@ std::shared_ptr ContentContext::MakeSubpass( return subpass_texture; } +std::shared_ptr ContentContext::GetSceneContext() const { + return scene_context_; +} + std::shared_ptr ContentContext::GetTessellator() const { return tessellator_; } diff --git a/impeller/entity/contents/content_context.h b/impeller/entity/contents/content_context.h index 661ac5a58a9d0..a23584339164a 100644 --- a/impeller/entity/contents/content_context.h +++ b/impeller/entity/contents/content_context.h @@ -8,8 +8,8 @@ #include #include "flutter/fml/hash_combine.h" +#include "flutter/fml/logging.h" #include "flutter/fml/macros.h" -#include "fml/logging.h" #include "impeller/base/validation.h" #include "impeller/entity/advanced_blend.vert.h" #include "impeller/entity/advanced_blend_color.frag.h" @@ -65,11 +65,13 @@ #include "impeller/entity/yuv_to_rgb_filter.vert.h" #include "impeller/renderer/formats.h" #include "impeller/renderer/pipeline.h" +#include "impeller/scene/scene_context.h" #include "impeller/entity/position.vert.h" #include "impeller/entity/position_color.vert.h" #include "impeller/entity/position_uv.vert.h" +#include "impeller/scene/scene_context.h" #include "impeller/typographer/glyph_atlas.h" #include "impeller/entity/linear_gradient_ssbo_fill.frag.h" @@ -216,6 +218,8 @@ class ContentContext { bool IsValid() const; + std::shared_ptr GetSceneContext() const; + std::shared_ptr GetTessellator() const; std::shared_ptr> GetLinearGradientFillPipeline( @@ -522,6 +526,7 @@ class ContentContext { bool is_valid_ = false; std::shared_ptr tessellator_; std::shared_ptr glyph_atlas_context_; + std::shared_ptr scene_context_; FML_DISALLOW_COPY_AND_ASSIGN(ContentContext); }; diff --git a/impeller/entity/contents/scene_contents.cc b/impeller/entity/contents/scene_contents.cc new file mode 100644 index 0000000000000..3a1c0d9264fba --- /dev/null +++ b/impeller/entity/contents/scene_contents.cc @@ -0,0 +1,77 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "impeller/entity/contents/scene_contents.h" + +#include "impeller/entity/contents/content_context.h" +#include "impeller/entity/contents/tiled_texture_contents.h" +#include "impeller/entity/entity.h" +#include "impeller/geometry/path_builder.h" +#include "impeller/renderer/formats.h" +#include "impeller/scene/camera.h" +#include "impeller/scene/scene.h" + +namespace impeller { + +SceneContents::SceneContents() = default; + +SceneContents::~SceneContents() = default; + +void SceneContents::SetCameraTransform(Matrix matrix) { + camera_transform_ = matrix; +} + +void SceneContents::SetNode(std::shared_ptr node) { + node_ = std::move(node); +} + +bool SceneContents::Render(const ContentContext& renderer, + const Entity& entity, + RenderPass& pass) const { + if (!node_) { + return true; + } + + auto coverage = GetCoverage(entity); + if (!coverage.has_value()) { + return true; + } + + // This happens for CoverGeometry (DrawPaint). In this situation, + // Draw the scene to the full layer. + if (coverage.value().IsMaximum()) { + coverage = Rect::MakeSize(pass.GetRenderTargetSize()); + } + + RenderTarget subpass_target = RenderTarget::CreateOffscreenMSAA( + *renderer.GetContext(), // context + ISize(coverage.value().size), // size + "SceneContents", // label + StorageMode::kDeviceTransient, // color_storage_mode + StorageMode::kDevicePrivate, // color_resolve_storage_mode + LoadAction::kClear, // color_load_action + StoreAction::kMultisampleResolve, // color_store_action + StorageMode::kDeviceTransient, // stencil_storage_mode + LoadAction::kDontCare, // stencil_load_action + StoreAction::kDontCare // stencil_store_action + ); + if (!subpass_target.IsValid()) { + return false; + } + + scene::Scene scene(renderer.GetSceneContext()); + scene.GetRoot().AddChild(node_); + + if (!scene.Render(subpass_target, camera_transform_)) { + return false; + } + + // Render the texture to the pass. + TiledTextureContents contents; + contents.SetGeometry(GetGeometry()); + contents.SetTexture(subpass_target.GetRenderTargetTexture()); + return contents.Render(renderer, entity, pass); +} + +} // namespace impeller diff --git a/impeller/entity/contents/scene_contents.h b/impeller/entity/contents/scene_contents.h new file mode 100644 index 0000000000000..def5a36a04e59 --- /dev/null +++ b/impeller/entity/contents/scene_contents.h @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "impeller/entity/contents/color_source_contents.h" + +#include "impeller/geometry/matrix.h" +#include "impeller/geometry/rect.h" +#include "impeller/scene/node.h" + +namespace impeller { + +class SceneContents final : public ColorSourceContents { + public: + SceneContents(); + + ~SceneContents() override; + + void SetCameraTransform(Matrix matrix); + + void SetNode(std::shared_ptr node); + + // |Contents| + bool Render(const ContentContext& renderer, + const Entity& entity, + RenderPass& pass) const override; + + private: + Matrix camera_transform_; + std::shared_ptr node_; +}; + +} // namespace impeller diff --git a/impeller/geometry/rect.h b/impeller/geometry/rect.h index 3c836226b1cde..94a5b6d6f9dd7 100644 --- a/impeller/geometry/rect.h +++ b/impeller/geometry/rect.h @@ -74,10 +74,10 @@ struct TRect { } constexpr static TRect MakeMaximum() { - return TRect::MakeLTRB(-std::numeric_limits::infinity(), - -std::numeric_limits::infinity(), - std::numeric_limits::infinity(), - std::numeric_limits::infinity()); + return TRect::MakeLTRB(-std::numeric_limits::infinity(), + -std::numeric_limits::infinity(), + std::numeric_limits::infinity(), + std::numeric_limits::infinity()); } template @@ -122,6 +122,8 @@ struct TRect { constexpr bool IsEmpty() const { return size.IsEmpty(); } + constexpr bool IsMaximum() const { return *this == MakeMaximum(); } + constexpr auto GetLeft() const { return std::min(origin.x, origin.x + size.width); } diff --git a/impeller/scene/scene.cc b/impeller/scene/scene.cc index 46801cb4997a8..cf88faa10cfc4 100644 --- a/impeller/scene/scene.cc +++ b/impeller/scene/scene.cc @@ -15,17 +15,23 @@ namespace impeller { namespace scene { -Scene::Scene(std::shared_ptr context) - : scene_context_(std::make_unique(std::move(context))) { +Scene::Scene(std::shared_ptr scene_context) + : scene_context_(std::move(scene_context)) { root_.is_root_ = true; }; +Scene::~Scene() { + for (auto& child : GetRoot().GetChildren()) { + child->parent_ = nullptr; + } +} + Node& Scene::GetRoot() { return root_; } bool Scene::Render(const RenderTarget& render_target, - const Camera& camera) const { + const Matrix& camera_transform) const { // Collect the render commands from the scene. SceneEncoder encoder; if (!root_.Render(encoder, Matrix())) { @@ -36,7 +42,8 @@ bool Scene::Render(const RenderTarget& render_target, // Encode the commands. std::shared_ptr command_buffer = - encoder.BuildSceneCommandBuffer(*scene_context_, camera, render_target); + encoder.BuildSceneCommandBuffer(*scene_context_, camera_transform, + render_target); // TODO(bdero): Do post processing. @@ -48,5 +55,11 @@ bool Scene::Render(const RenderTarget& render_target, return true; } +bool Scene::Render(const RenderTarget& render_target, + const Camera& camera) const { + return Render(render_target, + camera.GetTransform(render_target.GetRenderTargetSize())); +} + } // namespace scene } // namespace impeller diff --git a/impeller/scene/scene.h b/impeller/scene/scene.h index 97fadc86984eb..9ff0745befaa0 100644 --- a/impeller/scene/scene.h +++ b/impeller/scene/scene.h @@ -20,14 +20,20 @@ namespace scene { class Scene { public: Scene() = delete; - explicit Scene(std::shared_ptr context); + + explicit Scene(std::shared_ptr scene_context); + + ~Scene(); Node& GetRoot(); + bool Render(const RenderTarget& render_target, + const Matrix& camera_transform) const; + bool Render(const RenderTarget& render_target, const Camera& camera) const; private: - std::unique_ptr scene_context_; + std::shared_ptr scene_context_; Node root_; FML_DISALLOW_COPY_AND_ASSIGN(Scene); diff --git a/impeller/scene/scene_encoder.cc b/impeller/scene/scene_encoder.cc index e3376516a2f2f..662820a606cbd 100644 --- a/impeller/scene/scene_encoder.cc +++ b/impeller/scene/scene_encoder.cc @@ -46,7 +46,7 @@ static void EncodeCommand(const SceneContext& scene_context, std::shared_ptr SceneEncoder::BuildSceneCommandBuffer( const SceneContext& scene_context, - const Camera& camera, + const Matrix& camera_transform, RenderTarget render_target) const { { TextureDescriptor ds_texture; @@ -91,9 +91,7 @@ std::shared_ptr SceneEncoder::BuildSceneCommandBuffer( } for (auto& command : commands_) { - Matrix view_transform = - camera.GetTransform(render_pass->GetRenderTargetSize()); - EncodeCommand(scene_context, view_transform, *render_pass, command); + EncodeCommand(scene_context, camera_transform, *render_pass, command); } if (!render_pass->EncodeCommands()) { diff --git a/impeller/scene/scene_encoder.h b/impeller/scene/scene_encoder.h index 600dd727b3466..2c2ef1bdc20ad 100644 --- a/impeller/scene/scene_encoder.h +++ b/impeller/scene/scene_encoder.h @@ -35,7 +35,7 @@ class SceneEncoder { std::shared_ptr BuildSceneCommandBuffer( const SceneContext& scene_context, - const Camera& camera, + const Matrix& camera_transform, RenderTarget render_target) const; std::vector commands_; diff --git a/impeller/scene/scene_unittests.cc b/impeller/scene/scene_unittests.cc index 1ac4034ed5755..a9ce2138c19c6 100644 --- a/impeller/scene/scene_unittests.cc +++ b/impeller/scene/scene_unittests.cc @@ -33,9 +33,11 @@ using SceneTest = PlaygroundTest; INSTANTIATE_PLAYGROUND_SUITE(SceneTest); TEST_P(SceneTest, CuboidUnlit) { + auto scene_context = std::make_shared(GetContext()); + Renderer::RenderCallback callback = [&](RenderTarget& render_target) { auto allocator = GetContext()->GetResourceAllocator(); - auto scene = Scene(GetContext()); + auto scene = Scene(scene_context); { Mesh mesh; @@ -87,7 +89,8 @@ TEST_P(SceneTest, FlutterLogo) { gltf_scene->GetChildren()[0]->GetMesh().GetPrimitives()[0].material = material; - auto scene = Scene(GetContext()); + auto scene_context = std::make_shared(GetContext()); + auto scene = Scene(scene_context); scene.GetRoot().AddChild(std::move(gltf_scene)); scene.GetRoot().SetLocalTransform(Matrix::MakeScale({3, 3, 3})); @@ -121,7 +124,8 @@ TEST_P(SceneTest, TwoTriangles) { Node::MakeFromFlatbuffer(*mapping, *allocator); ASSERT_NE(gltf_scene, nullptr); - auto scene = Scene(GetContext()); + auto scene_context = std::make_shared(GetContext()); + auto scene = Scene(scene_context); scene.GetRoot().AddChild(std::move(gltf_scene)); Renderer::RenderCallback callback = [&](RenderTarget& render_target) { diff --git a/shell/platform/android/android_surface_gl_impeller.cc b/shell/platform/android/android_surface_gl_impeller.cc index 89cbf668a7d16..3200822776a90 100644 --- a/shell/platform/android/android_surface_gl_impeller.cc +++ b/shell/platform/android/android_surface_gl_impeller.cc @@ -5,12 +5,13 @@ #include "flutter/shell/platform/android/android_surface_gl_impeller.h" #include "flutter/fml/logging.h" -#include "flutter/impeller/entity/gles/entity_shaders_gles.h" #include "flutter/impeller/renderer/backend/gles/context_gles.h" #include "flutter/impeller/renderer/backend/gles/proc_table_gles.h" #include "flutter/impeller/toolkit/egl/context.h" #include "flutter/impeller/toolkit/egl/surface.h" #include "flutter/shell/gpu/gpu_surface_gl_impeller.h" +#include "impeller/entity/gles/entity_shaders_gles.h" +#include "impeller/scene/shaders/gles/scene_shaders_gles.h" namespace flutter { @@ -59,6 +60,8 @@ static std::shared_ptr CreateImpellerContext( std::make_shared( impeller_entity_shaders_gles_data, impeller_entity_shaders_gles_length), + std::make_shared( + impeller_scene_shaders_gles_data, impeller_scene_shaders_gles_length), }; auto context = diff --git a/shell/platform/android/android_surface_vulkan_impeller.cc b/shell/platform/android/android_surface_vulkan_impeller.cc index b9588df3ac500..65a682bb3d839 100644 --- a/shell/platform/android/android_surface_vulkan_impeller.cc +++ b/shell/platform/android/android_surface_vulkan_impeller.cc @@ -15,6 +15,7 @@ #include "flutter/vulkan/vulkan_native_surface_android.h" #include "impeller/entity/vk/entity_shaders_vk.h" #include "impeller/entity/vk/modern_shaders_vk.h" +#include "impeller/scene/shaders/vk/scene_shaders_vk.h" namespace flutter { @@ -24,6 +25,8 @@ std::shared_ptr CreateImpellerContext( std::vector> shader_mappings = { std::make_shared(impeller_entity_shaders_vk_data, impeller_entity_shaders_vk_length), + std::make_shared(impeller_scene_shaders_vk_data, + impeller_scene_shaders_vk_length), std::make_shared(impeller_modern_shaders_vk_data, impeller_modern_shaders_vk_length), }; diff --git a/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm b/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm index 1ab7dcd51d3c4..4810aaae7a7a0 100644 --- a/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm +++ b/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm @@ -6,11 +6,12 @@ #include "flutter/common/graphics/persistent_cache.h" #include "flutter/fml/logging.h" -#include "flutter/impeller/entity/mtl/entity_shaders.h" #include "flutter/impeller/renderer/backend/metal/context_mtl.h" #include "flutter/shell/common/context_options.h" #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h" +#include "impeller/entity/mtl/entity_shaders.h" #include "impeller/entity/mtl/modern_shaders.h" +#include "impeller/scene/shaders/mtl/scene_shaders.h" FLUTTER_ASSERT_ARC @@ -18,6 +19,8 @@ std::vector> shader_mappings = { std::make_shared(impeller_entity_shaders_data, impeller_entity_shaders_length), + std::make_shared(impeller_scene_shaders_data, + impeller_scene_shaders_length), std::make_shared(impeller_modern_shaders_data, impeller_modern_shaders_length), };