Vulkan: Load layers relative to executable dir.

Instead of baking in a relative path and expecting the app to run from
a fixed directory, we can change the CWD at runtime so the layers can
load relative to the current executable directory.

Future alternatives could include modifying the layers SDK to provide
a path dynamically, but for now the relative paths must be baked in
at compile-time.

BUG=angleproject:1319
BUG=chromium:677841

Change-Id: I443b6b35d38276ea667cdf08ec2204ea280b6cec
Reviewed-on: https://chromium-review.googlesource.com/425441
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
diff --git a/scripts/generate_vulkan_header.py b/scripts/generate_vulkan_header.py
index 2e6a0c5..59ce2c4 100644
--- a/scripts/generate_vulkan_header.py
+++ b/scripts/generate_vulkan_header.py
@@ -10,19 +10,16 @@
 import os, sys
 
 if len(sys.argv) < 4:
-    print("Usage: " + sys.argv[0] + " <layers_source_path> <output_file> <default_vk_layers_path>")
+    print("Usage: " + sys.argv[0] + " <json_source_path> <output_file> <product_dir>")
     sys.exit(1)
 
 layers_source_path = sys.argv[1]
 output_file = sys.argv[2]
-default_vk_layers_path = sys.argv[3].rstrip("\"")
+product_dir = sys.argv[3].rstrip("\"")
 
 def fixpath(inpath):
-    return os.path.relpath(inpath).replace('\\', '/')
-
-def all_paths(inpath):
-    return fixpath(inpath) + ";" + fixpath(os.path.join("..", fixpath(inpath)))
+    return os.path.relpath(inpath, product_dir).replace('\\', '/')
 
 with open(output_file, "w") as outfile:
-    outfile.write("#define LAYERS_SOURCE_PATH \"" + all_paths(layers_source_path) + "\"\n")
-    outfile.write("#define DEFAULT_VK_LAYERS_PATH \"" + all_paths(default_vk_layers_path) + "\"\n")
+    outfile.write("#define LAYERS_SOURCE_PATH \"" + fixpath(layers_source_path) + "\"\n")
+    outfile.write("#define DEFAULT_VK_LAYERS_PATH \"" + fixpath(product_dir) + "\"\n")