1# Copyright 2014 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build/config/chrome_build.gni") 6import("//build/config/chromecast_build.gni") 7import("//build/config/ui.gni") 8import("//gpu/vulkan/features.gni") 9 10group("config") { 11 if (is_component_build) { 12 public_deps = [ "//gpu" ] 13 } else { 14 public_deps = [ ":config_sources" ] 15 } 16} 17 18process_json_outputs = [ 19 "$target_gen_dir/gpu_driver_bug_list_arrays_and_structs_autogen.h", 20 "$target_gen_dir/gpu_driver_bug_list_autogen.cc", 21 "$target_gen_dir/gpu_driver_bug_list_autogen.h", 22 "$target_gen_dir/gpu_driver_bug_list_exceptions_autogen.h", 23 "$target_gen_dir/software_rendering_list_arrays_and_structs_autogen.h", 24 "$target_gen_dir/software_rendering_list_autogen.cc", 25 "$target_gen_dir/software_rendering_list_autogen.h", 26 "$target_gen_dir/software_rendering_list_exceptions_autogen.h", 27] 28 29action("process_json") { 30 script = "process_json.py" 31 32 inputs = [ 33 "gpu_driver_bug_list.json", 34 "gpu_driver_bug_workaround_type.h", 35 "gpu_feature_type.h", 36 "software_rendering_list.json", 37 ] 38 39 outputs = process_json_outputs 40 41 args = [ 42 "--output-dir", 43 rebase_path("$target_gen_dir", root_build_dir), 44 "--skip-testing-data", 45 "--os-filter", 46 ] 47 if (is_win) { 48 args += [ "win" ] 49 } else if (is_mac) { 50 args += [ "macosx" ] 51 } else if (is_android) { 52 args += [ "android" ] 53 } else if (is_chromeos) { 54 args += [ "chromeos" ] 55 } else if (is_fuchsia) { 56 args += [ "fuchsia" ] 57 } else { 58 args += [ "linux" ] 59 } 60 61 public_deps = [ ":workaround_list" ] 62} 63 64action("workaround_list") { 65 script = "build_workaround_header.py" 66 67 skia_workaround_list = "//third_party/skia/src/gpu/gpu_workaround_list.txt" 68 inputs = [ 69 "gpu_workaround_list.txt", 70 skia_workaround_list, 71 ] 72 73 outputs = [ "$target_gen_dir/gpu_driver_bug_workaround_autogen.h" ] 74 75 args = [ 76 "--output-file", 77 rebase_path(outputs[0], root_build_dir), 78 ] 79 foreach(file, inputs) { 80 args += [ rebase_path(file, root_build_dir) ] 81 } 82} 83 84if (enable_vulkan) { 85 component("vulkan_info") { 86 sources = [ 87 "vulkan_info.cc", 88 "vulkan_info.h", 89 ] 90 91 configs += [ "//gpu:gpu_implementation" ] 92 93 deps = [ "//gpu/ipc/common:vulkan_interface" ] 94 95 all_dependent_configs = [ "//third_party/vulkan:vulkan_config" ] 96 97 # surpass linke error 4217. It is because vulkan_info depends on 98 # //gpu/ipc/common:vulkan_interface and //gpu/ipc/common:vulkan_interface" 99 # depends on this target. 100 # TODO(penghuang): Fix this link error 101 if (is_win && is_component_build) { 102 ldflags = [ "/IGNORE:4217" ] 103 } 104 } 105} 106 107source_set("config_sources") { 108 # External code should depend on this via //gpu/config above rather than 109 # depending on this directly or the component build will break. 110 visibility = [ "//gpu/*" ] 111 112 sources = [ 113 "device_perf_info.cc", 114 "device_perf_info.h", 115 "dx_diag_node.cc", 116 "dx_diag_node.h", 117 "gpu_blocklist.cc", 118 "gpu_blocklist.h", 119 "gpu_control_list.cc", 120 "gpu_control_list.h", 121 "gpu_crash_keys.cc", 122 "gpu_crash_keys.h", 123 "gpu_domain_guilt.h", 124 "gpu_driver_bug_list.cc", 125 "gpu_driver_bug_list.h", 126 "gpu_driver_bug_workaround_type.h", 127 "gpu_driver_bug_workarounds.cc", 128 "gpu_driver_bug_workarounds.h", 129 "gpu_dx_diagnostics_win.cc", 130 "gpu_extra_info.cc", 131 "gpu_extra_info.h", 132 "gpu_feature_info.cc", 133 "gpu_feature_info.h", 134 "gpu_feature_type.h", 135 "gpu_finch_features.cc", 136 "gpu_finch_features.h", 137 "gpu_info.cc", 138 "gpu_info.h", 139 "gpu_info_collector.cc", 140 "gpu_info_collector.h", 141 "gpu_info_collector_android.cc", 142 "gpu_info_collector_linux.cc", 143 "gpu_info_collector_mac.mm", 144 "gpu_info_collector_win.cc", 145 "gpu_mode.h", 146 "gpu_preferences.cc", 147 "gpu_preferences.h", 148 "gpu_switches.cc", 149 "gpu_switches.h", 150 "gpu_switching.cc", 151 "gpu_switching.h", 152 "gpu_test_config.cc", 153 "gpu_test_config.h", 154 "gpu_test_expectations_parser.cc", 155 "gpu_test_expectations_parser.h", 156 "gpu_util.cc", 157 "gpu_util.h", 158 "skia_limits.cc", 159 "skia_limits.h", 160 ] 161 162 if (is_fuchsia) { 163 sources += [ "gpu_info_collector_fuchsia.cc" ] 164 } 165 166 sources += process_json_outputs 167 168 configs += [ "//gpu:gpu_implementation" ] 169 170 public_deps = [ "//components/crash/core/common:crash_key" ] 171 172 if (enable_vulkan) { 173 public_deps += [ ":vulkan_info" ] 174 } 175 176 deps = [ 177 ":process_json", 178 "//base", 179 "//build:branding_buildflags", 180 "//build:chromecast_buildflags", 181 "//gpu/command_buffer/common:common_sources", 182 "//gpu/ipc/common:gpu_preferences_interface", 183 "//gpu/vulkan:buildflags", 184 "//media:media_buildflags", 185 "//third_party/re2", 186 "//ui/gl", 187 "//ui/gl:buildflags", 188 "//ui/gl/init", 189 ] 190 191 # GpuPreferences is using its own mojo bindings which creates a 192 # cycle between this target and gpu_preferences_interface. 193 allow_circular_includes_from = 194 [ "//gpu/ipc/common:gpu_preferences_interface" ] 195 196 # Prefer mesa GL headers to system headers, which cause problems on Win. 197 include_dirs = [ "//third_party/mesa_headers" ] 198 199 if (is_win) { 200 libs = [ 201 "dxgi.lib", 202 "dxguid.lib", 203 ] 204 205 if (is_chrome_branded && is_official_build) { 206 sources += [ 207 "//third_party/amd/AmdCfxPxExt.h", 208 "//third_party/amd/amd_videocard_info_win.cc", 209 ] 210 } 211 } 212 if (is_mac) { 213 libs = [ "OpenGL.framework" ] 214 } 215 if (is_linux || is_mac) { 216 deps += [ "//third_party/angle:angle_gpu_info_util" ] 217 } 218 if (use_x11) { 219 deps += [ "//ui/gfx/linux:gpu_memory_buffer_support_x11" ] 220 } 221} 222