Index: gpu/config/process_json.py |
diff --git a/gpu/config/process_json.py b/gpu/config/process_json.py |
index 05ec4a26e172948a6c59b41f1c18d39780ba954b..648fb067010020c355d7d3387cec6dda080e6264 100755 |
--- a/gpu/config/process_json.py |
+++ b/gpu/config/process_json.py |
@@ -500,7 +500,7 @@ def write_entry_more_data(entry_id, is_exception, exception_id, gl_type, |
def write_entry(entry, total_feature_set, feature_name_prefix, |
- data_file, data_helper_file, data_exception_file): |
+ data_file, data_helper_file, data_exception_file): |
data_file.write('{\n') |
# ID |
entry_id = entry['id'] |
@@ -582,7 +582,7 @@ def process_json_file(json_filepath, list_tag, |
feature_header_filename, total_features, feature_tag, |
output_header_filepath, output_data_filepath, |
output_helper_filepath, output_exception_filepath, path, |
- export_tag, git_format): |
+ export_tag, git_format, os_filter): |
output_header_filename = os.path.basename(output_header_filepath) |
output_helper_filename = os.path.basename(output_helper_filepath) |
output_exception_filename = os.path.basename(output_exception_filepath) |
@@ -611,20 +611,22 @@ def process_json_file(json_filepath, list_tag, |
data_file.write('namespace gpu {\n\n') |
data_file.write('const char k%sVersion[] = "%s";\n\n' % |
(list_tag, json_data['version'])) |
- entry_count = len(json_data['entries']) |
- data_file.write('const size_t k%sEntryCount = %d;\n' % |
- (list_tag, entry_count)) |
- data_file.write('const GpuControlList::Entry k%sEntries[%d] = {\n' % |
- (list_tag, entry_count)) |
+ data_file.write('const GpuControlList::Entry k%sEntries[] = {\n' % list_tag) |
ids = [] |
- for index in range(entry_count): |
+ entry_count = 0 |
+ for index in range(len(json_data['entries'])): |
entry = json_data['entries'][index] |
entry_id = entry['id'] |
assert entry_id not in ids |
ids.append(entry_id) |
+ if os_filter != None and 'os' in entry and entry['os']['type'] != os_filter: |
+ continue |
+ entry_count += 1 |
write_entry(entry, total_features, feature_tag, |
data_file, data_helper_file, data_exception_file) |
data_file.write('};\n') |
+ data_file.write('const size_t k%sEntryCount = %d;\n' % |
+ (list_tag, entry_count)) |
data_file.write('} // namespace gpu\n') |
data_file.close() |
data_helper_file.write('} // namespace gpu\n') |
@@ -658,7 +660,7 @@ def process_json_file(json_filepath, list_tag, |
output_helper_filepath, output_exception_filepath]) |
-def process_software_rendering_list(script_dir, output_dir): |
+def process_software_rendering_list(script_dir, output_dir, os_filter): |
total_features = load_software_rendering_list_features( |
os.path.join(script_dir, 'gpu_feature_type.h')) |
process_json_file( |
@@ -674,10 +676,11 @@ def process_software_rendering_list(script_dir, output_dir): |
os.path.join(output_dir, 'software_rendering_list_exceptions_autogen.h'), |
'gpu/config', |
'GPU_EXPORT ', |
- False) |
+ False, |
+ os_filter) |
-def process_gpu_driver_bug_list(script_dir, output_dir): |
+def process_gpu_driver_bug_list(script_dir, output_dir, os_filter): |
total_features = load_gpu_driver_bug_workarounds( |
os.path.join(script_dir, 'gpu_driver_bug_workaround_type.h')) |
process_json_file( |
@@ -693,7 +696,8 @@ def process_gpu_driver_bug_list(script_dir, output_dir): |
os.path.join(output_dir, 'gpu_driver_bug_list_exceptions_autogen.h'), |
'gpu/config', |
'GPU_EXPORT ', |
- False) |
+ False, |
+ os_filter) |
def process_gpu_control_list_testing(script_dir, output_dir): |
@@ -711,7 +715,8 @@ def process_gpu_control_list_testing(script_dir, output_dir): |
os.path.join(output_dir, 'gpu_control_list_testing_exceptions_autogen.h'), |
'gpu/config', |
'', |
- True) |
+ True, |
+ None) |
def process_gpu_data_manager_testing(script_dir, output_dir): |
@@ -730,7 +735,8 @@ def process_gpu_data_manager_testing(script_dir, output_dir): |
os.path.join(output_dir, 'gpu_data_manager_testing_exceptions_autogen.h'), |
'content/browser/gpu', |
'', |
- True) |
+ True, |
+ None) |
def write_test_entry_enums(input_json_filepath, output_entry_enums_filepath, |
@@ -771,13 +777,17 @@ def main(argv): |
parser.add_option("--skip-testing-data", action="store_false", |
dest="generate_testing_data", default=True, |
help="skip testing data generation.") |
+ parser.add_option("--os-filter", |
+ help="only output entries applied to the specified os.") |
(options, args) = parser.parse_args(args=argv) |
script_dir = os.path.dirname(os.path.realpath(__file__)) |
if options.output_dir != None: |
- process_software_rendering_list(script_dir, options.output_dir) |
- process_gpu_driver_bug_list(script_dir, options.output_dir) |
+ process_software_rendering_list( |
+ script_dir, options.output_dir, options.os_filter) |
+ process_gpu_driver_bug_list( |
+ script_dir, options.output_dir, options.os_filter) |
if options.generate_testing_data: |
# Testing data files are generated by calling the script manually. |