| 1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
|---|---|
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "flutter/shell/common/context_options.h" |
| 6 | |
| 7 | #include "flutter/common/graphics/persistent_cache.h" |
| 8 | |
| 9 | namespace flutter { |
| 10 | |
| 11 | GrContextOptions MakeDefaultContextOptions(ContextType type, |
| 12 | std::optional<GrBackendApi> api) { |
| 13 | GrContextOptions options; |
| 14 | |
| 15 | if (PersistentCache::cache_sksl()) { |
| 16 | options.fShaderCacheStrategy = GrContextOptions::ShaderCacheStrategy::kSkSL; |
| 17 | } |
| 18 | PersistentCache::MarkStrategySet(); |
| 19 | options.fPersistentCache = PersistentCache::GetCacheForProcess(); |
| 20 | |
| 21 | if (api.has_value() && api.value() == GrBackendApi::kOpenGL) { |
| 22 | // Using stencil buffers has caused memory and performance regressions. |
| 23 | // See b/226484927 for internal customer regressions doc. |
| 24 | // Before enabling, we need to show a motivating case for where it will |
| 25 | // improve performance on OpenGL backend. |
| 26 | options.fAvoidStencilBuffers = true; |
| 27 | |
| 28 | // To get video playback on the widest range of devices, we limit Skia to |
| 29 | // ES2 shading language when the ES3 external image extension is missing. |
| 30 | options.fPreferExternalImagesOverES3 = true; |
| 31 | } |
| 32 | |
| 33 | // TODO(goderbauer): remove option when skbug.com/7523 is fixed. |
| 34 | options.fDisableGpuYUVConversion = true; |
| 35 | |
| 36 | options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; |
| 37 | |
| 38 | options.fReducedShaderVariations = false; |
| 39 | |
| 40 | return options; |
| 41 | }; |
| 42 | |
| 43 | } // namespace flutter |
| 44 |
