Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
CommonFlags Namespace Reference

Functions

bool CollectImages (const CommandLineFlags::StringArray &dir, skia_private::TArray< SkString > *output)
 
void SetCtxOptions (struct GrContextOptions *)
 
static DEFINE_bool (cachePathMasks, true, "Allows path mask textures to be cached in GPU configs.")
 
static DEFINE_bool (failFlushTimeCallbacks, false, "Causes all flush-time callbacks to fail.")
 
static DEFINE_bool (allPathsVolatile, false, "Causes all GPU paths to be processed as if 'setIsVolatile' had been called.")
 
static DEFINE_string (pr, "", "Set of enabled gpu path renderers. Defined as a list of: " "[~]none [~]dashline [~]aahairline [~]aaconvex [~]aalinearizing [~]small [~]tri " "[~]atlas [~]tess [~]all")
 
static DEFINE_int (internalSamples, -1, "Number of samples for internal draws that use MSAA, or default value if negative.")
 
static DEFINE_int (maxAtlasSize, -1, "Maximum width and height of internal texture atlases, or default value if negative.")
 
static DEFINE_bool (disableDriverCorrectnessWorkarounds, false, "Disables all GPU driver correctness workarounds")
 
static DEFINE_bool (dontReduceOpsTaskSplitting, false, "Don't reorder tasks to reduce render passes")
 
static DEFINE_int (gpuResourceCacheLimit, -1, "Maximum number of bytes to use for budgeted GPU resources. " "Default is -1, which means GrResourceCache::kDefaultMaxSize.")
 
static DEFINE_bool (allowMSAAOnNewIntel, false, "Allows MSAA to be enabled on newer intel GPUs.")
 
static GpuPathRenderers get_named_pathrenderers_flags (const char *name)
 
static GpuPathRenderers collect_gpu_path_renderers_from_flags ()
 

Function Documentation

◆ collect_gpu_path_renderers_from_flags()

static GpuPathRenderers CommonFlags::collect_gpu_path_renderers_from_flags ( )
static

Definition at line 75 of file CommonFlagsGpu.cpp.

75 {
76 if (FLAGS_pr.isEmpty()) {
78 }
79
80 GpuPathRenderers gpuPathRenderers = ('~' == FLAGS_pr[0][0])
83
84 for (int i = 0; i < FLAGS_pr.size(); ++i) {
85 const char* name = FLAGS_pr[i];
86 if (name[0] == '~') {
87 gpuPathRenderers &= ~get_named_pathrenderers_flags(&name[1]);
88 } else {
89 gpuPathRenderers |= get_named_pathrenderers_flags(name);
90 }
91 }
92 return gpuPathRenderers;
93}
GpuPathRenderers
const char * name
Definition fuchsia.cc:50
static GpuPathRenderers get_named_pathrenderers_flags(const char *name)

◆ CollectImages()

bool CommonFlags::CollectImages ( const CommandLineFlags::StringArray dir,
skia_private::TArray< SkString > *  output 
)

Helper to assist in collecting image paths from |dir| specified through a command line flag.

Populates |output|, an array of strings with paths to images to test.

Returns true if each argument to the images flag is meaningful:

  • If the file/directory does not exist, return false.
  • If |dir| does not have any supported images (based on file type), return false.
  • If |dir| is a single file, assume the user is deliberately testing this image, regardless of file type.

Definition at line 11 of file CommonFlagsImages.cpp.

11 {
12 SkASSERT(output);
13
14 static const char* const exts[] = {
15 "bmp",
16 "gif",
17 "jpg",
18 "jpeg",
19 "png",
20 "webp",
21 "ktx",
22 "astc",
23 "wbmp",
24 "ico",
25#if !defined(SK_BUILD_FOR_WIN)
26 "BMP",
27 "GIF",
28 "JPG",
29 "JPEG",
30 "PNG",
31 "WEBP",
32 "KTX",
33 "ASTC",
34 "WBMP",
35 "ICO",
36#endif
37#ifdef SK_HAS_HEIF_LIBRARY
38 "heic",
39#if !defined(SK_BUILD_FOR_WIN)
40 "HEIC",
41#endif
42#endif
43#ifdef SK_CODEC_DECODES_RAW
44 "arw",
45 "cr2",
46 "dng",
47 "nef",
48 "nrw",
49 "orf",
50 "raf",
51 "rw2",
52 "pef",
53 "srw",
54#if !defined(SK_BUILD_FOR_WIN)
55 "ARW",
56 "CR2",
57 "DNG",
58 "NEF",
59 "NRW",
60 "ORF",
61 "RAF",
62 "RW2",
63 "PEF",
64 "SRW",
65#endif
66#endif
67 };
68
69 for (int i = 0; i < images.size(); ++i) {
70 const char* flag = images[i];
71 if (!sk_exists(flag)) {
72 SkDebugf("%s does not exist!\n", flag);
73 return false;
74 }
75
76 if (sk_isdir(flag)) {
77 // If the value passed in is a directory, add all the images
78 bool foundAnImage = false;
79 for (const char* ext : exts) {
80 SkOSFile::Iter it(flag, ext);
82 while (it.next(&file)) {
83 foundAnImage = true;
84 output->push_back() = SkOSPath::Join(flag, file.c_str());
85 }
86 }
87 if (!foundAnImage) {
88 SkDebugf("No supported images found in %s!\n", flag);
89 return false;
90 }
91 } else {
92 // Also add the value if it is a single image
93 output->push_back() = flag;
94 }
95 }
96 return true;
97}
#define SkASSERT(cond)
Definition SkAssert.h:116
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
bool sk_exists(const char *path, SkFILE_Flags=(SkFILE_Flags) 0)
bool sk_isdir(const char *path)
static SkString Join(const char *rootPath, const char *relativePath)
Definition SkOSPath.cpp:14
FlutterSemanticsFlag flag
std::array< MockImage, 3 > images

