forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
context_options.cc
39 lines (27 loc) · 1.25 KB
/
context_options.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/common/context_options.h"
#include "flutter/common/graphics/persistent_cache.h"
namespace flutter {
GrContextOptions MakeDefaultContextOptions(ContextType type,
std::optional<GrBackendApi> api) {
GrContextOptions options;
if (PersistentCache::cache_sksl()) {
options.fShaderCacheStrategy = GrContextOptions::ShaderCacheStrategy::kSkSL;
}
PersistentCache::MarkStrategySet();
options.fPersistentCache = PersistentCache::GetCacheForProcess();
if (api.has_value() && api.value() == GrBackendApi::kOpenGL) {
options.fAvoidStencilBuffers = true;
// To get video playback on the widest range of devices, we limit Skia to
// ES2 shading language when the ES3 external image extension is missing.
options.fPreferExternalImagesOverES3 = true;
}
// TODO(goderbauer): remove option when skbug.com/7523 is fixed.
options.fDisableGpuYUVConversion = true;
options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo;
options.fReducedShaderVariations = false;
return options;
};
} // namespace flutter