Flutter Engine
The Flutter Engine
Functions
tools.build_workaround_header Namespace Reference

Functions

def merge_files_into_workarounds (files)
 
def write_header (filename, workarounds)
 
def main (argv)
 

Function Documentation

◆ main()

def tools.build_workaround_header.main (   argv)

Definition at line 54 of file build_workaround_header.py.

54def main(argv):
55 usage = "usage: %prog [options] file1 file2 file3 etc"
56 parser = OptionParser(usage=usage)
57 parser.add_option(
58 "--output-file",
59 dest="output_file",
60 default="gpu_driver_bug_workaround_autogen.h",
61 help="the name of the header file to write")
62
63 (options, _) = parser.parse_args(args=argv)
64
65 workarounds = merge_files_into_workarounds(parser.largs)
66 write_header(options.output_file, workarounds)
67
68
def write_header(filename, workarounds)

◆ merge_files_into_workarounds()

def tools.build_workaround_header.merge_files_into_workarounds (   files)

Definition at line 22 of file build_workaround_header.py.

23 workarounds = set()
24 for filename in files:
25 with open(filename, 'r') as f:
26 workarounds.update([workaround.strip() for workaround in f])
27 return sorted(list(workarounds))
28
29
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76

◆ write_header()

def tools.build_workaround_header.write_header (   filename,
  workarounds 
)

Definition at line 30 of file build_workaround_header.py.

30def write_header(filename, workarounds):
31 max_workaround_len = len(max(workarounds, key=len))
32
33 with open(filename, 'w') as f:
34 f.write(_LICENSE)
35 f.write(_DO_NOT_EDIT_WARNING)
36
37 indent = ' '
38 macro = 'GPU_OP'
39
40 # length of max string passed to write + 1
41 max_len = len(indent) + len(macro) + 1 + max_workaround_len + 1 + 1
42 write = lambda line: f.write(line + ' ' * (max_len - len(line)) + '\\\n')
43 f.write('#ifndef GPU_DRIVER_BUG_WORKAROUNDS\n')
44 write('#define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)')
45 for w in workarounds:
46 write(indent + macro + '(' + w.upper() + ',')
47 write(indent + ' ' * (len(macro) + 1) + w + ')')
48
49 # one extra line for the last escaped newline to handle.
50 f.write('\n')
51 f.write('#endif // GPU_DRIVER_BUG_WORKAROUNDS\n')
52
53
static float max(float r, float g, float b)
Definition: hsl.cpp:49
void write(SkWStream *wStream, const T &text)
Definition: skqp.cpp:188