GN/Win: Vulkan support, convert -Vulkan bots.
authorMike Klein <mtklein@chromium.org>
Fri, 14 Oct 2016 18:04:56 +0000 (14:04 -0400)
committerMike Klein <mtklein@chromium.org>
Fri, 14 Oct 2016 20:45:28 +0000 (20:45 +0000)
CQ_INCLUDE_TRYBOTS=master.client.skia.compile:Build-Win-MSVC-x86_64-Release-Vulkan-Trybot;master.client.skia:Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan-Trybot,Perf-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Release-Vulkan-Trybot,Perf-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan-Trybot

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3421

Change-Id: I7012719fff66778488589ab9c15fd2fa2a109cd1
Reviewed-on: https://skia-review.googlesource.com/3421
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
BUILD.gn
infra/bots/recipe_modules/flavor/default_flavor.py
infra/bots/recipe_modules/flavor/gn_flavor.py
infra/bots/recipes/swarm_compile.expected/Build-Win-MSVC-x86_64-Release-Vulkan.json
infra/bots/recipes/swarm_test.expected/Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan.json

index e1f0fc8..14918da 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -118,10 +118,19 @@ config("skia_private") {
   lib_dirs = []
   if (skia_use_vulkan) {
     if (skia_vulkan_sdk != "") {
-      include_dirs += [ "$skia_vulkan_sdk/x86_64/include/" ]
-      lib_dirs += [ "$skia_vulkan_sdk/x86_64/lib/" ]
+      if (is_win) {
+        include_dirs += [ "$skia_vulkan_sdk/Include/" ]
+        lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
+      } else {
+        include_dirs += [ "$skia_vulkan_sdk/x86_64/include/" ]
+        lib_dirs += [ "$skia_vulkan_sdk/x86_64/lib/" ]
+      }
+    }
+    if (is_win) {
+      libs += [ "vulkan-1.lib" ]
+    } else {
+      libs += [ "vulkan" ]
     }
-    libs += [ "vulkan" ]
   }
 }
 
index aa8669b..64f35f1 100644 (file)
@@ -126,8 +126,6 @@ class DefaultFlavorUtils(object):
     if self.m.platform.is_win:
       make_cmd = ['python', 'make.py']
       self.m.run.run_once(self.bootstrap_win_toolchain)
-      if 'Vulkan' in self.m.vars.builder_name:
-        env['VULKAN_SDK'] = self.m.vars.slave_dir.join('win_vulkan_sdk')
     else:
       make_cmd = ['make']
     cmd = make_cmd + [target]
@@ -143,17 +141,7 @@ class DefaultFlavorUtils(object):
         raise
 
   def copy_extra_build_products(self, swarming_out_dir):
-    """Copy extra build products to specified directory.
-
-    Copy flavor-specific build products to swarming_out_dir for use in test and
-    perf steps."""
-    if ("Win" in self.m.vars.builder_name and
-        "Vulkan" in self.m.vars.builder_name):
-      # This copies vulkan-1.dll that has been bundled into win_vulkan_sdk
-      # since version 2  See skia/api BUILD_PRODUCTS_ISOLATE_WHITELIST
-      self.m.run.copy_build_products(
-          self.m.path['slave_build'].join('win_vulkan_sdk'),
-          swarming_out_dir)
+    pass
 
   @property
   def out_dir(self):
index d06d7c4..78b323d 100644 (file)
@@ -23,6 +23,7 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
       extra_config == 'Mesa',
       extra_config == 'NoGPU',
       extra_config.startswith('SK'),
+      extra_config == 'Vulkan',
       os == 'Ubuntu' and target_arch == 'x86',
     ])
 
@@ -62,6 +63,7 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
     win_toolchain = str(self.m.vars.slave_dir.join(
       't', 'depot_tools', 'win_toolchain', 'vs_files',
       '95ddda401ec5678f15eeed01d2bee08fcbc5ee97'))
+    win_vulkan_sdk = str(self.m.vars.slave_dir.join('win_vulkan_sdk'))
 
     cc, cxx = None, None
     extra_cflags = []
@@ -107,6 +109,7 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
       'cc':  cc,
       'cxx': cxx,
       'sanitize': extra_config if 'SAN' in extra_config else '',
+      'skia_vulkan_sdk': win_vulkan_sdk if extra_config == 'Vulkan' else '',
       'target_cpu': 'x86' if target_arch == 'x86' else '',
       'windk': win_toolchain if 'Win' in os else '',
     }.iteritems():
@@ -127,6 +130,17 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
     self._run('ninja', [ninja, '-C', self.out_dir],
               env={'NINJA_STATUS': '%%e [%%f/%%t] '})
 
