@@ -10,109 +10,114 @@ declare_args() {
10
10
# Path to the Mali offline compiler tool 'malioc'.
11
11
impeller_malioc_path = " "
12
12
13
- impeller_malioc_cores = []
13
+ impeller_malioc_core_filter = [
14
+ " Mali-G78" ,
15
+ " Mali-T880" ,
16
+ ]
14
17
}
15
18
16
- if (impeller_malioc_path != " " && impeller_malioc_cores == [] ) {
17
- core_list_file = " $root_build_dir /mali_core_list.json"
18
- exec_script (" //build/gn_run_binary .py" ,
19
+ if (impeller_malioc_path != " " ) {
20
+ _core_list_file = " $root_build_dir /mali_core_list.json"
21
+ exec_script (" //flutter/impeller/tools/malioc_cores .py" ,
19
22
[
23
+ " --malioc" ,
20
24
rebase_path (impeller_malioc_path , root_build_dir ),
21
- " --list" ,
22
- " --format" ,
23
- " json" ,
24
25
" --output" ,
25
- rebase_path (core_list_file ),
26
+ rebase_path (_core_list_file ),
26
27
])
27
- _mali_cores = read_file (core_list_file , " json" )
28
- foreach (mali_core , _mali_cores .cores ) {
29
- impeller_malioc_cores += [ mali_core .core ]
30
- }
28
+ _impeller_malioc_cores = read_file (_core_list_file , " json" )
31
29
}
32
30
33
31
template (" malioc_analyze_shaders" ) {
34
- # TODO(zra ): Check that gles_language_version is in the supported set. For now
35
- # assume that if it is set, it is being set to 460, which malioc does not
36
- # support.
37
- if (impeller_malioc_path == " " || defined (invoker .gles_language_version )) {
38
- if (defined (invoker .gles_language_version ) &&
39
- invoker .gles_language_version != " 460" ) {
40
- print (" Disabling analysis for shaders in $target_name due to gles" ,
41
- " version explicitly set to ${ invoker.gles_language_version } ." )
42
- }
32
+ if (impeller_malioc_path == " " ) {
43
33
group (target_name ) {
44
34
not_needed (invoker , " *" )
45
35
}
46
36
} else {
47
37
target_deps = []
48
- foreach (core , impeller_malioc_cores ) {
49
- foreach (source , invoker .shaders ) {
50
- shader_file_name = get_path_info (source , " name" )
51
- analysis_target = " ${ target_name } _${ shader_file_name } _${ core } _malioc"
52
- target_deps += [ " :$analysis_target " ]
53
- action (analysis_target ) {
54
- forward_variables_from (invoker ,
55
- " *" ,
56
- [
57
- " args" ,
58
- " depfile" ,
59
- " inputs" ,
60
- " outputs" ,
61
- " pool" ,
62
- " script" ,
63
- ])
38
+ foreach (core , _impeller_malioc_cores ) {
39
+ foreach (filter_core , impeller_malioc_core_filter ) {
40
+ if (core .core == filter_core ) {
41
+ foreach (source , invoker .shaders ) {
42
+ # Should be "gles" or "vkspv"
43
+ backend_ext = get_path_info (source , " extension" )
44
+ assert (
45
+ backend_ext == " gles" || backend_ext == " vkspv" ,
46
+ " Shader for unsupported backend passed to malioc: {{source}}" )
47
+ shader_file_name = get_path_info (source , " name" )
48
+ analysis_target =
49
+ " ${ target_name } _${ shader_file_name } _${ core.core } _malioc"
50
+ if ((backend_ext == " gles" &&
51
+ defined (invoker .gles_language_version ) &&
52
+ core .opengles_max_version < invoker .gles_language_version ) ||
53
+ (backend_ext == " vkspv" &&
54
+ defined (invoker .vulkan_language_version ) &&
55
+ core .vulkan_max_version < invoker .vulkan_language_version )) {
56
+ group (analysis_target ) {
57
+ not_needed (invoker , " *" )
58
+ }
59
+ } else {
60
+ target_deps += [ " :$analysis_target " ]
61
+ action (analysis_target ) {
62
+ forward_variables_from (invoker ,
63
+ " *" ,
64
+ [
65
+ " args" ,
66
+ " depfile" ,
67
+ " inputs" ,
68
+ " outputs" ,
69
+ " pool" ,
70
+ " script" ,
71
+ ])
64
72
65
- script = " //build/gn_run_binary.py"
66
- pool = " //flutter/impeller/tools:malioc_pool"
73
+ script = " //build/gn_run_binary.py"
74
+ pool = " //flutter/impeller/tools:malioc_pool"
67
75
68
- # Should be "gles" or "vkspv"
69
- backend_ext = get_path_info (source , " extension" )
70
- assert (backend_ext == " gles" ,
71
- " Shader for unsupported backend passed to malioc: {{source}}" )
76
+ # Nest all malioc output under its own subdirectory of root_gen_dir
77
+ # so that it's easier to diff it against the state before any changes.
78
+ subdir = rebase_path (target_gen_dir , root_gen_dir )
79
+ output_file = " $root_gen_dir /malioc/$subdir /${ shader_file_name } .${ backend_ext } .${ core.core } .json"
80
+ outputs = [ output_file ]
72
81
73
- # Nest all malioc output under its own subdirectory of root_gen_dir
74
- # so that it's easier to diff it against the state before any changes.
75
- subdir = rebase_path (target_gen_dir , root_gen_dir )
76
- output_file =
77
- " $root_gen_dir /malioc/$subdir /${ shader_file_name } .$core .json"
78
- outputs = [ output_file ]
82
+ # Determine the kind of the shader from the file name
83
+ name = get_path_info (source , " name" )
84
+ shader_kind_ext = get_path_info (name , " extension" )
79
85
80
- # Determine the kind of the shader from the file name
81
- name = get_path_info (source , " name" )
82
- shader_kind_ext = get_path_info (name , " extension" )
86
+ if (shader_kind_ext == " comp" ) {
87
+ shader_kind_flag = " --compute"
88
+ } else if (shader_kind_ext == " frag" ) {
89
+ shader_kind_flag = " --fragment"
90
+ } else if (shader_kind_ext == " geom" ) {
91
+ shader_kind_flag = " --geometry"
92
+ } else if (shader_kind_ext == " tesc" ) {
93
+ shader_kind_flag = " --tessellation_control"
94
+ } else if (shader_kind_ext == " tese" ) {
95
+ shader_kind_flag = " --tessellation_evaluation"
96
+ } else if (shader_kind_ext == " vert" ) {
97
+ shader_kind_flag = " --vertex"
98
+ } else {
99
+ assert (false , " Unknown shader kind: {{source}}" )
100
+ }
83
101
84
- if (shader_kind_ext == " comp" ) {
85
- shader_kind_flag = " --compute"
86
- } else if (shader_kind_ext == " frag" ) {
87
- shader_kind_flag = " --fragment"
88
- } else if (shader_kind_ext == " geom" ) {
89
- shader_kind_flag = " --geometry"
90
- } else if (shader_kind_ext == " tesc" ) {
91
- shader_kind_flag = " --tessellation_control"
92
- } else if (shader_kind_ext == " tese" ) {
93
- shader_kind_flag = " --tessellation_evaluation"
94
- } else if (shader_kind_ext == " vert" ) {
95
- shader_kind_flag = " --vertex"
96
- } else {
97
- assert (false , " Unknown shader kind: {{source}}" )
98
- }
102
+ args = [
103
+ rebase_path (impeller_malioc_path , root_build_dir ),
104
+ " --format" ,
105
+ " json" ,
106
+ shader_kind_flag ,
107
+ " --core" ,
108
+ core .core ,
109
+ " --output" ,
110
+ rebase_path (output_file ),
111
+ ]
99
112
100
- args = [
101
- rebase_path (impeller_malioc_path , root_build_dir ),
102
- " --format" ,
103
- " json" ,
104
- shader_kind_flag ,
105
- " --core" ,
106
- core ,
107
- " --output" ,
108
- rebase_path (output_file ),
109
- ]
113
+ if (backend_ext == " vkspv" ) {
114
+ args += [ " --vulkan" ]
115
+ }
110
116
111
- if (backend_ext == " vkspv" ) {
112
- args += [ " --vulkan" ]
117
+ args += [ rebase_path (source ) ]
118
+ }
119
+ }
113
120
}
114
-
115
- args += [ rebase_path (source ) ]
116
121
}
117
122
}
118
123
}
0 commit comments