Add Vulkan mock_icd to the build

Bug: angleproject:2159

Add Vulkan mock_icd from validation layer source to the standard Vulkan
build. This can act as a NULL driver for Vulkan. Once the mock is built
set VK_ICD_FILENAMES env variable to
"<build_out_dir>/angledata/VkICD_mock_icd.json" to point loader to the
mock driver and make sure the built mock icd library resides in the
system's shared object search path.

Change-Id: Iea86325cf076df75fa82a4974c8a3a6249cdf8e0
Reviewed-on: https://chromium-review.googlesource.com/850892
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/scripts/generate_vulkan_layers_json.py b/scripts/generate_vulkan_layers_json.py
index e5fc773..d0fd25b 100755
--- a/scripts/generate_vulkan_layers_json.py
+++ b/scripts/generate_vulkan_layers_json.py
@@ -17,6 +17,10 @@
 source_dir = sys.argv[1]
 target_dir = sys.argv[2]
 
+data_key = 'layer'
+if 'icd' in source_dir:
+    data_key = 'ICD'
+
 if not os.path.isdir(source_dir):
     print(source_dir + " is not a directory.")
     sys.exit(1)
@@ -29,13 +33,13 @@
         data = json.load(infile)
 
         # update the path
-        if not 'layer' in data:
-            raise Exception("Could not find a layer key in " + json_fname)
+        if not data_key in data:
+            raise Exception("Could not find '" + data_key + "' key in " + json_fname)
 
         # The standard validation layer has no library path.
-        if 'library_path' in data['layer']:
-            prev_name = os.path.basename(data['layer']['library_path'])
-            data['layer']['library_path'] = prev_name
+        if 'library_path' in data[data_key]:
+            prev_name = os.path.basename(data[data_key]['library_path'])
+            data[data_key]['library_path'] = prev_name
 
         target_fname = os.path.join(target_dir, os.path.basename(json_fname))
         with open(target_fname, "w") as outfile: