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

Commit cd1fe95

Browse files
committed
[fuchsia] runtime flag for shader warmup.
1 parent 6c9924f commit cd1fe95

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

shell/platform/fuchsia/flutter/engine.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,14 @@ Engine::Engine(Delegate& delegate,
261261
}
262262
};
263263
#else
264-
on_create_rasterizer = [this](flutter::Shell& shell) {
265-
FML_DCHECK(surface_producer_);
266-
267-
WarmupSkps(
268-
shell.GetDartVM()->GetConcurrentMessageLoop()->GetTaskRunner().get(),
269-
shell.GetTaskRunners().GetRasterTaskRunner().get(),
270-
surface_producer_.value());
271-
264+
on_create_rasterizer = [this, &product_config](flutter::Shell& shell) {
265+
if (product_config.enable_shader_warmup()) {
266+
FML_DCHECK(surface_producer_);
267+
WarmupSkps(
268+
shell.GetDartVM()->GetConcurrentMessageLoop()->GetTaskRunner().get(),
269+
shell.GetTaskRunners().GetRasterTaskRunner().get(),
270+
surface_producer_.value());
271+
}
272272
return std::make_unique<flutter::Rasterizer>(shell);
273273
};
274274
#endif

shell/platform/fuchsia/flutter/flutter_runner_product_configuration.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ FlutterRunnerProductConfiguration::FlutterRunnerProductConfiguration(
3333
if (val.IsBool())
3434
intercept_all_input_ = val.GetBool();
3535
}
36+
if (document.HasMember("enable_shader_warmup")) {
37+
auto& val = document["enable_shader_warmup"];
38+
if (val.IsBool())
39+
enable_shader_warmup_ = val.GetBool();
40+
}
3641
#if defined(LEGACY_FUCHSIA_EMBEDDER)
3742
if (document.HasMember("use_legacy_renderer")) {
3843
auto& val = document["use_legacy_renderer"];

shell/platform/fuchsia/flutter/flutter_runner_product_configuration.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class FlutterRunnerProductConfiguration {
1717
fml::TimeDelta get_vsync_offset() { return vsync_offset_; }
1818
uint64_t get_max_frames_in_flight() { return max_frames_in_flight_; }
1919
bool get_intercept_all_input() { return intercept_all_input_; }
20+
bool enable_shader_warmup() { return enable_shader_warmup_; }
2021
#if defined(LEGACY_FUCHSIA_EMBEDDER)
2122
bool use_legacy_renderer() { return use_legacy_renderer_; }
2223
#endif
@@ -25,6 +26,7 @@ class FlutterRunnerProductConfiguration {
2526
fml::TimeDelta vsync_offset_ = fml::TimeDelta::Zero();
2627
uint64_t max_frames_in_flight_ = 3;
2728
bool intercept_all_input_ = false;
29+
bool enable_shader_warmup_ = false;
2830
#if defined(LEGACY_FUCHSIA_EMBEDDER)
2931
bool use_legacy_renderer_ = true;
3032
#endif

0 commit comments

Comments
 (0)