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

Commit 303c999

Browse files
committed
[fuchsia] runtime flag for shader warmup
1 parent 0556160 commit 303c999

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
@@ -259,14 +259,14 @@ Engine::Engine(Delegate& delegate,
259259
}
260260
};
261261
#else
262-
on_create_rasterizer = [this](flutter::Shell& shell) {
263-
FML_DCHECK(surface_producer_);
264-
265-
WarmupSkps(
266-
shell.GetDartVM()->GetConcurrentMessageLoop()->GetTaskRunner().get(),
267-
shell.GetTaskRunners().GetRasterTaskRunner().get(),
268-
surface_producer_.value());
269-
262+
on_create_rasterizer = [this, &product_config](flutter::Shell& shell) {
263+
if (product_config.enable_shader_warmup()) {
264+
FML_DCHECK(surface_producer_);
265+
WarmupSkps(
266+
shell.GetDartVM()->GetConcurrentMessageLoop()->GetTaskRunner().get(),
267+
shell.GetTaskRunners().GetRasterTaskRunner().get(),
268+
surface_producer_.value());
269+
}
270270
return std::make_unique<flutter::Rasterizer>(shell);
271271
};
272272
#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)