+  def copy_extra_build_products(self, swarming_out_dir):
+    configuration = self.m.vars.builder_cfg.get('configuration', '')
+    extra_config  = self.m.vars.builder_cfg.get('extra_config',  '')
+    os            = self.m.vars.builder_cfg.get('os',            '')
+
+    win_vulkan_sdk = str(self.m.vars.slave_dir.join('win_vulkan_sdk'))
+    if 'Win' in os and extra_config == 'Vulkan':
+      self.m.run.copy_build_products(
+          win_vulkan_sdk,
+          swarming_out_dir.join('out', configuration + '_x64'))
+
   def step(self, name, cmd, env=None, **kwargs):
     app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0])
     cmd = [app] + cmd[1:]
index 1d129be..c8c6814 100644 (file)
     "cmd": [
       "python",
       "-u",
-      "[CUSTOM_C:\\_B_WORK]\\skia\\infra\\bots\\bootstrap_win_toolchain_json.py",
-      "--win_toolchain_json",
-      "[SLAVE_BUILD]\\src\\build\\win_toolchain.json",
-      "--depot_tools_parent_dir",
-      "[SLAVE_BUILD]"
+      "[CUSTOM_C:\\_B_WORK]\\skia\\bin\\fetch-gn"
     ],
-    "name": "bootstrap win toolchain"
+    "cwd": "[CUSTOM_C:\\_B_WORK]\\skia",
+    "env": {
+      "PATH": "%(PATH)s;RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools]"
+    },
+    "name": "fetch-gn"
   },
   {
     "cmd": [
-      "python",
-      "make.py",
-      "most"
+      "gn.bat",
+      "gen",
+      "[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86_64-Release-Vulkan\\Release_x64",
+      "--args=is_debug=false skia_vulkan_sdk=\"[SLAVE_BUILD]\\win_vulkan_sdk\" windk=\"[SLAVE_BUILD]\\t\\depot_tools\\win_toolchain\\vs_files\\95ddda401ec5678f15eeed01d2bee08fcbc5ee97\""
     ],
     "cwd": "[CUSTOM_C:\\_B_WORK]\\skia",
     "env": {
-      "BUILDTYPE": "Release_x64",
-      "CHROME_HEADLESS": "1",
-      "CHROME_PATH": "[SLAVE_BUILD]\\src",
-      "GYP_DEFINES": "qt_sdk=C:/Qt/4.8.5/ skia_arch_type=x86_64 skia_vulkan=1 skia_vulkan_debug_layers=0 skia_warnings_as_errors=1 skia_win_debuggers_path=c:/DbgHelp skia_win_ltcg=0",
-      "PATH": "%(PATH)s;RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools]",
-      "SKIA_OUT": "[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86_64-Release-Vulkan",
-      "VULKAN_SDK": "[SLAVE_BUILD]\\win_vulkan_sdk"
+      "PATH": "%(PATH)s;RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools]"
     },
-    "name": "build most"
+    "name": "gn gen"
+  },
+  {
+    "cmd": [
+      "ninja.exe",
+      "-C",
+      "[CUSTOM_C:\\_B_WORK]\\skia\\out\\Build-Win-MSVC-x86_64-Release-Vulkan\\Release_x64"
+    ],
+    "cwd": "[CUSTOM_C:\\_B_WORK]\\skia",
+    "env": {
+      "NINJA_STATUS": "%%e [%%f/%%t] ",
+      "PATH": "%(PATH)s;RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools];RECIPE_PACKAGE_REPO[depot_tools]"
+    },
+    "name": "ninja"
   },
   {
     "cmd": [
       "-u",
       "import errno\nimport glob\nimport os\nimport shutil\nimport sys\n\nsrc = sys.argv[1]\ndst = sys.argv[2]\nbuild_products_whitelist = ['dm', 'dm.exe', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', '*.so', '*.dll', '*.dylib', 'skia_launcher', 'lib/*.so', 'iOSShell.app', 'iOSShell.ipa', 'visualbench', 'visualbench.exe', 'vulkan-1.dll']\n\ntry:\n  os.makedirs(dst)\nexcept OSError as e:\n  if e.errno != errno.EEXIST:\n    raise\n\nfor pattern in build_products_whitelist:\n  path = os.path.join(src, pattern)\n  for f in glob.glob(path):\n    dst_path = os.path.join(dst, os.path.relpath(f, src))\n    if not os.path.isdir(os.path.dirname(dst_path)):\n      os.makedirs(os.path.dirname(dst_path))\n    print 'Copying build product %s to %s' % (f, dst_path)\n    shutil.move(f, dst_path)\n",
       "[SLAVE_BUILD]\\win_vulkan_sdk",
-      "[CUSTOM_[SWARM_OUT_DIR]]"
+      "[CUSTOM_[SWARM_OUT_DIR]]\\out\\Release_x64"
     ],
     "name": "copy build products (2)",
     "~followup_annotations": [
index 655d63d..786f1fc 100644 (file)
       "_",
       ".SRW"
     ],
-    "env": {
-      "BUILDTYPE": "Debug_x64",
-      "CHROME_HEADLESS": "1",
-      "SKIA_OUT": "[SLAVE_BUILD]\\out"
-    },
+    "cwd": "[SLAVE_BUILD]\\skia",
     "name": "dm"
   },
   {