29
29
#include " third_party/dart/runtime/include/dart_api.h"
30
30
#include " third_party/skia/include/core/SkSurface.h"
31
31
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
33
36
#include < vulkan/vulkan.h> // nogncheck
34
37
#include " flutter/vulkan/procs/vulkan_proc_table.h" // nogncheck
35
38
#include " flutter/vulkan/swiftshader_path.h" // nogncheck
@@ -128,7 +131,7 @@ class TesterPlatformView : public PlatformView,
128
131
impeller_context_holder_ (std::move(impeller_context_holder)) {}
129
132
130
133
~TesterPlatformView () {
131
- #if IMPELLER_SUPPORTS_RENDERING
134
+ #if ALLOW_IMPELLER
132
135
if (impeller_context_holder_.context ) {
133
136
impeller_context_holder_.context ->Shutdown ();
134
137
}
@@ -137,25 +140,25 @@ class TesterPlatformView : public PlatformView,
137
140
138
141
// |PlatformView|
139
142
std::shared_ptr<impeller::Context> GetImpellerContext () const override {
140
- #if IMPELLER_SUPPORTS_RENDERING
143
+ #if ALLOW_IMPELLER
141
144
return std::static_pointer_cast<impeller::Context>(
142
145
impeller_context_holder_.context );
143
146
#else
144
147
return nullptr ;
145
- #endif // IMPELLER_SUPPORTS_RENDERING
148
+ #endif // ALLOW_IMPELLER
146
149
}
147
150
148
151
// |PlatformView|
149
152
std::unique_ptr<Surface> CreateRenderingSurface () override {
150
- #if IMPELLER_SUPPORTS_RENDERING
153
+ #if ALLOW_IMPELLER
151
154
if (delegate_.OnPlatformViewGetSettings ().enable_impeller ) {
152
155
FML_DCHECK (impeller_context_holder_.context );
153
156
auto surface = std::make_unique<GPUSurfaceVulkanImpeller>(
154
157
impeller_context_holder_.surface_context );
155
158
FML_DCHECK (surface->IsValid ());
156
159
return surface;
157
160
}
158
- #endif // IMPELLER_SUPPORTS_RENDERING
161
+ #endif // ALLOW_IMPELLER
159
162
auto surface = std::make_unique<TesterGPUSurfaceSoftware>(
160
163
this , true /* render to surface */ );
161
164
FML_DCHECK (surface->IsValid ());
@@ -308,7 +311,7 @@ int RunTester(const flutter::Settings& settings,
308
311
309
312
ImpellerVulkanContextHolder impeller_context_holder;
310
313
311
- #if IMPELLER_SUPPORTS_RENDERING
314
+ #if ALLOW_IMPELLER
312
315
if (settings.enable_impeller ) {
313
316
impeller_context_holder.vulkan_proc_table =
314
317
fml::MakeRefCounted<vulkan::VulkanProcTable>(VULKAN_SO_PATH);
@@ -356,7 +359,7 @@ int RunTester(const flutter::Settings& settings,
356
359
return EXIT_FAILURE;
357
360
}
358
361
}
359
- #endif // IMPELLER_SUPPORTS_RENDERING
362
+ #endif // ALLOW_IMPELLER
360
363
361
364
Shell::CreateCallback<PlatformView> on_create_platform_view =
362
365
[impeller_context_holder =
0 commit comments