1#!/bin/bash
2
3# Copyright 2015 The Android Open Source Project
4# Copyright (C) 2015 Valve Corporation
5
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9
10#      http://www.apache.org/licenses/LICENSE-2.0
11
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
19cd $dir
20
21rm -rf generated
22mkdir -p generated/include generated/common
23HEADERS_REGISTRY_PATH="$1"
24echo HEADERS_REGISTRY_PATH defined as $HEADERS_REGISTRY_PATH
25
26( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_safe_struct.h )
27( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_safe_struct.cpp )
28( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_enum_string_helper.h )
29( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_object_types.h )
30( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_dispatch_table_helper.h )
31( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH thread_safety.cpp )
32( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH thread_safety.h )
33( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH parameter_validation.cpp )
34( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH parameter_validation.h )
35( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_layer_dispatch_table.h )
36( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_extension_helper.h )
37( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH vk_typemap_helper.h )
38( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH object_tracker.cpp )
39( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH object_tracker.h )
40( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH layer_chassis_dispatch.cpp )
41( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH layer_chassis_dispatch.h )
42( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH chassis.cpp )
43( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry $HEADERS_REGISTRY_PATH/vk.xml -scripts $HEADERS_REGISTRY_PATH chassis.h )
44
45SPIRV_TOOLS_PATH=../../third_party/shaderc/third_party/spirv-tools
46SPIRV_TOOLS_UUID=spirv_tools_uuid.txt
47
48set -e
49
50( cd generated/include;
51
52  if [[ -d $SPIRV_TOOLS_PATH ]]; then
53
54    echo Found spirv-tools, using git_dir for external_revision_generator.py
55
56    python3 ../../../scripts/external_revision_generator.py \
57      --git_dir $SPIRV_TOOLS_PATH \
58      -s SPIRV_TOOLS_COMMIT_ID \
59      -o spirv_tools_commit_id.h
60
61  else
62
63    echo No spirv-tools git_dir found, generating UUID for external_revision_generator.py
64
65    # Ensure uuidgen is installed, this should error if not found
66    type uuidgen
67
68    uuidgen > $SPIRV_TOOLS_UUID;
69    cat $SPIRV_TOOLS_UUID;
70    python3 ../../../scripts/external_revision_generator.py \
71      --rev_file $SPIRV_TOOLS_UUID \
72      -s SPIRV_TOOLS_COMMIT_ID \
73      -o spirv_tools_commit_id.h
74
75  fi
76)
77
78
79exit 0
80