2929#include " third_party/dart/runtime/include/dart_api.h"
3030#include " third_party/skia/include/core/SkSurface.h"
3131
32- #if IMPELLER_SUPPORTS_RENDERING
32+ // Impeller should only be enabled if the Vulkan backend is enabled.
33+ #define ALLOW_IMPELLER (IMPELLER_SUPPORTS_RENDERING && IMPELLER_ENABLE_VULKAN)
34+
35+ #if ALLOW_IMPELLER
3336#include < vulkan/vulkan.h> // nogncheck
3437#include " flutter/vulkan/procs/vulkan_proc_table.h" // nogncheck
3538#include " flutter/vulkan/swiftshader_path.h" // nogncheck
@@ -128,7 +131,7 @@ class TesterPlatformView : public PlatformView,
128131 impeller_context_holder_ (std::move(impeller_context_holder)) {}
129132
130133 ~TesterPlatformView () {
131- #if IMPELLER_SUPPORTS_RENDERING
134+ #if ALLOW_IMPELLER
132135 if (impeller_context_holder_.context ) {
133136 impeller_context_holder_.context ->Shutdown ();
134137 }
@@ -137,25 +140,25 @@ class TesterPlatformView : public PlatformView,
137140
138141 // |PlatformView|
139142 std::shared_ptr<impeller::Context> GetImpellerContext () const override {
140- #if IMPELLER_SUPPORTS_RENDERING
143+ #if ALLOW_IMPELLER
141144 return std::static_pointer_cast<impeller::Context>(
142145 impeller_context_holder_.context );
143146#else
144147 return nullptr ;
145- #endif // IMPELLER_SUPPORTS_RENDERING
148+ #endif // ALLOW_IMPELLER
146149 }
147150
148151 // |PlatformView|
149152 std::unique_ptr<Surface> CreateRenderingSurface () override {
150- #if IMPELLER_SUPPORTS_RENDERING
153+ #if ALLOW_IMPELLER
151154 if (delegate_.OnPlatformViewGetSettings ().enable_impeller ) {
152155 FML_DCHECK (impeller_context_holder_.context );
153156 auto surface = std::make_unique<GPUSurfaceVulkanImpeller>(
154157 impeller_context_holder_.surface_context );
155158 FML_DCHECK (surface->IsValid ());
156159 return surface;
157160 }
158- #endif // IMPELLER_SUPPORTS_RENDERING
161+ #endif // ALLOW_IMPELLER
159162 auto surface = std::make_unique<TesterGPUSurfaceSoftware>(
160163 this , true /* render to surface */ );
161164 FML_DCHECK (surface->IsValid ());
@@ -308,7 +311,7 @@ int RunTester(const flutter::Settings& settings,
308311
309312 ImpellerVulkanContextHolder impeller_context_holder;
310313
311- #if IMPELLER_SUPPORTS_RENDERING
314+ #if ALLOW_IMPELLER
312315 if (settings.enable_impeller ) {
313316 impeller_context_holder.vulkan_proc_table =
314317 fml::MakeRefCounted<vulkan::VulkanProcTable>(VULKAN_SO_PATH);
@@ -356,7 +359,7 @@ int RunTester(const flutter::Settings& settings,
356359 return EXIT_FAILURE;
357360 }
358361 }
359- #endif // IMPELLER_SUPPORTS_RENDERING
362+ #endif // ALLOW_IMPELLER
360363
361364 Shell::CreateCallback<PlatformView> on_create_platform_view =
362365 [impeller_context_holder =
0 commit comments