◆ DEFINE_bool() [1/6]

static CommonFlags::DEFINE_bool ( allowMSAAOnNewIntel  ,
false  ,
"Allows MSAA to be enabled on newer intel GPUs."   
)
static

◆ DEFINE_bool() [2/6]

static CommonFlags::DEFINE_bool ( allPathsVolatile  ,
false  ,
"Causes all GPU paths to be processed as if 'setIsVolatile' had been called."   
)
static

◆ DEFINE_bool() [3/6]

static CommonFlags::DEFINE_bool ( cachePathMasks  ,
true  ,
"Allows path mask textures to be cached in GPU configs."   
)
static

◆ DEFINE_bool() [4/6]

static CommonFlags::DEFINE_bool ( disableDriverCorrectnessWorkarounds  ,
false  ,
"Disables all GPU driver correctness workarounds"   
)
static

◆ DEFINE_bool() [5/6]

static CommonFlags::DEFINE_bool ( dontReduceOpsTaskSplitting  ,
false  ,
"Don't reorder tasks to reduce render passes"   
)
static

◆ DEFINE_bool() [6/6]

static CommonFlags::DEFINE_bool ( failFlushTimeCallbacks  ,
false  ,
"Causes all flush-time callbacks to fail."   
)
static

◆ DEFINE_int() [1/3]

static CommonFlags::DEFINE_int ( gpuResourceCacheLimit  ,
1,
"Maximum number of bytes to use for budgeted GPU resources. " "Default is -  1,
which means GrResourceCache::kDefaultMaxSize."   
)
static

◆ DEFINE_int() [2/3]

static CommonFlags::DEFINE_int ( internalSamples  ,
1,
"Number of samples for internal draws that use  MSAA,
or default value if negative."   
)
static

◆ DEFINE_int() [3/3]

static CommonFlags::DEFINE_int ( maxAtlasSize  ,
1,
"Maximum width and height of internal texture  atlases,
or default value if negative."   
)
static

◆ DEFINE_string()

static CommonFlags::DEFINE_string ( pr  ,
""  ,
"Set of enabled gpu path renderers. Defined as a list of: " "none dashline aahairline aaconvex aalinearizing small tri " "atlas tess all"  [~][~][~][~][~][~][~][~][~][~] 
)
static

◆ get_named_pathrenderers_flags()

static GpuPathRenderers CommonFlags::get_named_pathrenderers_flags ( const char *  name)
static

Definition at line 50 of file CommonFlagsGpu.cpp.

50 {
51 if (!strcmp(name, "none")) {
53 } else if (!strcmp(name, "dashline")) {
55 } else if (!strcmp(name, "aahairline")) {
57 } else if (!strcmp(name, "aaconvex")) {
59 } else if (!strcmp(name, "aalinearizing")) {
61 } else if (!strcmp(name, "small")) {
63 } else if (!strcmp(name, "tri")) {
65 } else if (!strcmp(name, "atlas")) {
67 } else if (!strcmp(name, "tess")) {
69 } else if (!strcmp(name, "default")) {
71 }
72 SK_ABORT("error: unknown named path renderer \"%s\"\n", name);
73}
#define SK_ABORT(message,...)
Definition SkAssert.h:70

◆ SetCtxOptions()

void CommonFlags::SetCtxOptions ( struct GrContextOptions ctxOptions)

Helper to set GrContextOptions from common GPU flags, including –gpuThreads –cachePathMasks –allPathsVolatile –(no)gs –(no)ts –pr –internalSamples –disableDriverCorrectnessWorkarounds –reduceOpsTaskSplitting –dontReduceOpsTaskSplitting –allowMSAAOnNewIntel

Definition at line 95 of file CommonFlagsGpu.cpp.

95 {
96 static std::unique_ptr<SkExecutor> gGpuExecutor = (0 != FLAGS_gpuThreads)
97 ? SkExecutor::MakeFIFOThreadPool(FLAGS_gpuThreads)
98 : nullptr;
99
100 ctxOptions->fExecutor = gGpuExecutor.get();
101 ctxOptions->fAllowPathMaskCaching = FLAGS_cachePathMasks;
102 ctxOptions->fFailFlushTimeCallbacks = FLAGS_failFlushTimeCallbacks;
103 ctxOptions->fAllPathsVolatile = FLAGS_allPathsVolatile;
104 ctxOptions->fGpuPathRenderers = collect_gpu_path_renderers_from_flags();
105 ctxOptions->fDisableDriverCorrectnessWorkarounds = FLAGS_disableDriverCorrectnessWorkarounds;
106 ctxOptions->fResourceCacheLimitOverride = FLAGS_gpuResourceCacheLimit;
107
108 if (FLAGS_internalSamples >= 0) {
109 ctxOptions->fInternalMultisampleCount = FLAGS_internalSamples;
110 }
111 if (FLAGS_maxAtlasSize >= 0) {
112 ctxOptions->fMaxTextureAtlasSize = FLAGS_maxAtlasSize;
113 }
114
115 if (FLAGS_dontReduceOpsTaskSplitting) {
117 } else {
119 }
120 ctxOptions->fAllowMSAAOnNewIntel = FLAGS_allowMSAAOnNewIntel;
121}
static std::unique_ptr< SkExecutor > MakeFIFOThreadPool(int threads=0, bool allowBorrowing=true)
static GpuPathRenderers collect_gpu_path_renderers_from_flags()
SkExecutor * fExecutor
bool fDisableDriverCorrectnessWorkarounds