5"""code generator for gpu workaround definitions"""
10from optparse
import OptionParser
12_LICENSE =
"""// Copyright 2018 The Chromium Authors. All rights reserved.
13// Use of this source code is governed by a BSD-style license that can be
14// found in the LICENSE file.
18_DO_NOT_EDIT_WARNING = (
"// This file is auto-generated from " +
19 os.path.basename(__file__) +
"\n" +
20 "// DO NOT EDIT!\n\n")
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))
31 max_workaround_len =
len(
max(workarounds, key=len))
33 with open(filename,
'w')
as f:
35 f.write(_DO_NOT_EDIT_WARNING)
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)')
46 write(indent + macro +
'(' + w.upper() +
',')
47 write(indent +
' ' * (
len(macro) + 1) + w +
')')
51 f.write(
'#endif // GPU_DRIVER_BUG_WORKAROUNDS\n')
55 usage =
"usage: %prog [options] file1 file2 file3 etc"
56 parser = OptionParser(usage=usage)
60 default=
"gpu_driver_bug_workaround_autogen.h",
61 help=
"the name of the header file to write")
63 (options, _) = parser.parse_args(args=argv)
69if __name__ ==
'__main__':
70 sys.exit(
main(sys.argv[1:]))
static float max(float r, float g, float b)
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
void write(SkWStream *wStream, const T &text)